本帖最后由 作者 于 2008-6-24 22:35:51 编辑
在http://bbs.mjtd.com/forum.php?mod=viewthread&tid=859&replyID=3648&skin=1对ActiveTextStyle的应用要比VBA的帮助文件更容易理解. 如,ThisDrawing.ActiveTextStyle.fontFile = "c:\windows\fonts\simsun.ttf" 帮助文件就比较麻烦了. 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 |