CoolBar Control (VBCCRCoolBar)
The CoolBar control is a modern toolbar container control that allows users to rearrange and resize toolbars through dragging. Each toolbar can contain other controls such as buttons, combo boxes, etc.
Properties
Basic Properties
Bands
- CoolBar bands collectionBandCount
- Number of bandsBackColor
- Background colorForeColor
- Foreground colorEnabled
- Whether control is enabledFont
- Font settingsVisible
- Whether visible
Band Properties
Band(Index).Text
- Band title textBand(Index).Width
- Band widthBand(Index).MinWidth
- Band minimum widthBand(Index).MinHeight
- Band minimum heightBand(Index).NewRow
- Whether to display on new rowBand(Index).ImageIndex
- Image indexBand(Index).Style
- Band styleRBBS_NORMAL
(0) - Normal styleRBBS_BREAK
(1) - Line breakRBBS_FIXEDSIZE
(2) - Fixed sizeRBBS_GRIPPERALWAYS
(4) - Always show gripperRBBS_NOGRIPPER
(8) - Don't show gripper
Band(Index).Child
- Child controlBand(Index).ChildEdge
- Whether to show child control borderBand(Index).Visible
- Whether visible
Events
BeginBandResize
- Triggered when band resizing beginsBeginBandMove
- Triggered when band moving beginsEndBandResize
- Triggered when band resizing endsEndBandMove
- Triggered when band moving endsBandClick
- Triggered when band is clickedBandDblClick
- Triggered when band is double-clickedHeightChanged
- Triggered when height changesChange
- Triggered when any change occurs
Code Examples
Basic Usage
vb
Private Sub InitCoolBar()
With CoolBar1
' Add first band (toolbar)
With .Bands.Add
.Text = "File"
.MinWidth = 200
.Width = 250
Set .Child = ToolBar1
.ChildEdge = True
End With
' Add second band (combo box)
With .Bands.Add
.Text = "Search"
.MinWidth = 150
.Width = 200
Set .Child = ComboBox1
.ChildEdge = True
End With
End With
End Sub
Band Manager
vb
Private Type BandInfo
Index As Long
Text As String
Width As Long
MinWidth As Long
MinHeight As Long
NewRow As Boolean
Style As Long
Visible As Boolean
Position As Long
End Type
Private Type BandManager
Bands() As BandInfo
Count As Long
End Type
Private Manager As BandManager
Private Sub InitBandManager()
With Manager
ReDim .Bands(1 To 100)
.Count = 0
' Save current band information
SaveBandInfo