1、控件开发(三)-绘图控件,地图控件 -InkPresenter:产生手写效果 示例代码: Stroke newStroke; private void inkPresenter1_LostMouseCapture(object sender, MouseEventArgs e) { newStroke = null;//失去焦点时销毁上一次的Stroke } private void inkPresenter1_MouseLeftButtonDown(obj
2、ect sender, MouseButtonEventArgs e) { inkPresenter1.CaptureMouse();//开始捕获鼠标移动路径 StylusPointCollection spc = new StylusPointCollection(); spc.Add(e.StylusDevice.GetStylusPoints(inkPresenter1)); newStroke = new Stroke(); this.in
3、kPresenter1.Strokes.Add(newStroke); } private void inkPresenter1_MouseMove(object sender, MouseEventArgs e) { if (newStroke != null) { //记录鼠标在inkPresenter1上的移动的点 newStroke.StylusPoints.Add(e.StylusDevice.GetStyl
4、usPoints(inkPresenter1));
}
}
-Path:通过Markup Syntax来绘制一系列的线条,通过Geometries来绘制形状
示例:
5、
6、消耗系统的资源 -Map控件:在使用时,首先要申请授权验证密钥 显示模式设置有Road、Arial -显示缩放按钮:ZoomBarVisibility属性 -显示比例尺:ScaleVisibility属性 -加标记:用到Pushpin类 //为地图加标记 Pushpin pin = new Pushpin(); pin.Location = new GeoCoordinate(30.3441333,120.342155132); p
7、in.Width = 200; pin.Height = 200; pin.Content = "济南"; pin.Background = new SolidColorBrush(Colors.Red); mymap.Children.Add(pin); -绘制多变型区域:用到MapPolygon类 实例化 设置Locations属性即可 //在地图上绘制多边形 MapPolygon polygon = new MapPolygo
8、n(); polygon.Fill = new SolidColorBrush(Colors.Red); polygon.Stroke = new SolidColorBrush(Colors.Yellow); polygon.StrokeThickness = 5; polygon.Opacity = 0.7; polygon.Locations = new LocationCollection() {
9、new GeoCoordinate(30,120), new GeoCoordinate(30,130), new GeoCoordinate(30,160), new GeoCoordinate(30,140) }; mymap.Children.Add(polygon); -绘制多边线:用到MapPolyline 实例化 设置Stroke属性和Locatatoins //在地图上绘制多边线 M
10、apPolyline polyline = new MapPolyline(); polyline.Stroke = new SolidColorBrush(Colors.Red); polyline.StrokeThickness = 5; polyline.Opacity = 0.5; polyline.Locations = new LocationCollection() { new GeoCoordinate(30.342
11、4242,120.3432444), new GeoCoordinate(30.3424242,120.3432444) }; mymap.Children.Add(polyline); -在地图上添加图片 //在地图上添加图片 Image image = new Image(); image.Width = 100; image.Height = 100; image.
12、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); WP7控件开发(四)-Silverlight Tookit控件集 包括:
13、Contextmenu、ToggleSwitch、WrapPanel、DatePicker、TimePicker、AutoCompleteBox、NavigationTransition、ListPicker、LongListSelector -Contextmenu -长按弹出菜单 -不能在容器控件中使用 -ToggleSwitch:具有两种状态Checked和Unchecked -WrapPanel:用来对大量控件进行按顺序排列的容器 -DatePicker:设置日期时间,可通过ValueStringFormat来设置时间的显示格式:{}{0:d},{}
14、{0:t} ,{}{0:D},{}{0:T},{}{0:MM-dd-yyyy},{}{0:HH:mm} -TimePicker:设置时间时分秒 -AutoCompleteBox: 属性: -FilterMode:匹配方式 -IsDropDownOpen:下拉列表是否打开 -IsTextCompletionEnable:自动完成匹配填写 -MaxDropDownHeight:下拉列表的最大高度 -MinimumPopulateDelay:最小匹配时间 -MinimumPrefixLength:最短匹配长度 事件: -DropDown
15、Closed -DropDownClosing -DropDownOpened -DropDownOpening -NavigationTransition: -实现页面的切换效果 -使用之前要将App.xaml.cs中InitializePhoneAppliation()函数里的RootFrame进行修改 如:RootFrame=new TransitionFrame(); -五种动画效果包括:RollTransition、RotateTransition、SlideTransition、 SwiveTranstion、Turnstil
16、eTransition
示例:
17、ion.Backward>
18、avigationOutTransition> //退出页面动画效果
19、tateTransition Mode="Out180Clockwise"/>
20、l类,同样继承于UIElement
示例:Waiting控件的实现
WP7控件开发(五)-Panorama全景视图,Pivot枢轴视图
-Panorama视图:使用一个超过屏幕宽度的长水平画布,提供独特显示控件,数据和服务的方式,是一种选项、导航和数据的多屏幕 滚动菜单
-结构包括:Background,Title,Items,Background图片高度要为800像素,宽度大于480像素,小于2000像素
-Pivot视图:快捷管理应用中的视图或页面,过滤数据,视图分类
-结构包括:Title,Header,PivotItem
21、
-使用注意:Header文字不要显示过长,以免其他PivotItem中的Header无法显示,在PivotItem中,不要使用ScrollViewer 或ListBox这类带有手势的控件
WP7控件开发(六)-DeepZoom技术
-DeepZoom:源于遥感影像的金字塔显示方式,提供了与高分辨率图像进行交互的能力,可以快速缩放图像而不影响应用的性能,加载或平移图像时可以光滑过度
-应用:高分辨率、极大图像的浏览,3D合成图像,广告宣传
-分类:Single和Collection
-DeepZoom Composer制作工具下载地址: ... 457B17B7-52BF-4BDA-
87A3-FA8A4673F8BF
-MulitScaleImage:打开、放大和平移多分辨率图像,快速任意缩放展示大图形、高分辨率图像的应用程序 -属性:Source,UseSprings-springs animations,ViewportOrigin-CenterPoint,ViewportWidth-ZoomLevel






