CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

颜色名称属性 (ActiveX)

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

摘要: 指定颜色的名称(如果有)。

指定颜色的名称(如果有)。

支持的平台:仅窗口

签名

工 务 局:

object.ColorName
对象

类型:AcCm颜色

此属性适用的对象。

属性值

只读:是的

类型:字符串

颜色名称。

言论

没有额外的评论。

例子

工 务 局:

Sub Example_ColorName()
    'This example draws a circle and
    'returns the color name and color book name of the color.

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor." & Left(AcadApplication.Version, 2))
    
    col.SetRGB 125, 175, 235
    col.SetNames "MyColor", "MyColorBook"
    
    Dim cir As AcadCircle
    Dim pt(0 To 2) As Double
    Set cir = ThisDrawing.modelSpace.AddCircle(pt, 2)
    cir.TrueColor = col
    ZoomAll
    
    Dim retCol As AcadAcCmColor
    Set retCol = cir.TrueColor
    MsgBox "BookName=" & col.BookName & vbLf & _
           "ColorName=" & col.ColorName
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColorName()
    ;; This example draws a circle and
    ;; returns the color name and color book name of the color.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq col (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
    (vla-SetRGB col 125 175 235)
    (vla-SetNames col "MyColor" "MyColorBook")
    
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq cir (vla-AddCircle modelSpace pt 2))
    (vla-put-TrueColor cir col)
    (vla-ZoomAll acadObj)
    
    (setq retCol (vla-get-TrueColor cir))
    (alert (strcat "BookName=" (vla-get-BookName retCol)
                   "\nColorName=" (vla-get-ColorName retCol)))
  
    (vlax-release-object col)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 18:15

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部