给你个回车继续填写,取消则退出的程序:
- '判断某一键盘键自上次调用该函数以来是否被按过的API函数
- Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
- Private Const VK_ESCAPE = &H1B
- Sub DimNum()
- On Error Resume Next
- Dim ESC As Long
- GetAsyncKeyState VK_ESCAPE
- Dim kk As String
- Dim a As AcadText
- Dim P1 As Variant
- Dim I As Integer
- P1 = ThisDrawing.Utility.GetPoint(, vbCrLf & " 请选择标注点:")
- Dim Dist As Double
- Dist = ThisDrawing.Utility.GetDistance(P1, vbCrLf & " 请输入距离:")
- I = ThisDrawing.Utility.GetInteger(vbCrLf & " 请输入起始的楼层号:")
- Do
- kk = ThisDrawing.Utility.GetKeyword(vbCrLf & " 按回车标注第" & I & "层,按取消键退出标注")
- ESC = GetAsyncKeyState(VK_ESCAPE)
- If ESC <> 0 Then
- Exit Do
- Else
- Set a = ThisDrawing.ModelSpace.AddText("F" & I & "层", P1, 3.5)
- ThisDrawing.Application.Update
- I = I + 1
- P1(1) = P1(1) + Dist
- End If
- Loop
- End Sub
|