获取用作工具栏项图标的大小位图。 支持的平台:仅窗口 签名工 务 局: object.GetBitmaps SmallIconName, LargeIconName
返回值(RetVal)无返回值。 言论没有额外的评论。 例子工 务 局: Sub Example_GetBitmaps()
' 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.
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_GetBitmaps()
;; 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))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-27 21:59
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.