只需一步,快速开始
最近变了一个程序,如下:
Private Sub CommandButton2_Click()Dim pt As VariantDim textobject As AcadTextDim pt1 As VariantDim pt2 As VariantDim pt3 As VariantDim pt4 As VariantDim pt5 As VariantDim pt6 As VariantDim pt7 As VariantfrmMain.Hidept = ThisDrawing.Utility.GetPoint(, "请输入插入点!")pt1(0) = pt(0) + 488: pt1(1) = pt(0) - 884pt2(0) = pt(0) + 5002: pt2(1) = pt(0) - 890pt3(0) = pt(0) + 9148: pt3(1) = pt(0) - 752pt4(0) = pt(0) + 9189: pt4(1) = pt(0) - 1250pt5(0) = pt(0) + 23067: pt5(1) = pt(0) - 884pt6(0) = pt(0) + 24475: pt6(1) = pt(0) - 984pt7(0) = pt(0) + 9138: pt7(1) = pt(0) - 965Set textobject = ThisDrawing.ModelSpace.AddText("sfsf", pt1, 500)End Sub
程序运行到pt1(0) = pt(0) + 488: pt1(1) = pt(0) - 884调试错误,提示类型不匹配!请问是什么原因?另,在输入汉字时怎么规定字体?谢谢!
使用道具 举报
Dim pt As VariantDim textobject As AcadTextDim pt1(2) As Double
pt = ThisDrawing.Utility.GetPoint(, "请输入插入点!")pt1(0) = pt(0) + 488: pt1(1) = pt(0) - 884: pt1(2) = 0
Set textobject = ThisDrawing.ModelSpace.AddText("sfsf", pt1, 500)
你搜索一下吧,很多的
找到了一个,如下:
set ts = ThisDrawing.ActiveTextStyletsna = ts.fontFile Set ts1 = ThisDrawing.ActiveTextStyle ts1.fontFile = "HZTXT"ThisDrawing.ActiveTextStyle = ts1Set textobject = ThisDrawing.ModelSpace.AddText("汉字",pt5, 500)ThisDrawing.Regen acActiveViewportts.fontFile = tsnaThisDrawing.ActiveTextStyle = ts
确实程序执行时,我采用MSGBOX看字体,气体确实由原来的ROMANS 便成了HZTXT,然后写入"汉字"两个字,之后又变成了原来的ROMANS。但是当我在查看CAD中"汉字"两个字的字体时,却是ROMANS。不知道为什么,请指教!
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 ) ©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途
GMT+8, 2024-11-27 00:45 , Processed in 0.163203 second(s), 23 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.