加中文字
帮我把"明经通道"四个字加到thisdrawing上写一下代码,谢谢 <PRE class=Code>Sub Example_AddText()
' This example creates a text object in model space.
Dim textObj As AcadText
Dim textString As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
' Define the text object
textString = "明经通道"
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
height = 0.5
' Create the text object in model space
Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
ZoomAll
End Sub</PRE> 这个代码我知道的啊,但是不能显示中文字啊
有人说"autocad默认的文字样式是standard,字体名是txt.shx,不支持中文,你新建一个文字样式,指定中文字体不就行了.在程序中实现方式同理!~新建的文字样式是保存在DWG中的....."
可能这个东西太简单了,都没人想发表
我真的很急,请告诉我这么在画显示中文字体啊
也有人告诉我这么做,
<IMG alt=发贴心情 src="skins/default/topicface/face1.gif" border=0> <B></B><BR>Sub Set_Font()
Dim j As Integer, TScount As Integer<BR>Dim TextColl As AcadTextStyles<BR>On Error Resume Next<BR>Set TextColl = ThisDrawing.TextStyles<BR>TScount = TextColl.Count<BR>For j = 0 To TScount - 1<BR> TextColl.Item(j).SetFont "宋体", False, False, False, False<BR>Next j<BR>ThisDrawing.Regen acActiveViewport<BR>End Sub
我也试过了,还是不行,请大家告诉我,怎么样写几个中文字,
我也很郁闷啊,这么简单怎么就是不行 Sub Example_AddText()<BR> ' This example creates a text object in model space.
Dim textObj As AcadText<BR> Dim textString As String<BR> Dim insertionPoint(0 To 2) As Double<BR> Dim height As Double<BR> <BR> ' Define the text object<BR> textString = "明经通道"<BR> insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0<BR> height = 200<BR> <BR> ' Create the text object in model space<BR> '宋体在我的Acad2004上也是显示不正常.其它字体无问题!~<BR> ThisDrawing.TextStyles(0).SetFont "新宋体", False, False, 1, 1<BR> 'ThisDrawing.TextStyles(0).BigFontFile = "hztxt.shx" '如果有支持中文的形字体在此指定<BR> Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)<BR> ZoomAll<BR> <BR>End Sub
页:
[1]