Draw rectangle for zoom

Topics: Windows Forms
May 6, 2013 at 8:05 AM
Hi,

I want to draw a rectangle for zoom specific area of visible map. Just like below link.


http://googlemapsapi.blogspot.in/2007/06/dragzoomcontrol-v10-easier-zooming_06.html

Please Help.
May 6, 2013 at 8:22 AM
hold SHIFT and mark the area
May 6, 2013 at 8:27 AM
Not working.

Here is my code :
    Bitmap RED_IMG;
    Bitmap YELLOW_IMG;
    Bitmap BLUE_IMG;
    Bitmap DGREEN_IMG;
    Bitmap LGREEN_IMG;
    Bitmap BLACK_IMG;
    Bitmap IMG_TO_DISPLAY;

    GMapControl gmapcontrol = null;
    GMapOverlay sitesOverlay = null;
    GMapOverlay badPatchOverlay = null;
    GMapOverlay cellsRXLevOverlay = null;
    GMapOverlay cellsIBCOverlay = null;

    DataSet DS_ALL = new DataSet();

    int MAX_ZOOM = 20;
    int MIN_ZOOM = 10;
    int BAD_COUNT = 5;

private void InitializeGMap()
    {
        gmapcontrol = new GMapControl();
        gmapcontrol.DragButton = MouseButtons.Left;
        pnlMap.Controls.Add(gmapcontrol);
        gmapcontrol.MapProvider = GoogleMapProvider.Instance;

        gmapcontrol.Cursor = Cursors.Hand;
        gmapcontrol.MinZoom = MIN_ZOOM;
        gmapcontrol.MaxZoom = MAX_ZOOM;
        gmapcontrol.Zoom = 15;
        gmapcontrol.Width = pnlMap.Width;
        gmapcontrol.Height = pnlMap.Height;
        gmapcontrol.CanDragMap = true;
        gmapcontrol.Manager.Mode = AccessMode.ServerOnly;


    }
private void btnZoomIn_Click(object sender, EventArgs e)
    {
        try
        {
            if (gmapcontrol.Zoom >= MAX_ZOOM)
                return;
            gmapcontrol.Zoom += 1;
        }
        catch
        {
        }
    }

    private void btnZoomOut_Click(object sender, EventArgs e)
    {
        try
        {
            if (gmapcontrol.Zoom <= MIN_ZOOM)
                return;
            gmapcontrol.Zoom -= 1;
        }
        catch
        {
        }
    }

May 6, 2013 at 8:31 AM
use right mouse button
May 6, 2013 at 8:37 AM
@radioman: using Shift + Right Mouse Click achieve that functionality, but I want to implement that on Button Click just like above example show that.

Please help.
May 6, 2013 at 8:39 AM
so whats the problem?
May 6, 2013 at 8:53 AM
I am new to C# and this component.
I want to implement that functionality Just like that First User click on a button and then select desire area of visible map.
May 6, 2013 at 11:06 AM
use custom rendering: override void OnPaintOverlays