Returns or sets a constant or value that determines the appearance and behavior of a Button object in a Toolbar control.
Syntax
object.Style [=value]
The Style property syntax has these parts:
Part | Description |
object | An object expression that evaluates to a Button object. |
value | A constant or integer that determines the appearance and behavior of a Button object, as specified in Settings. |
Settings
The settings for value are:
Constant | Value | Description |
tbrDefault | 0 | (Default) Button. The button is a regular push button. |
tbrCheck | 1 | Check. The button is a check button, which can be checked or unchecked. |
tbrButtonGroup | 2 | ButtonGroup. The button remains pressed until another button in the group is pressed. Exactly one button in the group can be pressed at any one moment. |
tbrSeparator | 3 | Separator. The button functions as a separator with a fixed width of 8 pixels. |
tbrPlaceholder | 4 | Placeholder. The button is like a separator in appearance and functionality, but has a settable width. |
tbrDropDown | 5 | MenuButton drop down. Use this style to see MenuButton objects. |
Remarks
Buttons that have the ButtonGroup style must be grouped. To distinguish a group, place all Button objects with the same style (ButtonGroup) between two Button objects with the Separator style.
You can also place another control on a toolbar by assigning a Button object the PlaceHolder style, then drawing a control on to the toolbar. For example, to place a drop-down combo box on a toolbar at design time, add a Button object with the PlaceHolder style and size it to the size of a ComboBox control. Then place a ComboBox on the placeholder.
When a Button object is assigned the PlaceHolder style, you can set the value of the Width property to accommodate another control placed on the Button. If a Button object has the Button, Check, or ButtonGroup style, the height and width are determined by the ButtonHeight and ButtonWidth properties.
If you place a control on a button with the PlaceHolder style, you must use code to align and size the control if the form is resized, as shown below:
Private Sub Form_Resize()
' Track a ComboBox by setting its Top, Left, and
' Width properties
' to the Top, Left, and Width properties of a
' Button object
With Toolbar1.Buttons("Combo1")
Combo1.Move .Left,.Top,.Width
End With
End Sub