CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

ShortCutMenuDisplay Property (ActiveX)

2023-1-3 06:28| 发布者: admin| 查看: 171| 评论: 0|来自: AutoCAD

摘要: 控制在绘图区域中单击鼠标右键是显示快捷菜单还是发出 Enter 键。

控制在绘图区域中单击鼠标右键是显示快捷菜单还是发出 Enter 键。

支持的平台:仅窗口

签名

工 务 局:

object.ShortCutMenuDisplay
对象

类型:首选项用户

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:在绘图区域中启用快捷菜单。
  • False:快捷菜单在绘图区域中被禁用。在绘图区域中单击鼠标右键将被解释为 Enter。

言论

此属性的初始值为。True

当此属性设置为 时,可以使用对象中的特性自定义在绘图区域中右键单击的功能。TruePreferencesUser

注意:此属性的值存储在快捷方式菜单系统变量中。

例子

工 务 局:

Sub Example_ShortCutMenuDisplay()
    ' This example reads and toggles the preference value which controls
    ' whether right-clicking in the drawing area displays a shortcut menu
    ' or issues ENTER.
    
    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Variant, newValue As Variant
    Dim newAction As String
    
    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.User
    
    ' Read and display the original value
    originalValue = ACADPref.ShortCutMenuDisplay
    newAction = IIf(originalValue, "displays the shortcut menu", "sends an ENTER keystroke to ACAD")
    MsgBox "Right-clicking the mouse CURRENTLY " & newAction, vbInformation

    ' Modify the AutoSnapMarker preference by toggling the value
    ACADPref.ShortCutMenuDisplay = Not (originalValue)
    newValue = ACADPref.ShortCutMenuDisplay
    newAction = IIf(newValue, "display the shortcut menu", "send an ENTER keystroke to ACAD")
    MsgBox "Right-clicking the mouse over the drawing WILL NOW " & newAction, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShortCutMenuDisplay()
    ;; This example reads and toggles the preference value which controls
    ;; whether right-clicking in the drawing area displays a shortcut menu
    ;; or issues ENTER.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    
    ;; Read and display the original value
    (setq originalValue (vla-get-ShortCutMenuDisplay (vla-get-User preferences)))
    (setq newAction (if (= originalValue :vlax-true) "displays the shortcut menu" "sends an ENTER keystroke to ACAD"))
    (alert (strcat "Right-clicking the mouse CURRENTLY " newAction))
  
    ;; Modify the AutoSnapMarker preference by toggling the value
    (vla-put-ShortCutMenuDisplay (vla-get-User preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ShortCutMenuDisplay (vla-get-User preferences)))
    (setq newAction (if (= newValue :vlax-true) "displays the shortcut menu" "sends an ENTER keystroke to ACAD"))
    (alert (strcat "Right-clicking the mouse over the drawing WILL NOW " newAction))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 23:45

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部