兰州人 发表于 2008-6-24 20:41:00

ThisDrawing.ActiveTextStyle.fontFile 的用法

本帖最后由 作者 于 2008-6-24 22:35:51 编辑 <br /><br /> <p>在<a href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=859&amp;replyID=3648&amp;skin=1">http://bbs.mjtd.com/forum.php?mod=viewthread&tid=859&amp;replyID=3648&amp;skin=1</a>对ActiveTextStyle的应用要比VBA的帮助文件更容易理解.</p><p>如,ThisDrawing.ActiveTextStyle.fontFile = "c:\windows\fonts\simsun.ttf"</p><p>帮助文件就比较麻烦了.</p><pre class="Code">Sub Example_ActiveTextStyle()<br/>&nbsp;&nbsp;&nbsp;&nbsp;' This example returns the current text style<br/>&nbsp;&nbsp;&nbsp;&nbsp;' and then sets a new style.<br/>&nbsp;&nbsp;&nbsp;&nbsp;' Finally, it returns the style to the previous setting.<br/>&nbsp;&nbsp;&nbsp;&nbsp;Dim newTextStyle As AcadTextStyle<br/>&nbsp;&nbsp;&nbsp;&nbsp;Dim currTextStyle As AcadTextStyle<br/>&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;' Return current text style of active document<br/>&nbsp;&nbsp;&nbsp;&nbsp;Set currTextStyle = ThisDrawing.ActiveTextStyle<br/>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox "The current text style is " &amp; currTextStyle.name, vbInformation, "ActiveTextStyle Example"<br/>&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;' Create a text style and make it current<br/>&nbsp;&nbsp;&nbsp;&nbsp;Set newTextStyle = ThisDrawing.TextStyles.Add("TestTextStyle")<br/>&nbsp;&nbsp;&nbsp;&nbsp;ThisDrawing.ActiveTextStyle = newTextStyle<br/>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox "The new text style is " &amp; newTextStyle.name, vbInformation, "ActiveTextStyle Example"<br/>&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;' Reset the text style to its previous setting<br/>&nbsp;&nbsp;&nbsp;&nbsp;ThisDrawing.ActiveTextStyle = currTextStyle<br/>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox "The text style is reset to " &amp; currTextStyle.name, vbInformation, "ActiveTextStyle Example"<br/>End Sub</pre><pre class="Code">&nbsp;</pre><pre class="Code">&nbsp;</pre>

robbin840311 发表于 2008-6-25 08:29:00

路过,学习,谢谢兰州人
页: [1]
查看完整版本: ThisDrawing.ActiveTextStyle.fontFile 的用法