The program stores an enlarged version of the map in the hidden PictureBox picHidden. When the mouse moves, the program copies part of that image over the smaller image that is visible, giving a closeup of the area under the mouse.
The program defines some constants that control how big an area is enlarged and the scale factor.
When the mouse moves, the program clears the visible PictureBox. That PictureBox's AutoRedraw property is set to True at design time so this restores its original picture.
The program then copies a piece of the big map onto the small visible one. It finsihes by drawing a rectangle to outline the closeup.
Private Const SCALE_FACTOR As Integer = 2
Private Const SMALL_RADIUS As Integer = 25
Private Const BIG_RADIUS As Integer = SMALL_RADIUS * _
Private Const BIG_DIAMETER As Integer = 2 * BIG_RADIUS
Private Sub Form_Load()
picMap.ScaleMode = vbPixels
Private Sub picMap_MouseMove(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
' Restore the original small map.
' Draw a chunk of the big picture on top.
picMap.PaintPicture picHidden.Picture, _
X - BIG_RADIUS, Y - BIG_RADIUS, BIG_DIAMETER, _
X * 2 - BIG_RADIUS, Y * 2 - BIG_RADIUS, _
' Outline the closeup.
picMap.Line (X - BIG_RADIUS, Y - _
BIG_RADIUS)-Step(BIG_DIAMETER, BIG_DIAMETER), _