CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

宽度属性 (ActiveX)

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

摘要: 指定对象的宽度。

指定对象的宽度。

支持的平台:仅窗口

签名

工 务 局:

object.Width
对象

类型:应用程序,DgnUnderlay,文档DwfUnderlayGeomapImageMTextOLEPdfUnderlayPointCloudPViewport光栅图像表格文本样式工具栏,视图视口擦除

此属性适用的对象。

属性值

只读:否(和对象除外,它们是只读的)GeomapImageRasterImageToolbar

类型:

给定对象的宽度。此值必须是正数、非负数。

言论

MText:以当前单位指定文本边界的宽度。AutoCAD 将文本换行在文本边界内,因此宽度必须为足以容纳文本的正数。如果宽度不够大,文本可能难以阅读或可能根本不可见。



OLE:OLE 对象的宽度是框架的X轴测量值。

表:表的宽度是X轴度量值。

文本样式: 设定字符间距。输入小于 1.0 的值将压缩文本。输入大于 1.0 的值将展开它。最大值为 100。

视口:视口的宽度是视口框架的X轴测量值。

视图:视图的宽度是用于显示模型的视口内区域的X轴测量值。

栅格:光栅图像的宽度(以像素为单位)。

例子

工 务 局:

Sub Example_Width()
    ' This example creates an MText object in model space.
    ' It then changes the width of the MText object.
    
    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0: corner(1) = 5: corner(2) = 0
    width = 10
    text = "This is the text String for the mtext Object"

    ' Creates the mtext Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll
    
    ' Find the current width of the mtext object
    width = MTextObj.width
    MsgBox "The current width of the mtext object is " & MTextObj.width, , "Width Example"
    
    ' Change the width of the mtext object
    MTextObj.width = width / 2
    MTextObj.Update
    MsgBox "The new width of the mtext object is " & MTextObj.width, , "Width Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Width()
    ;; This example creates an MText object in model space.
    ;; It then changes the width of the MText object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 0 5 0)
          width 10
          text "This is the text String for the mtext Object")

    ;; Creates the mtext Object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)
    
    ;; Find the current width of the mtext object
    (setq width (vla-get-width MTextObj))
    (alert (strcat "The current width of the mtext object is " (rtos width 2)))
    
    ;; Change the width of the mtext object
    (vla-put-width MTextObj (/ width 2))
    (vla-Update MTextObj)
    (alert (strcat "The new width of the mtext object is " (rtos (vla-get-width MTextObj) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 19:43

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部