vbAccelerator Visual Studio Style Tab Control This control reimplements the tab drawing code used in the
vbAccelerator MDITabs Control as a fully-featured Visual Studio style Tab Control,
with a fully-typed object interface. It also supports pinning and unpinning tabs, so when they're unpinned they
show a small vertical tab-bar which slides-out the tab to the display. Cool! Features of the ControlThe visual style of the tab control closely follows the styles of the tabs
displayed in Visual Studio.NET. The design of the control enables the following features: - Position tabs at the bottom or the top of the control.
- Tabs can be dragged by the user to any position.
- Tabs can optionally display an icon before the caption.
- Set whether tabs are squashed up if there is insufficient room, or whether scroll buttons are displayed.
- A Close button can be displayed, and if it is, you can determine for individual tabs whether the close
button is enabled or not.
- Independent fonts for selected and non-selected tabs.
- Disabled tabs can't be selected by the user.
- Pinnable mode allows the tab to display in a compact vertical form where the tabs slide out as the mouse
moves over the tabs. Once pinned, the control converts to the standard tab style.
Using the ControlThe object model for the Tab control is shown below: 
Tab Control Object Model There are three main areas in using the control: - Configuring the Control
- Adding and Removing Tabs
- Responding to Events
These will be covered in turn. Configuring the ControlThese properties and methods are exposed through the main control interface. All can be
modified at run-time and most can be set in the IDE at design-time. Adding and Removing TabsManipulating the tabs in the control is achieved through the Tabs property
of the control, which returns a cTabCollection class. This class supports the
following methods: - Add
Adds or inserts a tab to the control. You can specify the Key, Caption and IconIndex
you want for the tab at this point. Once the tab has been created, the method returns
a cTab object which you can use to set any additional properties. It is
highly recommended to associate a Key with the tab at this point, as the Key cannot
be changed later, and as the user can re-order the tabs, you cannot be sure which
index a particular tab will be found at. - Count
Returns the number of tabs currently in the control. - Item
Returns a cTab object for the specified Key or index. - Remove
Removes a tab from the control based on its Key or index.
The cTab class is used to get and set all of the properties of an individual tab. - CanClose
Gets/sets whether the Close button is enabled (if the ShowCloseButton property is set
for the control) for this tab. - Caption
Gets/sets the caption for the tab. - Enabled
Gets/sets whether the tab is enabled (can be selected by the user). - IconIndex
Gets/sets the 0-based index of the icon to be displayed for this tab. If you don't want
an icon, set to -1 (the default value). - ItemData
Gets/sets an optional long value to be associated with the tab. - Key
Gets the Key for this tab - Panel
Gets/sets a control to be displayed in the ClientArea of the tab when the tab is selected. - Selected
Gets/sets whether the tab is selected or not. - Tag
Gets/sets an optional string value to be associated with the tab. - ToolTipText
Gets/sets the tooltip to be displayed when the mouse hovers over the tab.
Responding to EventsThe tab control generates the following events: - Resize
Raised whenever the control is resized - TabDoubleClick
Raised when a tab is double clicked, passing cTab object. - TabClose
Raised when the close button is clicked for a tab, passing a cTab object for the
tab which has been clicked and a Cancel argument, which can be set to True to prevent the
tab from being removed, - TabClick
Raised whenever the user clicks a tab. Passes a cTab object and the mouse details
for the click. - TabBarClick
Raised whenever the user clicks on a non-tab portion of the tab bar. Passes the mouse details
for the click. - TabSelected
Raised whenever the selected tab changes. Provides a cTab object containing details
of the selected tab.
DocumentationDocumentation for the control, created using ActiveX Documenter
is also available as a download. |
|