public void OnMouseUp(int Button, int Shift, int X, int Y) { if (m_InUse == false) { return; } if (GetCapture() == this.hk.MapControl.ActiveView.ScreenDisplay.hWnd) { ReleaseCapture(); } if (m_Feedback == null) { m_Feedback = null; m_InUse = false; return; } IEnvelope envelope = m_Feedback.Stop(); if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0)) { m_Feedback = null; m_InUse = false; return; } GetSymbol symbolForm = new GetSymbol(esriSymbologyStyleClass.esriStyleClassNorthArrows); symbolForm.Text = "选择指北针"; IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows); symbolForm.Dispose(); if (styleGalleryItem == null) { return; } IMapFrame mapFrame = (IMapFrame)this.hk.MapControl.ActiveView.GraphicsContainer.FindFrame(this.hk.MapControl.ActiveView.FocusMap); IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass(); mapSurroundFrame.MapFrame = mapFrame; mapSurroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item; IElement element = (IElement)mapSurroundFrame; element.Geometry = envelope; this.hk.MapControl.ActiveView.GraphicsContainer.AddElement((IElement)mapSurroundFrame, 0); this.hk.MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null); m_Feedback = null; m_InUse = false; }
public void OnMouseUp(int Button, int Shift, int X, int Y) { if (m_InUse == false) return; if (GetCapture() == this.hk.MapControl.ActiveView.ScreenDisplay.hWnd) ReleaseCapture(); if (m_Feedback == null) { m_Feedback = null; m_InUse = false; return; } IEnvelope envelope = m_Feedback.Stop(); if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0)) { m_Feedback = null; m_InUse = false; return; } GetSymbol symbolForm = new GetSymbol(esriSymbologyStyleClass.esriStyleClassNorthArrows); symbolForm.Text = "ѡ��ָ����"; IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows); symbolForm.Dispose(); if (styleGalleryItem == null) return; IMapFrame mapFrame = (IMapFrame)this.hk.MapControl.ActiveView.GraphicsContainer.FindFrame(this.hk.MapControl.ActiveView.FocusMap); IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass(); mapSurroundFrame.MapFrame = mapFrame; mapSurroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item; IElement element = (IElement)mapSurroundFrame; element.Geometry = envelope; this.hk.MapControl.ActiveView.GraphicsContainer.AddElement((IElement)mapSurroundFrame, 0); this.hk.MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null); m_Feedback = null; m_InUse = false; }