指定对象的宽度。 支持的平台:仅窗口 签名工 务 局: object.Width
属性值只读:否(和对象除外,它们是只读的)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))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:38
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.