

Visual Studio will prompt you to give the User Control a filename, such as UserControl1.vb.

To add a user control to your application, click the project node in Solution Explorer, and choose Add User Control from Visual Studios Project menu. Visual Studio provides a rich design-time experience for creating a user control. It can be set to None for no automatic positioning, or it can be set to FromTop, FromBottom, FromLeft, or FromRight.įigure 15.5 shows the effects of the various StackOrder settings. The stacking order is controlled by the ActionsPane.StackOrder property, which is of type. If multiple controls are added to the Controls collection, the actions pane can automatically stack and arrange the controls.

Then this control is added to the actions pane by calling the Add method of the Controls collection associated with the actions pane and passing the button instance as a parameter to the Add method. When you understand the architecture in Figure 15.4, you will not be too surprised to know that some properties from UserControl that are exposed by ActionsPanesuch as position-related properties, methods, and eventsdo not do anything.īecause the position of the ActionsPane UserControl is forced to fill the space provided by the ActionsPane window, for example, you cannot reposition the UserControl to arbitrary positions within the Document Actions task pane window.įirst, it declares and creates an instance of a control. It also adds some properties, events, and methods specific to ActionsPane. If the area of the Document Actions task pane is not big enough to display all the controls hosted by the UserControl, it is possible to scroll the UserControl by setting the AutoScroll property of ActionsPane to True.
