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