zoukankan      html  css  js  c++  java
  • [Winodows Phone 7控件详解]绘图控件1

    Silverlight的绘图能力是有目共睹的,那Phone7上也一样不会差,以下就是其绘图控件。

    一.InkPresenter:可以产生手写效果的控件。

     <InkPresenter MouseLeftButtonDown="inkPresenter1_MouseLeftButtonDown" MouseMove="inkPresenter1_MouseMove"  LostMouseCapture="inkPresenter1_LostMouseCapture" Height="493" HorizontalAlignment="Left" Margin="28,34,0,0" Name="inkPresenter1" VerticalAlignment="Top" Width="405" Background="Yellow"  />        

    InkPresenter和InkCanvas不同,前者需要实现相关的事件来产生手写效果。

            private Stroke NewStroke;
    public InkPresenterPage()
    {
    InitializeComponent();
    }

    private void inkPresenter1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
    inkPresenter1.CaptureMouse();
    StylusPointCollection sc = new StylusPointCollection();
    sc.Add(e.StylusDevice.GetStylusPoints(inkPresenter1 ));
    NewStroke = new Stroke();
    inkPresenter1.Strokes.Add(NewStroke);
    }

    private void inkPresenter1_MouseMove(object sender, MouseEventArgs e)
    {
    if (NewStroke != null)
    {
    NewStroke.StylusPoints.Add(e.StylusDevice.GetStylusPoints(inkPresenter1));
    }
    }

    private void inkPresenter1_LostMouseCapture(object sender, MouseEventArgs e)
    {
    NewStroke = null;
    }

  • 相关阅读:
    1343. Fairy Tale
    Codeforces Beta Round #97 (Div. 1)
    URAL1091. Tmutarakan Exams(容斥)
    1141. RSA Attack(RSA)
    hdu4003Find Metal Mineral(树形DP)
    hdu2196 Computer待续
    KMP
    莫比乌斯反演
    配对堆
    bzoj3224Treap
  • 原文地址:https://www.cnblogs.com/DebugLZQ/p/2424142.html
Copyright © 2011-2022 走看看