Sets the large and small bitmaps used as icons for the toolbar item.
Supported platforms: Windows only
VBA:
object.SetBitmaps SmallIconName, LargeIconName
Type: ToolbarItem
The object this method applies to.
Access: Input-only
Type: String
The path and file name for the small bitmap.
Access: Input-only
Type: String
The path and file name for the large bitmap.
No return value.
No additional remarks.
VBA:
Sub Example_SetBitmaps()
' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
' It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
' with a custom icon. The menu is automatically shown.
'
' * NOTE: The paths of the icons for the new toolbar should be updated
' before running this example.
Dim currMenuGroup As AcadMenuGroup
Dim newToolBar As AcadToolbar, newToolBarButton As AcadToolbarItem
Dim openMacro As String
Dim SmallBitmapName As String, LargeBitmapName As String
On Error GoTo ERRORTRAP
' Use MenuGroups property to obtain reference to main AutoCAD menu
Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")
' Create the new Toolbar in this group
Set newToolBar = currMenuGroup.Toolbars.Add("TestMenu")
' Add an item to the new Toolbar and assign an Open macro
' (VBA equivalent of: "ESC ESC _open ")
openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)
Set newToolBarButton = newToolBar.AddToolbarButton(newToolBar.count + 1, "Open", "Open Macro", openMacro, False)
' Read icon paths for this Toolbar button
GoSub READPATHS
' Change the default icon (smile face) for the new toolbar button
SmallBitmapName = "C:\AutoCAD\16x16.bmp" ' Use a 16x16 pixel .BMP image
LargeBitmapName = "C:\AutoCAD\32x32.bmp" ' Use a 32x32 pixel .BMP image
newToolBarButton.SetBitmaps SmallBitmapName, LargeBitmapName
' Read icon paths for this Toolbar button
GoSub READPATHS
Exit Sub
READPATHS:
' Read icon paths for this Toolbar button
newToolBarButton.GetBitmaps SmallBitmapName, LargeBitmapName
MsgBox "The new Toolbar uses the following icon files: " & _
vbCrLf & vbCrLf & "Small Bitmap: " & SmallBitmapName & vbCrLf & _
"Large Bitmap: " & LargeBitmapName
Return
ERRORTRAP:
MsgBox "The following error has occurred: " & Err.Description
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_SetBitmaps()
;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
;; It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
;; with a custom icon into it. The menu is automatically shown.
;;
;; * NOTE: The paths of the icons for the new toolbar should be updated
;; before running this example.
(setq acadObj (vlax-get-acad-object))
(setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))
;; Create the new Toolbar in this group
(setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))
;; Add an item to the new Toolbar and assign an Open macro
;; (VBA equivalent of: "ESC ESC _open ")
(setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
(setq newButton (vla-AddToolbarButton newToolBar "" "NewButton" "Open a file." openMacro))
;; Read icon paths for this Toolbar button
(vla-GetBitmaps newButton 'SmallBitmapName 'LargeBitmapName)
(alert (strcat "The new Toolbar uses the following icon files: \n"
"Small Bitmap: " SmallBitmapName "\n"
"Large Bitmap: " LargeBitmapName))
;; Change the default icon (smile face) for the new toolbar button
(setq SmallBitmapName "C:\\AutoCAD\\16x16.bmp") ;; Use a 16x16 pixel .BMP image
(setq LargeBitmapName "C:\\AutoCAD\\32x32.bmp") ;; Use a 32x32 pixel .BMP image
(vla-SetBitmaps newButton SmallBitmapName LargeBitmapName)
;; Read icon paths for this Toolbar button
(vla-GetBitmaps newButton 'SmallBitmapName 'LargeBitmapName)
(alert (strcat "The new Toolbar uses the following icon files: \n"
"Small Bitmap: " SmallBitmapName "\n"
"Large Bitmap: " LargeBitmapName))
)