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;
    }

  • 相关阅读:
    Rraspberry Pi 4B python3 安装opencv
    如何用arduion制作智能 垃圾桶
    MySQL(二)表结构的管理
    MySQL(一)基础操作
    vc++绘图基础
    网站签~
    (转)Oracle 知识日常积累
    利用反射判断bean属性不为空(null和空串)
    (转)Oracle 单字段拆分成多行
    svn 解决树冲突
  • 原文地址:https://www.cnblogs.com/DebugLZQ/p/2424142.html
Copyright © 2011-2022 走看看