- UID
- 70297
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-8-6
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我用vba例子里的程序改了个给文本求和的程序(见附件)
可是总也实现不了
只能在状态拦显示每次选择的文本值 没有求和
以下是我的类模块
大家帮忙给看看
'Following is the code from the clsAddText class.
Implements IPrimitiveCommandEvents
Dim m_otextElement As TextElement
Dim total As Double
Private Sub IPrimitiveCommandEvents_Cleanup()
End Sub
Private Function Locatetext(Point As Point3d, View As View) As TextElement
On Error GoTo NoElement
' LocateElement will locate any type of element, but if it returns
' an element that is not an text then VBA will generate an error
' when it tries to store the object reference in Locatetext.
Set Locatetext = CommandState.LocateElement(Point, View, True)
NoElement:
End Function
Private Sub IPrimitiveCommandEvents_DataPoint(Point As Point3d, ByVal View As View)
If m_otextElement Is Nothing Then
' This is the first data point. Use it to locate an text
Set m_otextElement = Locatetext(Point, View)
If m_otextElement Is Nothing Then
ShowError "No text Found"
Exit Sub
End If
total = Val(m_otextElement.Text) + Val(total)
ShowStatus "Total=" & total
CommandState.StartPrimitive New clsAddText
End If
End Sub
Private Sub IPrimitiveCommandEvents_Dynamics(Point As Point3d, ByVal View As View, ByVal DrawMode As MsdDrawingMode)
If m_otextElement Is Nothing Then
Exit Sub
End If
End Sub
Private Sub IPrimitiveCommandEvents_Keyin(ByVal Keyin As String)
End Sub
Private Sub IPrimitiveCommandEvents_Reset()
If Not m_otextElement Is Nothing Then
m_otextElement.Redraw msdDrawingModeTemporaryErase
End If
' Start from the beginning, using a new object to
' be certain that it is completely reinitialized.
CommandState.StartPrimitive New clsAddText
End Sub
Private Sub IPrimitiveCommandEvents_Start()
ShowCommand "Vba Modify text"
ShowPrompt "Select text"
CommandState.SetLocateCursor
End Sub
这几个事件的发生顺序如何的 |
|