ActiveTextStyle 属性 (ActiveX)
指定绘图的活动文本样式。 支持的平台:仅限 Windows 言论添加到图形中的新文本将采用活动文本样式。未指定不同文本样式的现有文本将采用新的活动文本样式。 仅将当前活动文本样式重置为活动文本样式后,对当前活动文本样式所做的更改才会可见。若要重置活动文本样式,只需使用更新的文本样式对象调用此属性即可。
注意:必须调用该方法才能查看此更改。Regen
若要为对象指定不同的文本样式,使其不会随活动文本样式一起更改,请使用该属性。StyleName 例子VBA: 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
可视化 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-11-1 08:27
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.