Map for WinForms | ComponentOne
In This Topic
    End User Interaction
    In This Topic

    Map provides the viewing container which supports zooming and panning using multi-touch gestures. Users can double tap or stretch to zoom-in while pinching to zoom-out.

    When panning or scrolling the map in the east-west direction, you can allow the map to loop back endlessly by setting the HorizontalLoop property. The default value of the property is false. Setting the HorizontalLoop property to true causes the map to not stop rendering at ±180°E/W.

    The map control has the following tools:

    Zooming tool

    The zooming tool in Map allows users to select the area they want to enlarge by moving the slider on the zooming tool, enabling them to analyze areas, cities, towns, countries etc. at a minute level. The Zoom tool consists of increase and decrease buttons, a thumb button and trackbar.

    Map control with zoom tool

    You can also zoom the map using the mouse wheel event. That is, the map is zoomed in when the mouse is scrolled up and the map is zoomed out when the mouse is scrolled down.

    Panning tool

    The panning tool in Map allows users to navigate across the maps in North, South, East and West directions. Panning allows users to move a map around to focus on a specific area. The Panning tool has a round pan panel and it holds four markers to indicate the directions.

    Map control with pan tool

    Distance-scaling tool 

    A map control is incomplete without distance-scaling tool. The distance scaling tool is necessary to represent the distances between different places on Earth to depict the relief on map precisely. The Distance-Scaling tool has a scale bar, which shows metric unit above the bar and imperial unit below the bar.

    Map control with distance scale tool

    Map allows you to customize the map tools. To do so, you can use the properties of MapPanToolMapZoomTool, and MapDistanceScale class.

    The tools in the Map control can be aligned either top left, middle left, bottom left, top center, middle center, bottom centre, top right, middle right or bottom right.

    Map snapshot showing end user interaction

    Repositioning map tools

    The tools in the Map control are positioned on the left side of a map. Although, you can change their position according to your requirements.

    Map control with repositioned map tools

    Following code illustrates repositioning of the map tools:

    C#
    Copy Code
    c1Map1.DistanceScale.Alignment = ContentAlignment.BottomRight;
    c1Map1.PanTool.Alignment = ContentAlignment.TopCenter;
    c1Map1.ZoomTool.Alignment = ContentAlignment.MiddleLeft;
    c1Map1.ZoomTool.Orientation = Orientation.Horizontal;
    

    C1Map also allows you to set the custom location and size of a map tool by setting the Bounds property. Following code demonstrates the use of Bounds property to set the custom location and size of the Pan tool:

    C#
    Copy Code
    c1Map1.PanTool.Bounds = new Rectangle(100, 100, 100, 100);