CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

浮出控件属性 (ActiveX)

2023-1-3 16:20| 发布者: admin| 查看: 536| 评论: 0|来自: AutoCAD

摘要: 获取与浮出控件工具栏项关联的工具栏。

获取与浮出控件工具栏项关联的工具栏。

支持的平台:仅窗口

签名

工 务 局:

object.Flyout
对象

类型:工具栏项

此属性适用的对象。

属性值

只读:是的

类型:工具栏

包含工具栏项的工具栏。

言论

没有额外的评论。

例子

工 务 局:

Sub Example_Flyout()
    ' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ' It then creates a new Toolbar(TestMenu) with a Toolbar button that will act
    ' as a flyout.  The examples sets the Flyout menu to an existing Toolbar menu.
    ' The Toolbar will automatically be displayed and will display the UCS menu
    ' as a flyout.
        
    Dim currMenuGroup As acadMenuGroup
    Dim newToolBar As AcadToolbar, newToolBarFlyoutButton As AcadToolbarItem
    
    On Error GoTo ERRORTRAP
    
    ' Use MenuGroups property to obtain reference to main AutoCAD menu
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")
    
    ' Create a new Toolbar in this group
    Set newToolBar = currMenuGroup.Toolbars.Add("TestMenu")
    
    ' Add new button to TestMenu that will link to the Flyout menu
    '
    ' * NOTE: Set the macro name to the name of the flyout toolbar because
    ' setting it to an empty string causes an error.  The paremeter
    ' is actually ignored when the style is flyout, but must have any value other than "".
    Set newToolBarFlyoutButton = newToolBar.AddToolbarButton(newToolBar.count + 1, "Flyout", "Flyout", "UCS", True)
    
    ' Link the existing toolbar "UCS" as the flyout for the new toolbar button
    '
    ' * NOTE: To change the flyout, simply change the MenuGroup and Toolbar name below
    newToolBarFlyoutButton.AttachToolbarToFlyout "ACAD", "UCS"
   
    MsgBox "The flyout attached to the Test menu is " & newToolBarFlyoutButton.Flyout.name
    
    Exit Sub

ERRORTRAP:
    MsgBox "The following error has occurred: " & Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Flyout()
    ;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ;; It then creates a new Toolbar(TestMenu) with a Toolbar button that will act
    ;; as a flyout.  The examples sets the Flyout menu to an existing Toolbar menu.
    ;; The Toolbar will automatically be displayed and will display the UCS menu
    ;; as a flyout.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))
    
    ;; Create a new Toolbar in this group
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))
    
    ;; Add new button to TestMenu that will link to the Flyout menu
    ;;
    ;; * NOTE: Set the macro name to the name of the flyout toolbar because
    ;; setting it to an empty string causes an error.  The paremeter
    ;; is actually ignored when the style is flyout, but must have any value other than "".
    (setq newToolBarFlyoutButton (vla-AddToolbarButton newToolBar (1+ (vla-get-Count newToolBar)) "Flyout" "Flyout" "UCS" :vlax-true))
    
    ;; Link the existing toolbar "UCS" as the flyout for the new toolbar button
    ;;
    ;; * NOTE: To change the flyout, simply change the MenuGroup and Toolbar name below
    (vla-AttachToolbarToFlyout newToolBarFlyoutButton "ACAD" "UCS")
   
    (alert (strcat "The flyout attached to the Test menu is " (vla-get-Name (vla-get-Flyout newToolBarFlyoutButton))))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 18:24

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部