Auto Hide Feature
- 4 minutes to read
The auto hide feature enables you to imitate the behavior of dock windows in the Microsoft Visual Studio .NET IDE. When it is enabled for a dock control, the control is automatically hidden when the mouse pointer leaves its area. Also, the host dock site displays a bar at the edge where the control is hidden. Such bars contain labels corresponding to the controls that are hidden to this edge. Each label displays the caption text and image of the associated control. When end-users point to a label with the mouse, the appropriate control becomes visible.
End-users can enable this feature by clicking the auto hide button displayed within the control’s caption. Note that this button is displayed only if the cbHide option of the control’s CaptionButtons property is enabled. The feature can also be enabled via code by setting the control’s AutoHide property to True.
The image below illustrates how the auto hide feature can be enabled and how to show the hidden control.
Note that if the control is activated, it is not automatically hidden when the mouse pointer leaves its area. Dock controls can be activated by clicking their captions or by focusing any control residing within them. When the auto hide feature is enabled, it can also be activated by clicking its corresponding label. Finally, you can activate a control via code either by calling the control’s Activate method or assigning the control to the docking controller’s ActiveDockControl property.
Sometimes you may need to show and hide an auto hidden control via code. For instance, you may want to make a control visible in response to pressing a specific key. To do this, you need to assign the desired control to the ShowingControl property of the dock site where it resides. This dock site can be obtained via the AutoHideHostSite property of the control. Please refer to this property description for a code example.
If you need to respond to showing or hiding the control, handle the OnShowControl and OnHideControl events of the host dock site.
Note that by default, dock controls are hidden at the nearest dock site’s edge. Thus, if a control is docked to the right edge of a dock site, it will be hidden at the right edge. If a dock control fills the entire area supplied, the edge where it will be hidden is determined taking into account its dimensions and position. However, you can manually specify the edge where to hide the control. For this purpose, handle the control’s OnGetAutoHidePosition event.
Finally, the docking manager component provides a number of properties that affect the behavior of auto hidden controls. The table below lists these properties and provides their descriptions.
Property | Description |
---|---|
AutoHideInterval | Specifies the time interval that passes before dock controls are hidden. If the dock control is not active, for instance, this is the interval between moving the mouse pointer away from the control’s area and starting to hide the control. |
AutoHideMovingInterval | Specifies the time interval between control displacements when the control is sliding to become visible or hidden. |
AutoHideMovingSize | Specifies the number of pixels by which the dimensions of a dock control change when it slides to change its visibility state. The dimension changes occur repeatedly for every time interval specified by the AutoHideMovingInterval property. |
AutoShowInterval | Specifies the time interval that passes before dock controls are shown. For instance, this is the time taken from pointing to the control’s corresponding label and the start of displaying the control. |
Dock panels, tab containers and side containers have additional concepts related to the auto hide feature. Please refer to their descriptions for details.