指定绘图的活动文本样式。 支持的平台:仅窗口 言论添加到图形中的新文本将采用活动文本样式。未指定不同文本样式的现有文本将采用新的活动文本样式。 对当前活动文本样式所做的更改只有在该文本样式重置为活动文本样式后才会可见。若要重置活动文本样式,只需使用更新的文本样式对象调用此属性。 注意:必须调用该方法才能看到此更改。Regen
若要为对象指定不同的文本样式,使其不会随活动文本样式一起更改,请使用 theproperty。StyleName 例子工 务 局: Sub Example_ActiveTextStyle() ' This example returns the current text style ' and then sets a new style. ' Finally, it returns the style to the previous setting. Dim newTextStyle As AcadTextStyle Dim currTextStyle As AcadTextStyle ' Return current text style of active document Set currTextStyle = ThisDrawing.ActiveTextStyle MsgBox "The current text style is " & currTextStyle.name, vbInformation, "ActiveTextStyle Example" ' Create a text style and make it current Set newTextStyle = ThisDrawing.TextStyles.Add("TestTextStyle") ThisDrawing.ActiveTextStyle = newTextStyle MsgBox "The new text style is " & newTextStyle.name, vbInformation, "ActiveTextStyle Example" ' Reset the text style to its previous setting ThisDrawing.ActiveTextStyle = currTextStyle MsgBox "The text style is reset to " & currTextStyle.name, vbInformation, "ActiveTextStyle Example" End Sub Visual LISP: (vl-load-com) (defun c:Example_ActiveTextStyle() ;; This example returns the current text style ;; and then sets a new style. ;; Finally, it returns the style to the previous setting. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Return current text style of active document (setq currTextStyle (vla-get-ActiveTextStyle doc)) (alert (strcat "The current text style is " (vla-get-Name currTextStyle))) ;; Create a text style and make it current (setq textStyles (vla-get-TextStyles doc)) (setq newTextStyle (vla-Add textStyles "TestTextStyle")) (vla-put-ActiveTextStyle doc newTextStyle) (alert (strcat "The new text style is " (vla-get-Name newTextStyle))) ;; Restore the previous text style (vla-put-ActiveTextStyle doc currTextStyle) (alert (strcat "The text style is restored to " (vla-get-Name currTextStyle))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:32
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.