Private Sub btnShowTree_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles btnShowTree.Click Me.UltraPopupControlContainer1.Show() End Sub
The WinPopupControlContainer™ gives you an effective way to conserve screen real estate while providing functionality to your users. You can use this component to represent a portion of your application’s interface in a single control, such as a command button. When the user clicks the button, a container opens presenting the controls that make up the interface. Common uses for pop-up container controls might include a custom list view, a table-based interface or a selection of graphical options.
WinPopupControlContainer displays no user interface at design-time. You assign the control you want to appear as the pop-up control, using the PopupControl property.
At run time, you invoke the Show method of the element to display its contents at the current mouse position or at a specified point.
Double-click the UltraPopupControlContainer component in the Visual Studio toolbox. The component will be added to the component tray area of the current form.
Add the control that you want to appear as a pop-up, or verify that it already exists on the form. This can be a container control, such as a Panel, that contains other controls. It can even be the form itself.
Select the UltraPopupControlContainer component and in the properties grid locate the PopupControl property. Select from the drop-down list the control that will serve as the pop-up container.
Add the control to the form that will be used to display the pop-up container. Typically, this will be a button control.
Add the following code to the Click event of the button (or other control) that will display the pop-up:
In Visual Basic:
Private Sub btnShowTree_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles btnShowTree.Click Me.UltraPopupControlContainer1.Show() End Sub
In C#:
private void btnShowTree_Click(object sender, EventArgs e) { this.ultraPopupControlContainer1.Show(); }
Build and run the project. You will see that the control you have specified as the pop-up is hidden when the form is displayed. Clicking the button displays the pop-up control at the current position of the mouse. If you used a container control for the pop-up, you can click on any of the controls it contains, or anywhere inside the container, and the pop-up remains on screen. Click outside of the pop-up control, and it is dismissed.