DesktopToolbarButton.Icon

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Picture )
aDesktopToolbarButton.Icon = newPictureValue
or
PictureValue = aDesktopToolbarButton.Icon

New in 2021r3

Supported for all project types and targets.

The picture to be displayed by the DesktopToolbarButton.

Example

This example adds icons to the Cities menu and each MenuItem in the Initialized event of the Toolbar.

DropDownButton = New DesktopToolButton
DropDownButton.ButtonStyle = DesktopToolbarButton.ButtonStyles.DropDown
DropDownButton.Caption = "Cities"

// create a menu
Var myMenu As New DesktopMenuItem
Var myMenuItem1 As New DesktopMenuItem
Var myMenuItem2 As New DesktopMenuItem
Var myMenuitem3 As New DesktopMenuItem

DropDownButton.Name = "Cities Menu"
myMenu.Text = "Cities"
myMenu.Icon = IndiaImage

myMenuItem1.Text = "Grand Blanc"
myMenuItem2.Text = "Bad Axe"
myMenuitem3.Text = "Flint"
// icons added to the project
myMenuItem1.Icon = SaturnImage
myMenuItem2.icon = VenusImage
myMenuItem3.icon = UranusImage
myMenu.Add(myMenuItem1)
myMenu.Add(myMenuItem2)
myMenu.Add(myMenuItem3)

// assign the new menu to the toolitem..
DropDownButton.Menu = myMenu

// add to the toolbar
Me.Add(DropDownButton)