VB二次开发cad,捕捉坐标点的疑问! 5
在连接CAD后进行添加单行文字工作,想要实现在指定位置输入文字的工作,但是文字每次都出现在坐标原点位置,请大神指点一二,最好附上详细代码或者解决方案(PS:文字居中对齐的...
在连接CAD后进行添加单行文字工作,想要实现在指定位置输入文字的工作,但是文字每次都出现在坐标原点位置,请大神指点一二,最好附上详细代码或者解决方案(PS:文字居中对齐的问题也一直悬而未决,参考书上只有代码内容,具体添加位置不明,请大神指教!textobj.Alignment = acAlignmentMiddleCenter ’文字居中对齐代码)
Public Sub ActiveDocument_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
End Sub
Private Sub Command1_Click()
Dim styobj1 As AcadTextStyle
Dim typeFace As String
Dim Bold As Boolean
Dim Italic As Boolean
Dim charSet As Long
Dim PitchandFamily As Long
Set styobj1 = acadapp.ActiveDocument.TextStyles.Add("黑体")
typeFace = "黑体"
Italic = False
Bold = True
charSet = 1
PitchandFamily = 1 Or 16
styobj1.SetFont typeFace, Bold, Italic, charSet, PitchandFamily
styobj1.width = 0.75
Dim textobj As AcadText
Dim textstring As String
Dim insertionpoint(0 To 2) As Double
Dim height As Double
Dim width As Double
textstring = "CAD二次开发"
height = 3
insertionpoint(0) = X: insertionpoint(1) = Y: insertionpoint(2) = 0
acadapp.ActiveDocument.ActiveTextStyle = styobj1
Set textobj = acadapp.ActiveDocument.ModelSpace.AddText(textstring, insertionpoint, height)
textobj.Update
End Sub 展开
Public Sub ActiveDocument_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
End Sub
Private Sub Command1_Click()
Dim styobj1 As AcadTextStyle
Dim typeFace As String
Dim Bold As Boolean
Dim Italic As Boolean
Dim charSet As Long
Dim PitchandFamily As Long
Set styobj1 = acadapp.ActiveDocument.TextStyles.Add("黑体")
typeFace = "黑体"
Italic = False
Bold = True
charSet = 1
PitchandFamily = 1 Or 16
styobj1.SetFont typeFace, Bold, Italic, charSet, PitchandFamily
styobj1.width = 0.75
Dim textobj As AcadText
Dim textstring As String
Dim insertionpoint(0 To 2) As Double
Dim height As Double
Dim width As Double
textstring = "CAD二次开发"
height = 3
insertionpoint(0) = X: insertionpoint(1) = Y: insertionpoint(2) = 0
acadapp.ActiveDocument.ActiveTextStyle = styobj1
Set textobj = acadapp.ActiveDocument.ModelSpace.AddText(textstring, insertionpoint, height)
textobj.Update
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询