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 Sub
2005版本:- 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
|