[求助]如何用VBA实现象MLINE这样的功能?
[求助]如何用VBA实现象MLINE这样的功能?如下:命令: _mline<BR>当前设置: 对正 = 上,比例 = 1.00,样式 = STANDARD<BR>指定起点或 [对正(J)/比例(S)/样式(ST)]:<BR>指定下一点:<BR>指定下一点或 [放弃(U)]:<BR>指定下一点或 [闭合(C)/放弃(U)]:
也就是说:如果我在屏幕上输入点子(坐标),则它识别为起始点或下一个点。当输入对应字符时,则识别为相应功能。谢谢各位大虾指点 2002版本Sub Example_InitializeUserInput()
On Error Resume Next
Dim inputString As String
Dim keywordList As String
keywordList = "j s st"
ThisDrawing.Utility.InitializeUserInput 128, keywordList
Dim returnPnt As Variant
returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point 对正(J)/比例(S)/样式(ST): ")
If Err Then
inputString = ThisDrawing.Utility.GetInput
If InStr(keywordList, inputString) > 0 Then
MsgBox "You entered the keyword: " & inputString
Err.Clear
Else
MsgBox "Error selecting the point: " & Err.Description
Err.Clear
End If
Else
MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetInput 示例"
End If
End Sub2005版本:Sub Example_InitializeUserInput()
' This example prompts for user input of a point. By using the
' InitializeUserInput method to define a keyword list, it can also
' return keywords entered by the user.
On Error Resume Next
' Define the valid keywords
Dim keywordList As String
keywordList = "j s st"
' Call InitializeUserInput to setup the keywords
ThisDrawing.Utility.InitializeUserInput 128, keywordList
' Get the user input
Dim returnPnt As Variant
returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point 对正(J)/比例(S)/样式(ST): ")
If Err Then
If Err.Number = -2145320928 Then
' One of the keywords was entered
Dim inputString As String
Err.Clear
inputString = ThisDrawing.Utility.GetInput
MsgBox "You entered the keyword: " & inputString
Else
MsgBox "Error selecting the point: " & Err.Description
Err.Clear
End If
Else
' Display point coordinates
MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetInput 示例"
End If
End Sub 明白! 谢谢!效果很好!真该好好研究一下了!
页:
[1]