ArcObject operations: "zoom in the drop box", "zoom in the drop box", "undo", and "Forward"

Source: Internet
Author: User

Private Sub axmapcontrolpoliconmousedown (ByVal sender As System. Object, ByVal e As ESRI. ArcGIS. Controls. IMapControlEvents2_OnMouseDownEvent) Handles AxMapControl1.OnMouseDown

'Zoom in
If Me. TrackRectangle_big_small = True Then
Dim pEnv As IEnvelope
Dim pActiveView As IActiveView
PEnv = Me. AxMapControl1.TrackRectangle
PActiveView = Me. AxMapControl1.ActiveView

If pEnv. IsEmpty Then
PEnv = Me. AxMapControl1.Extent
PEnv. Expand (0.8, 0.8, True)
PEnv. CenterAt (pActiveView. ScreenDisplay. DisplayTransformation. ToMapPoint (e. x, e. y ))
ElseIf pEnv. Height = 0 Or pEnv. Width = 0 Then
PEnv = Me. AxMapControl1.Extent
PEnv. Expand (0.8, 0.8, True)
PEnv. CenterAt (pActiveView. ScreenDisplay. DisplayTransformation. ToMapPoint (e. x, e. y ))
End If

PActiveView. Extent = pEnv
PActiveView. Refresh ()

 

'Drop-down box
ElseIf Me. TrackRectangle_big_small = False Then
Dim pEnv As IEnvelope
Dim pActiveView As IActiveView
Dim pRubberBand As IRubberBand
Dim dWidth As Double, dHeight As Double
Dim dXmin As Double, dYmin As Double, dXmax As Double, dYmax As Double

PRubberBand = New RubberEnvelope
PActiveView = Me. AxMapControl1.ActiveView
PEnv = pRubberBand. TrackNew (pActiveView. ScreenDisplay, Nothing)

If pEnv. IsEmpty Then
PEnv = Me. AxMapControl1.Extent
PEnv. Expand (1.2, 1.2, True)
PEnv. CenterAt (pActiveView. ScreenDisplay. DisplayTransformation. ToMapPoint (e. x, e. y ))
ElseIf pEnv. Width = 0 Or pEnv. Height = 0 Then
PEnv = Me. AxMapControl1.Extent
PEnv. Expand (1.2, 1.2, True)
PEnv. CenterAt (pActiveView. ScreenDisplay. DisplayTransformation. ToMapPoint (e. x, e. y ))
Else
DWidth = pActiveView. Extent. Width * pActiveView. Extent. Width/pEnv. Width
DHeight = pActiveView. Extent. Height * pActiveView. Extent. Height/pEnv. Height
DXmin = pActiveView. Extent. XMin-(pEnv. XMin-pActiveView. Extent. XMin) * pActiveView. Extent. Width/pEnv. Width)
DYmin = pActiveView. Extent. YMin-(pEnv. YMin-pActiveView. Extent. YMin) * pActiveView. Extent. Height/pEnv. Height)
DXmax = dXmin + dWidth
DYmax = dYmin + dHeight
PEnv. PutCoords (dXmin, dYmin, dXmax, dYmax)
End If
PActiveView. Extent = pEnv
PActiveView. Refresh ()
End If

Exit sub

 

Private Sub Undo operation ToolStripMenuItem_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles Undo operation ToolStripMenuItem. Click

If Me. AxMapControl1.ActiveView. ExtentStack. CanUndo Then
Me. AxMapControl1.ActiveView. ExtentStack. Undo ()
End If

End Sub

 

Private Sub forward operation ToolStripMenuItem_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles forward operation ToolStripMenuItem. Click

If Me. AxMapControl1.ActiveView. ExtentStack. CanRedo Then
Me. AxMapControl1.ActiveView. ExtentStack. Redo ()
End If

End Sub

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.