关于指定字体 (VBA/ActiveX)
字体定义构成每个字符集的文本字符的形状。 一种字体可以由多种样式使用。若要将字体指定给文本样式,请使用对象的属性。通过输入包含 AutoCAD 编译的 SHX 字体的字体文件,可以将该字体指定给文本样式。FontFileTextStyle 设置文本字体本示例获取活动文本样式的当前字体值,然后将字体的字体更改为“PlayBill”。然后使用该方法设置新字体。若要查看更改字体的效果,请在运行示例之前将一些 或 添加到当前图形中。请注意,如果您的系统上没有 PlayBill 字体,则需要替换您拥有的字体才能使此示例正常工作。SetFontMTextText Sub Ch4_UpdateTextFont() MsgBox ("Look at the text now...") Dim typeFace As String Dim SavetypeFace As String Dim Bold As Boolean Dim Italic As Boolean Dim charSet As Long Dim PitchandFamily As Long ' Get the current settings to fill in the ' default values for the SetFont method ThisDrawing.ActiveTextStyle.GetFont typeFace, Bold, Italic, charSet, PitchandFamily ' Change the typeface for the font SavetypeFace = typeFace typeFace = "PlayBill" ThisDrawing.ActiveTextStyle.SetFont typeFace, Bold, Italic, charSet, PitchandFamily ThisDrawing.Regen acActiveViewport MsgBox ("Now see how it looks after changing the font...") 'Restore the original typeface ThisDrawing.ActiveTextStyle.SetFont SavetypeFace, Bold, Italic, charSet, PitchandFamily ThisDrawing.Regen acActiveViewport End Sub 相关概念 |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-16 00:01
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.