阅读:1927回复:5
关于activex dll编写(独立程序,脱离ArcMap.exe)我改写了一个例程(activex dll),用TToolBarControl调用,但调试是报“实时错误”,代码如下: Option Explicit 'Windows API functions to capture mouse and keyboard Implements ICommand Private m_pHookHelper As IHookHelper Private Sub Class_Initialize() Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE Private Property Get ICommand_Caption() As String Private Property Get ICommand_Category() As String Private Property Get ICommand_Checked() As Boolean End Property Private Property Get ICommand_Enabled() As Boolean Private Property Get ICommand_HelpContextID() As Long End Property Private Property Get ICommand_HelpFile() As String End Property Private Property Get ICommand_Message() As String Private Property Get ICommand_Name() As String Private Sub ICommand_OnClick() End Sub Private Sub ICommand_OnCreate(ByVal hook As Object) Private Property Get ICommand_Tooltip() As String Private Property Get ITool_Cursor() As esriSystem.OLE_HANDLE Private Function ITool_Deactivate() As Boolean ITool_Deactivate = True Private Function ITool_OnContextMenu(ByVal X As Long, ByVal Y As Long) As Boolean End Function Private Sub ITool_OnDblClick() End Sub Private Sub ITool_OnKeyDown(ByVal keyCode As Long, ByVal Shift As Long) End Sub Private Sub ITool_OnKeyUp(ByVal keyCode As Long, ByVal Shift As Long) End Sub Private Sub ITool_OnMouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long) m_bInUse = True Private Sub ITool_OnMouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long) 'Get line between from and to points, and angle for text
End Sub Private Sub ITool_OnMouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long) Private Sub ITool_Refresh(ByVal hDC As esriSystem.OLE_HANDLE) End Sub Private Function GetSmashedLine(pDisplay As IScreenDisplay, pTextSymbol As ISymbol, pPoint As IPoint, pPolyLine As IPolyline) As IPolyline '下面这个函数报错
请帮忙分析一下,谢谢 |
|
1楼#
发布于:2005-11-25 14:24
这个好像是量算距离的。记得好像看过这么个例子。现贴上我所使用的代码: Option Explicit Implements ICommand Private m_pApp As New hook Private Function GetMap() As esriCarto.IMap On Error GoTo ErrorHandler Set GetMap = m_pApp.FocusMap Exit Function End Function
Set m_pCursor = LoadResPicture("MEASURE", vbResCursor) End Sub
' ICommand_Bitmap = frmResources.imlBitmaps.ListImages(1).Picture End Property
ICommand_Caption = "测量工具" End Property
ICommand_Category = "Developer Samples" End Property
End Property
ICommand_Enabled = True End Property
End Property
End Property
ICommand_Message = "测量距离工具" End Property
ICommand_Name = "Developer Samples_Measure Tool" End Property
End Sub
m_pApp.hook = hook End Sub
ICommand_Tooltip = "测量工具" End Property
ITool_Cursor = m_pCursor 'frmResources.imlBitmaps.ListImages(2).Picture End Property
' stop doing operation ITool_Deactivate = True End Function
End Function
End Sub
End Sub
End Sub
m_bInUse = True End Sub
If (Not m_bInUse) Then Exit Sub ' Dim pMXDoc As IMxDocument Dim bfirstTime As Boolean If (m_pLineSymbol Is Nothing) Then bfirstTime = True 'Get current point pActiveView.ScreenDisplay.StartDrawing pActiveView.ScreenDisplay.hDC, -1 If bfirstTime Then Dim pRGBColor As IRgbColor 'Line Symbol With pRGBColor m_pLineSymbol.Color = pRGBColor ' Dim myColor As IRgbColor 'Text Symbol 'Create point to draw text in Else 'Use existing symbols and draw existing text and polyline If (m_pLinePolyline.length > 0) Then _ End If ' 'Get line between from and to points, and angle for text If ((angle > 90#) And (angle < 180#)) Then angle = angle + 180# angle = angle - 180# angle = angle - 180# angle = angle - 180#
Dim pLenth As Double deltaX = pPoint.x - m_pStartPoint.x
'Get polyline with blank space for text 'Draw polyline If (m_pLinePolyline.length > 0) Then _ pActiveView.ScreenDisplay.FinishDrawing
If (Not m_bInUse) Then Exit Sub m_bInUse = False If (m_pLinePolyline.length > 0) Then pActiveView.ScreenDisplay.DrawPolyline m_pLinePolyline pActiveView.ScreenDisplay.FinishDrawing End Sub
'Returns a Polyline with a blank space for the text to go in End Function
|
|
2楼#
发布于:2005-11-23 18:03
我还以为你真的脱离arcmap些的 不过是用在arcmap中的dll而已 |
|
3楼#
发布于:2005-11-23 10:30
有没有人帮忙呀?
|
|
4楼#
发布于:2005-11-23 10:27
斑竹在不在? |
|
5楼#
发布于:2005-11-22 15:15
怎么人这么少? |
|