AttachmentPoint 属性 (ActiveX)
指定 MText 对象的连接点。 支持的平台:仅限 Windows 属性值只读:不 类型:枚举acAttachmentPoint
言论连接点指定插入点与文本边界对齐的位置。所选选项可确定与文本边界相关的文本对齐方式和文本溢出。文本对齐的选项为“左”(Left)、“右”(Right) 和“居中”(Center)。文本溢出的选项包括“顶部”、“中间”(中间)和“底部”。
更改属性时,现有边界框的位置不会更改;文本只是在边界框内重新对齐。但是,该属性反映了正在使用的连接点的坐标,因此该属性的值将更改以反映对齐的更改。AttachmentPointInsertionPointInsertionPoint 例子VBA: Sub Example_AttachmentPoint() Dim MTextObj As AcadMText Dim width As Double Dim text As String Dim count As Integer Dim attachPoint As String Dim corner(0 To 2) As Double corner(0) = 3#: corner(1) = 3#: corner(2) = 0# width = 10 text = "Hello, World." ' Creates a MText object in model space Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text) For count = 1 To 9 MTextObj.AttachmentPoint = count ' Gets the attachment point of an MText object attachPoint = Choose(MTextObj.AttachmentPoint, "TopLeft", "TopCenter", "TopRight", "MiddleLeft", "MiddleCenter", "MiddleRight", "BottomLeft", "BottomCenter", "BottomRight") ThisDrawing.Regen True MsgBox "The attachment point of the MText is now: " & attachPoint, vbInformation, "AttachmentPoint Example" Next End Sub 可视化 LISP: (vl-load-com) (defun c:Example_AttachmentPoint() (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq corner (vlax-3d-point 3 3 0) width 10 text "Hello, World.") ;; Creates a MText object in model space (setq modelSpace (vla-get-ModelSpace doc)) (setq MTextObj (vla-AddMText modelSpace corner width text)) (setq count 1) (repeat 9 (vla-put-AttachmentPoint MTextObj count) ;; Gets the attachment point of an MText object (cond ((= (vla-get-AttachmentPoint MTextObj) 1)(setq attachPoint "TopLeft")) ((= (vla-get-AttachmentPoint MTextObj) 2)(setq attachPoint "TopCenter")) ((= (vla-get-AttachmentPoint MTextObj) 3)(setq attachPoint "TopRight")) ((= (vla-get-AttachmentPoint MTextObj) 4)(setq attachPoint "MiddleLeft")) ((= (vla-get-AttachmentPoint MTextObj) 5)(setq attachPoint "MiddleCenter")) ((= (vla-get-AttachmentPoint MTextObj) 6)(setq attachPoint "MiddleRight")) ((= (vla-get-AttachmentPoint MTextObj) 7)(setq attachPoint "BottomLeft")) ((= (vla-get-AttachmentPoint MTextObj) 8)(setq attachPoint "BottomCenter")) ((= (vla-get-AttachmentPoint MTextObj) 9)(setq attachPoint "BottomRight")) ) (vla-Regen doc :vlax-true) (alert (strcat "The attachment point of the MText is now: " attachPoint)) (setq count (1+ count)) ) ) |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-3-14 05:36
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.