mfchuke
路人甲
路人甲
  • 注册日期2005-11-16
  • 发帖数21
  • QQ
  • 铜币214枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2471回复:7

TToolBarControl导入activex dll无效

楼主#
更多 发布于:2005-11-16 16:03
arcGis开发包中带了例程,我将其中ZoomIn例程编译成ZoomInTool.dll。<BR>然后新建工程,加入TToolBarControl,在TToolBarControl中导入ZoomInTool.dll,在TPageLayOutControl上使用时,只有光标变成<BR>放大镜,但是却没有放大效果,这是为什么(TToolBarControl自己带的ZoomIn功能可以正常使用)?还有一点,将ZoomInTool.dll导入ArcMap.exe中却可以正常使用。
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2005-11-16 17:02
<P>编写arcmap和mapcontrol中使用的dll的方法是不同的,你可以拿两个能使用的例子对比下</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
mfchuke
路人甲
路人甲
  • 注册日期2005-11-16
  • 发帖数21
  • QQ
  • 铜币214枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-11-16 20:02
<P>gis:能不能给个实例,谢谢</P>
举报 回复(0) 喜欢(0)     评分
mfchuke
路人甲
路人甲
  • 注册日期2005-11-16
  • 发帖数21
  • QQ
  • 铜币214枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-11-16 23:17
有没有人帮帮我?
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
4楼#
发布于:2005-11-17 11:25
<P>下面这个可以用在toolbarcontrol上,只是一个类,其他的自己想象了</P>
<P>Option Explicit</P>
<P><BR>Private m_pHookHelper As IHookHelper</P>
<P>Private m_frmLayer As frmLayer<BR>Private m_pBitmap As IPictureDisp<BR>Private WithEvents m_pActiveViewEvents As Map</P>
<P>Implements ICommand<BR>' Constant used by the Error handler function - DO NOT REMOVE<BR>Const c_ModuleFileName = "clsLayers.cls"</P>


