CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

模型十字准线颜色属性 (ActiveX)

2023-1-3 10:50| 发布者: admin| 查看: 425| 评论: 0|来自: AutoCAD

摘要: 指定模型空间的十字准线和文本的颜色。

指定模型空间的十字准线和文本的颜色。

支持的平台:仅窗口

签名

工 务 局:

object.ModelCrosshairColor
对象

类型:首选项显示

此属性适用的对象。

属性值

只读:

类型:OLE_COLOR(常量)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

言论

此属性的初始值为。vbWhite

若要指定图纸空间布局的十字准线颜色,请使用该属性。LayoutCrosshairColor

例子

工 务 局:

Sub Example_ModelCrossHairColor()
    ' This example returns the current setting of
    ' Model space CrossHairColor. It then changes the value, and
    ' finally resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currCrossHairColor As OLE_COLOR
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Retrieve the current CrossHairColor value
    currCrossHairColor = preferences.DISPLAY.ModelCrosshairColor
    MsgBox "The current value for the model space CrossHairColor is " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"
    
    ' Change the value for CrossHairColor
    preferences.DISPLAY.ModelCrosshairColor = vbGreen
    MsgBox "The new value for CrossHairColor is " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"
    
    ' Reset CrossHairColor to its original value
    preferences.DISPLAY.ModelCrosshairColor = currCrossHairColor
    MsgBox "The CrossHairColor value is reset to " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"
        
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ModelCrossHairColor()
    ;; This example returns the current setting of
    ;; Model space CrossHairColor. It then changes the value, and
    ;; finally resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
  
    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))
    
    ;; Retrieve the current CrossHairColor value
    (setq currCrossHairColor (vlax-variant-change-type (vla-get-ModelCrosshairColor ACADPref) vlax-vbLong))
    (alert (strcat "The current value for the model space CrossHairColor is " (itoa (vlax-variant-value currCrossHairColor))))
    
    ;; Change the value for CrossHairColor
    (vla-put-ModelCrosshairColor ACADPref (vlax-make-variant acGreen 19))
    (setq newValue (vlax-variant-change-type (vla-get-ModelCrosshairColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for CrossHairColor is " (itoa (vlax-variant-value newValue))))
    
    ;; Reset CrossHairColor to its original value
    (vla-put-ModelCrosshairColor ACADPref (vlax-variant-change-type currCrossHairColor 19)) 
    (alert (strcat "The CrossHairColor value is reset to " (itoa (vlax-variant-value currCrossHairColor))))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 08:48

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部