Define the Toolbar Button Image
 
 
 

To define the images to be used on a toolbar button, use the SetBitmaps and GetBitmaps methods.

The SetBitmaps method takes two parameters: SmallIconName and LargeIconName.

SmallIconName

The small icon name identifies the ID string of the small-image resource (16W15 bitmap). The string must comprise alphanumeric characters with no punctuation other than a dash (-) or an underscore (_), and should include the .bmp extension. The resource can be either a system bitmap or a user-defined bitmap. User-defined bitmaps must be of the appropriate size and must reside in the Support path.

LargeIconName

The large icon name identifies the ID string of the large-image resource (24W22 bitmap). The string must comprise alphanumeric characters with no punctuation other than a dash (-) or an underscore (_), and should include the .bmp extension. The resource can be either a system bitmap or a user-defined bitmap. User-defined bitmaps must be of the appropriate size and must reside in the Support path.

Query an existing toolbar to find the name of the icons for the buttons

Sub Ch6_GetButtonImages()
	Dim Button As AcadToolbarItem
	Dim Toolbar0 As AcadToolbar
	Dim MenuGroup0 As AcadMenuGroup
	Dim SmallButtonName As String
	Dim LargeButtonName As String
	Dim msg As String
	Dim ButtonType As String


	' Get the first toolbar in the first menu group
	Set MenuGroup0 = ThisDrawing.Application. _
								 MenuGroups.Item(0)
	Set Toolbar0 = MenuGroup0.Toolbars.Item(0)


	' Clear the string variables
	SmallButtonName = ""
	LargeButtonName = ""


	' Create a header for the message box and
	' display the toolbar to be queried
	msg = "Toolbar: " + Toolbar0.Name + vbCrLf
	Toolbar0.Visible = True


	' Iterate through the toolbar and collect data
	' for each button in the toolbar. If the toolbar is
	' a normal button or a flyout, collect the small
	' and large button names for the button.
	For Each Button In Toolbar0
		ButtonType = Choose(Button.Type + 1, "Button", _
						"Separator", "Control", "Flyout")
		msg = msg & ButtonType & ":   "
		If Button.Type = acToolbarButton Or _
					 Button.Type = acToolbarFlyout Then
			Button.GetBitmaps SmallButtonName, _
							LargeButtonName
			msg = msg + SmallButtonName + ", " _
					+ LargeButtonName
		End If
		msg = msg + vbCrLf
	Next Button


	' Display the results
	MsgBox msg
End Sub