<P>Private Function GetMap() As esriCarto.IMap<BR>  On Error GoTo ErrorHandler</P>
<P>  Set GetMap = m_pHookHelper.FocusMap</P>
<P>  Exit Function<BR>ErrorHandler:<BR>  HandleError False, "GetMap " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Function</P>
<P>Private Sub Class_Initialize()<BR>  On Error GoTo ErrorHandler</P>
<P>  Set m_frmLayer = New frmLayer<BR>  <BR>  Set m_pHookHelper = New HookHelper<BR>  Set m_pBitmap = LoadResPicture("Layers", vbResBitmap)</P>
<P><BR>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "Class_Initialize " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Sub</P>
<P>Private Sub Class_Terminate()<BR>  On Error GoTo ErrorHandler</P>
<P>  Set m_frmLayer.Map = Nothing<BR>  Unload m_frmLayer<BR>  Set m_frmLayer = Nothing<BR>  <BR>  Set m_pBitmap = Nothing<BR>  Set m_pHookHelper = Nothing<BR>  </P>
<P><BR>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "Class_Terminate " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Sub</P>
<P>Private Property Get ICommand_Enabled() As Boolean<BR>  On Error GoTo ErrorHandler</P>
<P>  If (GetMap Is Nothing) Then Exit Property<BR>  ICommand_Enabled = (GetMap.LayerCount > 0)</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_Enabled " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_Checked() As Boolean<BR>  On Error GoTo ErrorHandler</P>
<P>  ICommand_Checked = False</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_Checked " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_Name() As String<BR>  On Error GoTo ErrorHandler</P>
<P>  ICommand_Name = "Sample_Layer_Layers"</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_Name " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property</P>
<P>Private Property Get ICommand_Caption() As String<BR>  On Error GoTo ErrorHandler</P>
<P>  ICommand_Caption = "Layers"</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_Caption " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_Tooltip() As String<BR>  On Error GoTo ErrorHandler</P>
<P>  ICommand_Tooltip = "图层显示设置"</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_Tooltip " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_Message() As String<BR>  On Error GoTo ErrorHandler</P>
<P>  ICommand_Message = "图层显示设置"</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_Message " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_HelpFile() As String<BR>  On Error GoTo ErrorHandler</P>
<P>  ' TOD Add your implementation here</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_HelpFile " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_HelpContextID() As Long<BR>  On Error GoTo ErrorHandler</P>
<P>  ' TOD Add your implementation here</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_HelpContextID " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE<BR>  On Error GoTo ErrorHandler</P>
<P>  ICommand_Bitmap = m_pBitmap</P>
<P><BR>  Exit Property<BR>ErrorHandler:<BR>  HandleError True, "ICommand_Bitmap " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Property<BR> <BR>Private Property Get ICommand_Category() As String<BR>  ICommand_Category = "fhl_Layer"<BR>End Property<BR> <BR>Private Sub ICommand_OnCreate(ByVal hook As Object)<BR>  On Error GoTo ErrorHandler</P>
<P>  Set m_pHookHelper.hook = hook<BR>  <BR>  SetupList</P>
<P>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "ICommand_OnCreate " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Sub<BR> <BR>Private Sub ICommand_OnClick()<BR>  On Error GoTo ErrorHandler</P>
<P>  m_frmLayer.PopulateList m_pHookHelper.FocusMap<BR>  m_frmLayer.Show vbModal</P>
<P>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "ICommand_OnClick " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Sub</P>
<P>Private Sub m_pActiveViewEvents_FocusMapChanged()<BR>  SetupList<BR>End Sub</P>
<P>Private Sub m_pActiveViewEvents_ItemAdded(ByVal Item As Variant)<BR>  On Error GoTo ErrorHandler<BR>  <BR>  m_frmLayer.PopulateList m_pHookHelper.FocusMap<BR>  <BR>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "m_pActiveViewEvents_ItemAdded " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>End Sub</P>
<P>Private Sub m_pActiveViewEvents_ItemDeleted(ByVal Item As Variant)<BR>  On Error GoTo ErrorHandler<BR>  m_frmLayer.PopulateList m_pHookHelper.FocusMap<BR>  <BR>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "m_pActiveViewEvents_ItemDeleted " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>  <BR>End Sub</P>
<P>Private Sub m_pActiveViewEvents_ItemReordered(ByVal Item As Variant, ByVal toIndex As Long)<BR>  On Error GoTo ErrorHandler<BR>  m_frmLayer.PopulateList m_pHookHelper.FocusMap<BR>  <BR>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "m_pActiveViewEvents_ItemReordered " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>  <BR>End Sub</P>
<P>Private Sub SetupList()<BR>  On Error GoTo ErrorHandler<BR>  <BR>  Set m_pActiveViewEvents = m_pHookHelper.FocusMap<BR>  m_frmLayer.PopulateList m_pHookHelper.FocusMap<BR>  <BR>  Exit Sub<BR>ErrorHandler:<BR>  HandleError True, "SetupList " ; c_ModuleFileName ; " " ; GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1<BR>  <BR>End Sub<BR></P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
mfchuke
路人甲
路人甲
  • 注册日期2005-11-16
  • 发帖数21
  • QQ
  • 铜币214枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-11-17 13:50
<P>谢谢猪头总统,我根据你的提示在例程中找到了相关代码,现在问题解决了。</P>
<P>另外我用的是delphi,代码转换时有点麻烦。主程序用delphi+AO,activex dll还是用vb。</P>
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
6楼#
发布于:2005-11-17 14:25
<DIV class=quote><B>以下是引用<I>mfchuke</I>在2005-11-17 13:50:14的发言:</B><BR>
<P>谢谢猪头总统,我根据你的提示在例程中找到了相关代码,现在问题解决了。</P>
<P>另外我用的是delphi,代码转换时有点麻烦。主程序用delphi+AO,activex dll还是用vb。</P></DIV>
<P>调用基本上是没什么问题的,只是vb的编译方式你得好好看看哦:)</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
mfchuke
路人甲
路人甲
  • 注册日期2005-11-16
  • 发帖数21
  • QQ
  • 铜币214枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2005-11-22 10:54
