日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

windows phone画板程序

發布時間:2023/12/2 windows 54 豆豆
生活随笔 收集整理的這篇文章主要介紹了 windows phone画板程序 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

????????? 前幾天想要這樣一個程序,沒找到,今天上網偶然發現了,轉載過來。

    

<Grid> <InkPresenter x:Name="MyPresenter" HorizontalAlignment="Left" VerticalAlignment="Top" MouseLeftButtonDown="MyPresenter_MouseLeftButtonDown" LostMouseCapture="MyPresenter_LostMouseCapture" MouseMove="MyPresenter_MouseMove" Background="Transparent" Opacity="1" Width="480" Height="750" /> </Grid>

??????

[csharp] view plaincopyprint? using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; // 引入以下命名空間。 using System.Windows.Ink; namespace InkPresentSample { public partial class MainPage : PhoneApplicationPage { Stroke CurrentStroke = null; // 構造函數 public MainPage() { InitializeComponent(); // 設置剪輯,以便收集墨跡 RectangleGeometry rg = new RectangleGeometry(); // 為了使范圍準確,應使用控件的最終呈現高度。 rg.Rect = new Rect(0, 0, MyPresenter.ActualWidth, MyPresenter.ActualHeight); MyPresenter.Clip = rg; } private void MyPresenter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { // 當我們點擊時獲捉鼠標光標 MyPresenter.CaptureMouse(); // 收集當前的光標所在的位置的點 StylusPointCollection sc = new StylusPointCollection(); sc.Add(e.StylusDevice.GetStylusPoints(MyPresenter)); CurrentStroke = new Stroke(sc); // 設置筆觸的顏色,大小 CurrentStroke.DrawingAttributes.Color = Colors.Yellow; CurrentStroke.DrawingAttributes.Width = 8; CurrentStroke.DrawingAttributes.Height = 8; // 把新的筆觸添加到集合中 MyPresenter.Strokes.Add(CurrentStroke); } private void MyPresenter_LostMouseCapture(object sender, MouseEventArgs e) { // 當釋放鼠標時,也同時釋放筆觸變量的引用 CurrentStroke = null; } private void MyPresenter_MouseMove(object sender, MouseEventArgs e) { if (CurrentStroke != null) { // 每移動一次鼠標,都收集對應的點。 CurrentStroke.StylusPoints.Add(e.StylusDevice.GetStylusPoints(MyPresenter)); } } } }

我試了運行結果是正確 的,有需要的試試。

?

轉載于:https://www.cnblogs.com/learnWindowsPhone/archive/2012/04/24/2468948.html

總結

以上是生活随笔為你收集整理的windows phone画板程序的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。