欢迎来到天天文库
浏览记录
ID:14037583
大小:26.50 KB
页数:4页
时间:2018-07-25
《wp7控件开发笔记2》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、控件开发(三)-绘图控件,地图控件-InkPresenter:产生手写效果示例代码:StrokenewStroke;privatevoidinkPresenter1_LostMouseCapture(objectsender,MouseEventArgse){newStroke=null;//失去焦点时销毁上一次的Stroke}privatevoidinkPresenter1_MouseLeftButtonDown(objectsender,MouseButtonEventArgse){inkPresen
2、ter1.CaptureMouse();//开始捕获鼠标移动路径StylusPointCollectionspc=newStylusPointCollection();spc.Add(e.StylusDevice.GetStylusPoints(inkPresenter1));newStroke=newStroke();this.inkPresenter1.Strokes.Add(newStroke);}privatevoidinkPresenter1_MouseMove(objectsender,Mou
3、seEventArgse){if(newStroke!=null){//记录鼠标在inkPresenter1上的移动的点newStroke.StylusPoints.Add(e.StylusDevice.GetStylusPoints(inkPresenter1));}}-Path:通过MarkupSyntax来绘制一系列的线条,通过Geometries来绘制形状示例:4、ath1"Stroke="Red"StrokeThickness="10"VerticalAlignment="Top"Width="456"Fill="Green">-Ellipse:绘制圆形或椭圆形-Rectangle:绘制矩形-Line:绘制两点间的连线-Polygon:绘制封闭多边形-Polyline:绘制封闭、开发多边形5、-Glyphs:绘制字母、符号、字符等,主要用来显示Unicode字符,需要加载字体库从网上下载字体库,对于使用不多的情况使用,否则会消耗系统的资源-Map控件:在使用时,首先要申请授权验证密钥显示模式设置有Road、Arial-显示缩放按钮:ZoomBarVisibility属性-显示比例尺:ScaleVisibility属性-加标记:用到Pushpin类//为地图加标记Pushpinpin=newPushpin();pin.Location=newGeoCoordinate(30.3441333,126、0.342155132);pin.Width=200;pin.Height=200;pin.Content="济南";pin.Background=newSolidColorBrush(Colors.Red);mymap.Children.Add(pin);-绘制多变型区域:用到MapPolygon类实例化设置Locations属性即可//在地图上绘制多边形MapPolygonpolygon=newMapPolygon();polygon.Fill=newSolidColorBrush(Colors.Re7、d);polygon.Stroke=newSolidColorBrush(Colors.Yellow);polygon.StrokeThickness=5;polygon.Opacity=0.7;polygon.Locations=newLocationCollection(){newGeoCoordinate(30,120),newGeoCoordinate(30,130),newGeoCoordinate(30,160),newGeoCoordinate(30,140)};mymap.Children8、.Add(polygon);-绘制多边线:用到MapPolyline实例化设置Stroke属性和Locatatoins//在地图上绘制多边线MapPolylinepolyline=newMapPolyline();polyline.Stroke=newSolidColorBrush(Colors.Red);polyline.StrokeThickness=5;polyline.Opacity=0.5;polyline.Loca
4、ath1"Stroke="Red"StrokeThickness="10"VerticalAlignment="Top"Width="456"Fill="Green">-Ellipse:绘制圆形或椭圆形-Rectangle:绘制矩形-Line:绘制两点间的连线-Polygon:绘制封闭多边形-Polyline:绘制封闭、开发多边形
5、-Glyphs:绘制字母、符号、字符等,主要用来显示Unicode字符,需要加载字体库从网上下载字体库,对于使用不多的情况使用,否则会消耗系统的资源-Map控件:在使用时,首先要申请授权验证密钥显示模式设置有Road、Arial-显示缩放按钮:ZoomBarVisibility属性-显示比例尺:ScaleVisibility属性-加标记:用到Pushpin类//为地图加标记Pushpinpin=newPushpin();pin.Location=newGeoCoordinate(30.3441333,12
6、0.342155132);pin.Width=200;pin.Height=200;pin.Content="济南";pin.Background=newSolidColorBrush(Colors.Red);mymap.Children.Add(pin);-绘制多变型区域:用到MapPolygon类实例化设置Locations属性即可//在地图上绘制多边形MapPolygonpolygon=newMapPolygon();polygon.Fill=newSolidColorBrush(Colors.Re
7、d);polygon.Stroke=newSolidColorBrush(Colors.Yellow);polygon.StrokeThickness=5;polygon.Opacity=0.7;polygon.Locations=newLocationCollection(){newGeoCoordinate(30,120),newGeoCoordinate(30,130),newGeoCoordinate(30,160),newGeoCoordinate(30,140)};mymap.Children
8、.Add(polygon);-绘制多边线:用到MapPolyline实例化设置Stroke属性和Locatatoins//在地图上绘制多边线MapPolylinepolyline=newMapPolyline();polyline.Stroke=newSolidColorBrush(Colors.Red);polyline.StrokeThickness=5;polyline.Opacity=0.5;polyline.Loca
此文档下载收益归作者所有