WP7 Development (6) WP7 control development (3)-map control

Source: Internet
Author: User
Tags polyline

-Inkpresenter: produce handwriting Effect

ExampleCode:

Stroke newstroke;

Private void inkpresenterinclulostmousecapture (Object sender, mouseeventargs E)

{

Newstroke = NULL; // destroy the previous stroke when the focus is lost

}

 

Private void inkpresenter=mouseleftbuttondown (Object sender, mousebuttoneventargs E)

{

Inkpresenter1.capturemouse (); // start to capture the mouse movement path

Styluspointcollection SPC = new styluspointcollection ();

SPC. Add (E. stylusdevice. getstyluspoints (inkpresenter1 ));

Newstroke = new stroke ();

This. inkpresenter1.strokes. Add (newstroke );

}

 

Private void inkpresenter=mousemove (Object sender, mouseeventargs E)

{

If (newstroke! = NULL)

{

// Record the point at which the mouse moves over inkpresenter1

Newstroke. styluspoints. Add (E. stylusdevice. getstyluspoints (inkpresenter1 ));

}

}

-Path: Draw a series of lines using markup syntax and draw shapes using geometries.

Example:

& Lt; Path Height = "428" horizontalalignment = "left"

Margin = "12,127, 456" name = "path1" stroke = "red" strokethickness = "10" verticalignment = "TOP" width = "" fill = "green">

<Path. Data>

<Ellipsegeometry center = "200,200" radiusx = "100" radiusy = "30"/>

</Path. Data>

</Path>

-Ellipse: draws a circle or an elliptical shape.

-Rectangle: draws a rectangle.

-Line: draw the line between two points

-Polygon: draws closed polygon.

-Polyline: draws closed and develops polygon.

-Glyphs: draws letters, symbols, and characters. It is mainly used to display Unicode characters. You need to load the font library to download the font library from the Internet. If you are not using it much, otherwise it will consume system resources.

-Map control: when using the key display mode, you must first apply for authorization verification.

-Display the zoombarvisibility attribute.

-Display scale: scalevisibility attribute

-Markup: pushpin class is used.

// Add a flag to the map

Pushpin pin = new pushpin ();

Pin. Location = new geocoordinate (30.3441333, 120.342155132 );

Pin. width = 200;

Pin. Height = 200;

Pin. content = "Jinan ";

Pin. Background = new solidcolorbrush (colors. Red );

Mymap. Children. Add (PIN );

-Draw variable regions: You can use mappolygon class Instantiation to set the locations attribute.

// Draw a polygon on the map

Mappolygon polygon = new mappolygon ();

Polygon. Fill = new solidcolorbrush (colors. Red );

Polygon. Stroke = new solidcolorbrush (colors. Yellow );

Polygon. strokethickness = 5;

Polygon. Opacity = 0.7;

Polygon. Locations = new locationcollection ()

{

New geocoordinate (30,120 ),

New geocoordinate (30,130 ),

New geocoordinate (30,160 ),

New geocoordinate (0, 30,140)

};

Mymap. Children. Add (polygon );

-Draw a multilateral line: Use mappolyline Instantiation to set the stroke attribute and locatatoins

// Draw a multilateral line on the map

Mappolyline polyline = new mappolyline ();

Polyline. Stroke = new solidcolorbrush (colors. Red );

Polyline. strokethickness = 5;

Polyline. Opacity = 0.5;

Polyline. Locations = new locationcollection ()

{

New geocoordinate (30.3424242, 120.3432444 ),

New geocoordinate (30.3424242, 120.3432444)

};

Mymap. Children. Add (polyline );

-Add images to a map

// Add an image to the map

Image image = new image ();

Image. width = 100;

Image. Height = 100;

Image. Source = new bitmapimage (New uri ("images/pic1.jpg", urikind. Relative ));

Maplayer imagelayer = new maplayer ();

Imagelayer. addchild (image, new geocoordinate (30,120), positionorigin. bottomleft );

Mymap. Children. Add (imagelayer );

Related Article

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.