Easy code for map enlargement (pull box and click), reduction (pull box and click), and roaming

Source: Internet
Author: User

/// <Summary>
/// Zoom in
/// </Summary>
/// <Param name = "sender"> </param>
/// <Param name = "E"> </param>
Private void btnitem_zoomin_click (Object sender, eventargs E)
{
Axmapcontrol. mousepointer = esricontrolsmousepointer. esripointerzoomin;
Mapform. mapoperator = mapoperation. zoomin;
}

/// <Summary>
/// Zoom out
/// </Summary>
/// <Param name = "sender"> </param>
/// <Param name = "E"> </param>
Private void btnitem_zoomout_click (Object sender, eventargs E)
{
Axmapcontrol. mousepointer = esricontrolsmousepointer. esripointerzoomout;
Mapform. mapoperator = mapoperation. zoomout;
}

/// <Summary>
/// Pan
/// </Summary>
/// <Param name = "sender"> </param>
/// <Param name = "E"> </param>
Private void btnitem_pan_click (Object sender, eventargs E)
{
Axmapcontrol. mousepointer = esricontrolsmousepointer. esripointerpan;
Mapform. mapoperator = mapoperation. Pan;
}

/// <Summary>
/// Full extent
/// </Summary>
/// <Param name = "sender"> </param>
/// <Param name = "E"> </param>
Private void btnitem_fullextent_click (Object sender, eventargs E)
{
Axmapcontrol. mousepointer = esricontrolsmousepointer. esripointerdefault;
Mapform. mapoperator = mapoperation. fullextent;
Axmapcontrol. extent = axmapcontrol. fullextent;
}

 

Private void axmapcontrol_onmousedown (Object sender, imapcontrolevents2_onmousedownevent E)
{
Ienvelope menv;

Switch (mapoperator)
{
Case mapoperation. zoomin:
Menv = axmapcontrol. trackrectangle ();
Menv = axmapcontrol. extent;
Menv. Expand (0.5, 0.5, true );
Axmapcontrol. extent = menv;

Break;
Case mapoperation. zoomout:
Menv = axmapcontrol. trackrectangle ();
Menv = axmapcontrol. extent;
Menv. Expand (2, 2, true );
Axmapcontrol. extent = menv;

Break;
Case mapoperation. Pan:
Axmapcontrol. Pan ();

Break;

}

}

 

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.