<P>求教猪头总统:我改写了一个例程(activex dll),想用于TToolBarControl,但调试是报“实时错误”,代码如下:</P>
<P>Option Explicit</P>
<P>'Windows API functions to capture mouse and keyboard<BR>'input to a window when the mouse is outside the window<BR>Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long<BR>Private Declare Function GetCapture Lib "user32" () As Long<BR>Private Declare Function ReleaseCapture Lib "user32" () As Long</P>
<P>Implements ICommand<BR>Implements ITool</P>
<P>Private m_pHookHelper As IHookHelper<BR>'Private m_pApp As IApplication<BR>Private m_bInUse As Boolean<BR>Private m_pLineSymbol As ILineSymbol<BR>Private m_pLinePolyline As IPolyline<BR>Private m_pTextSymbol As ITextSymbol<BR>Private m_pStartPoint As IPoint<BR>Private m_pTextPoint As IPoint</P>
<P>Private Sub Class_Initialize()<BR>   Set m_pHookHelper = New HookHelper<BR>End Sub</P>
<P>Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE<BR>  ICommand_Bitmap = frmResources.imlBitmaps.ListImages(1).Picture<BR>End Property</P>
<P>Private Property Get ICommand_Caption() As String<BR>  ICommand_Caption = "Measure Tool"<BR>End Property</P>
<P>Private Property Get ICommand_Category() As String<BR>  ICommand_Category = "Developer Samples"<BR>End Property</P>
<P>Private Property Get ICommand_Checked() As Boolean</P>
<P>End Property</P>
<P>Private Property Get ICommand_Enabled() As Boolean<BR>  ICommand_Enabled = True<BR>End Property</P>
<P>Private Property Get ICommand_HelpContextID() As Long</P>
<P>End Property</P>
<P>Private Property Get ICommand_HelpFile() As String</P>
<P>End Property</P>
<P>Private Property Get ICommand_Message() As String<BR>  ICommand_Message = "Measure Distance Tool"<BR>End Property</P>
<P>Private Property Get ICommand_Name() As String<BR>  ICommand_Name = "Developer Samples_Measure Tool"<BR>End Property</P>
<P>Private Sub ICommand_OnClick()</P>
<P>End Sub</P>
<P>Private Sub ICommand_OnCreate(ByVal hook As Object)<BR>  'Set m_pApp = hook<BR>  Set m_pHookHelper.hook = hook<BR>  'Set m_pApp = m_pHookHelper.hook<BR>End Sub</P>
<P>Private Property Get ICommand_Tooltip() As String<BR>  ICommand_Tooltip = "Measure Tool"<BR>End Property</P>
<P>Private Property Get ITool_Cursor() As esriSystem.OLE_HANDLE<BR>  ITool_Cursor = frmResources.imlBitmaps.ListImages(2).Picture<BR>End Property</P>
<P>Private Function ITool_Deactivate() As Boolean<BR>  ' stop doing operation<BR>  Set m_pTextSymbol = Nothing<BR>  Set m_pTextPoint = Nothing<BR>  Set m_pLinePolyline = Nothing<BR>  Set m_pLineSymbol = Nothing<BR>  m_bInUse = False</P>
<P>  ITool_Deactivate = True<BR>End Function</P>
<P>Private Function ITool_OnContextMenu(ByVal X As Long, ByVal Y As Long) As Boolean</P>
<P>End Function</P>
<P>Private Sub ITool_OnDblClick()</P>
<P>End Sub</P>
<P>Private Sub ITool_OnKeyDown(ByVal keyCode As Long, ByVal Shift As Long)</P>
<P>End Sub</P>
<P>Private Sub ITool_OnKeyUp(ByVal keyCode As Long, ByVal Shift As Long)</P>
<P>End Sub</P>
<P>Private Sub ITool_OnMouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)<BR>  If (m_pHookHelper.ActiveView Is Nothing) Then Exit Sub</P>
<P>  m_bInUse = True<BR>  'Dim pMxDoc As IMxDocument<BR>  Dim pActiveView As esriCarto.IActiveView<BR>  'Set pMxDoc = m_pApp.Document<BR>  'Set pActiveView = pMxDoc.FocusMap<BR>  Set pActiveView = m_pHookHelper.FocusMap<BR>  <BR>  'Get point to measure distance from<BR>  Set m_pStartPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y)<BR>  <BR>  'Start capturing mouse events<BR>  SetCapture m_pHookHelper.ActiveView.ScreenDisplay.hWnd<BR>End Sub</P>
<P>Private Sub ITool_OnMouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)<BR>  If (Not m_bInUse) Then Exit Sub<BR>  <BR>  'Dim pMxDoc As IMxDocument<BR>  Dim pActiveView As esriCarto.IActiveView<BR>  'Set pMxDoc = m_pApp.Document<BR>  'Set pActiveView = pMxDoc.FocusMap<BR>  Set pActiveView = m_pHookHelper.FocusMap<BR>  <BR>  Dim bfirstTime As Boolean<BR>  If (m_pLineSymbol Is Nothing) Then bfirstTime = True<BR>    <BR>  'Get current point<BR>  Dim pPoint As IPoint<BR>  Set pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y)<BR>  <BR>  pActiveView.ScreenDisplay.StartDrawing pActiveView.ScreenDisplay.hDC, -1<BR>    <BR>  If bfirstTime Then<BR>    Dim pRGBColor As IRgbColor<BR>    Dim pSymbol As ISymbol<BR>    Dim pFont As IFontDisp<BR>    <BR>    'Line Symbol<BR>    Set m_pLineSymbol = New SimpleLineSymbol<BR>    m_pLineSymbol.Width = 2<BR>    Set pRGBColor = New RgbColor<BR>    With pRGBColor<BR>      .Red = 223<BR>      .Green = 223<BR>      .Blue = 223<BR>    End With<BR>    m_pLineSymbol.Color = pRGBColor<BR>    Set pSymbol = m_pLineSymbol<BR>    pSymbol.ROP2 = esriROPXOrPen<BR>    <BR>    'Text Symbol<BR>    Set m_pTextSymbol = New TextSymbol<BR>    m_pTextSymbol.HorizontalAlignment = esriTHACenter<BR>    m_pTextSymbol.VerticalAlignment = esriTVACenter<BR>    m_pTextSymbol.Size = 16<BR>    Set pSymbol = m_pTextSymbol<BR>    Set pFont = m_pTextSymbol.Font<BR>    pFont.Name = "Arial"<BR>    pSymbol.ROP2 = esriROPXOrPen<BR>    <BR>    'Create point to draw text in<BR>    Set m_pTextPoint = New Point<BR>    <BR>  Else<BR>    'Use existing symbols and draw existing text and polyline<BR>    pActiveView.ScreenDisplay.SetSymbol m_pTextSymbol<BR>    pActiveView.ScreenDisplay.DrawText m_pTextPoint, m_pTextSymbol.Text<BR>    pActiveView.ScreenDisplay.SetSymbol m_pLineSymbol<BR>    If (m_pLinePolyline.Length > 0) Then _<BR>      pActiveView.ScreenDisplay.DrawPolyline m_pLinePolyline<BR>  End If</P>
<P>  'Get line between from and to points, and angle for text<BR>  Dim pLine As ILine<BR>  Set pLine = New esriGeometry.Line<BR>  pLine.PutCoords m_pStartPoint, pPoint<BR>  Dim angle As Double<BR>  angle = pLine.angle<BR>  angle = angle * (180# / 3.14159)<BR>  If ((angle > 90#) And (angle < 180#)) Then<BR>    angle = angle + 180#<BR>  ElseIf ((angle < 0#) And (angle < -90#)) Then<BR>    angle = angle - 180#<BR>  ElseIf ((angle < -90#) And (angle > -180)) Then<BR>    angle = angle - 180#<BR>  ElseIf (angle > 180) Then<BR>    angle = angle - 180#<BR>  End If</P>
<P><BR>  'For drawing text, get text(distance), angle, and point<BR>  Dim deltaX As Double<BR>  Dim deltaY As Double<BR>  Dim distance As Double<BR>  deltaX = pPoint.X - m_pStartPoint.X<BR>  deltaY = pPoint.Y - m_pStartPoint.Y<BR>  m_pTextPoint.X = m_pStartPoint.X + deltaX / 2#<BR>  m_pTextPoint.Y = m_pStartPoint.Y + deltaY / 2#<BR>  m_pTextSymbol.angle = angle<BR>  distance = Round(Sqr((deltaX * deltaX) + (deltaY * deltaY)), 3)<BR>  m_pTextSymbol.Text = "[" ; distance ; "]"<BR>  <BR>  'Draw text<BR>  pActiveView.ScreenDisplay.SetSymbol m_pTextSymbol<BR>  pActiveView.ScreenDisplay.DrawText m_pTextPoint, m_pTextSymbol.Text<BR>  <BR>  <BR>  'Get polyline with blank space for text<BR>  Dim pPolyLine As IPolyline<BR>  Set pPolyLine = New Polyline<BR>  Dim pSegColl As ISegmentCollection<BR>  Set pSegColl = pPolyLine<BR>  pSegColl.AddSegment pLine<BR>  Set m_pLinePolyline = GetSmashedLine(pActiveView.ScreenDisplay, m_pTextSymbol, m_pTextPoint, pPolyLine)<BR>  <BR>  'Draw polyline<BR>  pActiveView.ScreenDisplay.SetSymbol m_pLineSymbol<BR>  If (m_pLinePolyline.Length > 0) Then _<BR>    pActiveView.ScreenDisplay.DrawPolyline m_pLinePolyline<BR>  <BR>  pActiveView.ScreenDisplay.FinishDrawing</P>
<P>End Sub</P>
<P>Private Sub ITool_OnMouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)<BR>  If (Not m_bInUse) Then Exit Sub<BR>  m_bInUse = False<BR>  <BR>  If (m_pLineSymbol Is Nothing) Then Exit Sub<BR>  <BR>  'Stop capturing mouse events<BR>  If GetCapture = m_pHookHelper.ActiveView.ScreenDisplay.hWnd Then<BR>    ReleaseCapture<BR>  End If</P>
<P>  <BR>  'Dim pMxDoc As IMxDocument<BR>  Dim pActiveView As esriCarto.IActiveView<BR>  'Set pMxDoc = m_pApp.Document<BR>  'Set pActiveView = pMxDoc.FocusMap<BR>  Set pActiveView = m_pHookHelper.FocusMap<BR>  <BR>  'Draw measure line and text<BR>  pActiveView.ScreenDisplay.StartDrawing pActiveView.ScreenDisplay.hDC, -1<BR>  pActiveView.ScreenDisplay.SetSymbol m_pTextSymbol<BR>  pActiveView.ScreenDisplay.DrawText m_pTextPoint, m_pTextSymbol.Text<BR>  pActiveView.ScreenDisplay.SetSymbol m_pLineSymbol<BR>  If (m_pLinePolyline.Length > 0) Then pActiveView.ScreenDisplay.DrawPolyline m_pLinePolyline<BR>  pActiveView.ScreenDisplay.FinishDrawing<BR>  <BR>  Set m_pTextSymbol = Nothing<BR>  Set m_pTextPoint = Nothing<BR>  Set m_pLinePolyline = Nothing<BR>  Set m_pLineSymbol = Nothing<BR>End Sub</P>
<P>Private Sub ITool_Refresh(ByVal hDC As esriSystem.OLE_HANDLE)</P>
<P>End Sub</P>
<P>Private Function GetSmashedLine(pDisplay As IScreenDisplay, pTextSymbol As ISymbol, pPoint As IPoint, pPolyLine As IPolyline) As IPolyline<BR>  'Returns a Polyline with a blank space for the text to go in<BR>  Dim pSmashed As IPolyline<BR>  Dim pBoundary As IPolygon<BR>  Set pBoundary = New Polygon<BR>  pTextSymbol.QueryBoundary pDisplay.hDC, pDisplay.DisplayTransformation, pPoint, pBoundary<BR>  Dim pTopo As ITopologicalOperator<BR>  Set pTopo = pBoundary<BR>  <BR>  Dim pIntersect As IPolyline</P>
<P>  '下面这个函数报错<BR>  Set pIntersect = pTopo.Intersect(pPolyLine, esriGeometry1Dimension)  </P>
<P><BR>  Set pTopo = pPolyLine<BR>  Set GetSmashedLine = pTopo.Difference(pIntersect)<BR>End Function</P>

<P>请猪头总统帮忙分析一下,谢谢</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部