#748 – 获得按下时对应位置点的大小(Getting the Size of a Contact Point during Raw Touch)
来源:互联网 发布:黑白网络官网 编辑:程序博客网 时间:2024/05/17 06:19
原文地址:https://wpf.2000things.com/2013/02/04/748-getting-the-size-of-a-contact-point-during-raw-touch/
在低级别的触屏Touch 事件中,我们可以获得手指与屏幕接触的位置的面积大小。获得这个信息可以通过TouchPoint.Bounds 属性(请注意,即使驱动层不支持,该属性也有值,可能会有为0的大小)。
下面是一个例子,在触摸的位置根据接触的大小画一个椭圆。
public partial class MainWindow : Window{ public MainWindow() { InitializeComponent(); TouchEllipses = new Dictionary<int, Ellipse>(); } private Dictionary<int, Ellipse> TouchEllipses; private void Canvas_TouchDown(object sender, TouchEventArgs e) { canvMain.CaptureTouch(e.TouchDevice); TouchPoint tp = e.GetTouchPoint(canvMain); Ellipse el = new Ellipse(); el.Stroke = Brushes.Black; el.Fill = Brushes.Black; el.Width = tp.Bounds.Width > 0 ? tp.Bounds.Width : 50; el.Height = tp.Bounds.Height > 0 ? tp.Bounds.Height : 50; Canvas.SetLeft(el, tp.Position.X - (el.Width / 2)); Canvas.SetTop(el, tp.Position.Y - (el.Height / 2)); canvMain.Children.Add(el); TouchEllipses.Add(e.TouchDevice.Id, el); e.Handled = true; } private void Canvas_TouchUp(object sender, TouchEventArgs e) { canvMain.Children.Remove(TouchEllipses[e.TouchDevice.Id]); TouchEllipses.Remove(e.TouchDevice.Id); e.Handled = true; }}
阅读全文
0 0
- #748 – 获得按下时对应位置点的大小(Getting the Size of a Contact Point during Raw Touch)
- Calculating The Logical Height and Point Size of a Font
- Calculating The Logical Height and Point Size of a Font
- 转:InfoPath 中,如何限制 Contact Selector 控件中输入的用户数量? Validate the Contact Selector in InfoPath – Limit the number of names a user can
- [torch]Getting the Output of a Layer
- magento获得产品的custom option信息 Getting all custom options of a product
- 锚点 对应的位置
- ways of getting size to machine size
- 获取peergroup的所有peers(Getting a list of the peers in a PeerGroup)
- Determining the Size of a Class Object
- ...find the size of a file?
- Determining the Size of a Class Object
- Determining the Size of a Class Object
- Determining the Size of a Class Object
- A problem during the compilation of Lemur and the solution
- #424 – 使ListBox 中每一项保持一致大小(Getting Data-Bound Items in a ListBox to Be a Consistent Size)
- 【Size Classes Design Help】- Changing the Size or Position of a View for a Size Class
- Getting Information About the Contents of a Folder
- CentOS7下编译安装 nginx1.12.0
- MVP+Retrofit+Rxjava实战
- python matlibplot绘制3D图形
- JavaScript操作DOM对象
- php 组件编程
- #748 – 获得按下时对应位置点的大小(Getting the Size of a Contact Point during Raw Touch)
- 《java基础学习之——注解Annotation》
- linux shell 发邮件
- 线程的生命周期及状态转换
- 写个观察者模式
- 静态缓存写入及读取
- {小结}2017.07.07【NOIP提高组】模拟赛A组
- iOS 10.0.2 (JailBreak) ssh root@192.x.x.x Connection refused
- git常用命令