涂鸦效果的实现- Windows Live

涂鸦效果的实现

??????????? <InkPresenter x:Name="ink" Height="434" Width="650" Grid.Row="2"???????????
????????????? Background="Transparent" Opacity="1"
????????????? MouseLeftButtonDown="OnMouseLeftButtonDown"
????????????? MouseMove="OnMouseMove"
????????????? LostMouseCapture="OnLostMouseCapture" Margin="0"
????????????? >
??????????????? <InkPresenter.Clip>
??????????????????? <RectangleGeometry Rect="0,0,650,370" ></RectangleGeometry>
??????????????? </InkPresenter.Clip>
??????? private void OnMouseLeftButtonDown(object sender, MouseEventArgs e)
??????? {
??????????????? ink.CaptureMouse(); //墨迹画笔捕获鼠标
??????????????? StylusPointCollection MySPC = new StylusPointCollection(); //创建画笔坐标集合
??????????????? MyStylusPointCollection.Add(e.StylusDevice.GetStylusPoints(ink)); //讲当前ink对象的坐标集合添加到MySPC
??????????????? m_drawStroke = new Stroke(MySPC); //将坐标集合添加到画笔对象
??????????????? m_drawStroke.DrawingAttributes.Color = Colors.Gray; //设置墨迹颜色
??????????????? m_drawStroke.DrawingAttributes.OutlineColor = Colors.Gray;
??????????????? m_drawStroke.DrawingAttributes.Width = 3; //设置墨迹尺寸
??????????????? m_drawStroke.DrawingAttributes.Height = 3;
??????????????? ink.Strokes.Add(m_drawStroke);//将画笔对象添加到ink画笔的对象中
????????????
??????? }

Comments 

/
郑重声明:资讯 【涂鸦效果的实现- Windows Live】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——