2018-11-15-UWP-how-to-get-the-touch-width
| title | author | date | CreateTime | categories |
|---|---|---|---|---|
|
UWP how to get the touch width
|
lindexi
|
2018-11-15 18:49:12 +0800
|
2018-11-06 09:25:23 +0800
|
UWP
|
The touch width can help us to make a gorgeous application. This article tells you how to get the touch width from the PointEvent in UWP.
Opening the VisualStudio and create an empty UWP application.
We should open the MainPage.xaml and add the background in the Grid to make the Grid can get the PointMove event.
<Grid Background="Transparent">
</Grid>
Then we can open the MainPage.xaml.cs to write the code to get the PointerMove event.
public MainPage()
{
InitializeComponent(); Content.PointerMoved += MainPage_PointerMoved;
} private void MainPage_PointerMoved(object sender, PointerRoutedEventArgs e)
{ }
We can use GetCurrentPoint to get the PointerPoint.
private void MainPage_PointerMoved(object sender, PointerRoutedEventArgs e)
{
var point = e.GetCurrentPoint(this);
}
And we can find the ContactRect in Properties. We can get the touch width from ContactRect.
private void MainPage_PointerMoved(object sender, PointerRoutedEventArgs e)
{
var point = e.GetCurrentPoint(this);
Rect rect = point.Properties.ContactRect;
}
To get the touch width.
private void MainPage_PointerMoved(object sender, PointerRoutedEventArgs e)
{
var point = e.GetCurrentPoint(this);
Rect rect = point.Properties.ContactRect;
Debug.WriteLine($"Touch rect width={rect.Width},height={rect.Height}");
}
We also can use ContactRectRaw in Properties.
private void MainPage_PointerMoved(object sender, PointerRoutedEventArgs e)
{
var point = e.GetCurrentPoint(this);
Rect rect = point.Properties.ContactRect;
Debug.WriteLine($"Touch rect width={rect.Width},height={rect.Height}");
rect = point.Properties.ContactRectRaw;
Debug.WriteLine($"Touch raw rect width={rect.Width},height={rect.Height}");
}
Try to run the code and touch the application and you can watch the output windows that prints the touch width.
2018-11-15-UWP-how-to-get-the-touch-width的更多相关文章
- 2018.11.15 Nginx服务器的使用
Nginx简单教程 1.什么是Nginx? Nginx(engine x)是一款轻量级的Web服务器.反向代理服务器及电子邮件(IMAP/POP3)代理服务器 什么是反向代理服务器? 反向代理方式是指 ...
- 2018.11.15 RF antenna impedance-matching
We have studied the impedance-matching of RF transmission line between the antenna and the RX / TX m ...
- OI生涯回忆录 2018.11.12~2019.4.15
上一篇:OI生涯回忆录 2017.9.10~2018.11.11 一次逆风而行的成功,是什么都无法代替的 ………… 历经艰难 我还在走着 一 NOIP之后,全机房开始了省选知识的自学. 动态DP,LC ...
- Sprint1(第二天11.15)
Sprint1(第二天11.15) Sprint1第一阶段 1.类名:软件工程-第一阶段 2.时间:11.14-11.23 3.选题内容:web版-餐厅到店点餐系统 4.团队博客地址: http:// ...
- Tencent Cloud Developers Conference(2018.12.15)
时间:2018.12.15地点:北京朝阳悠唐皇冠假日酒店
- China Intelligent Office Summit(2018.11.21)
时间:2018.11.21地点:中关村软件园国际会议中心
- International Programming Retreat Day(2018.11.17)
时间:2018.11.17地点:北京国华投资大厦
- Intel Artificial Intelligence Conference(2018.11.14)
时间:2018.11.14地点:北京国贸大酒店
- Lean Data Innovation Sharing Salon(2018.09.15)
时间:2018.09.15地点:北京国华投资大厦
- Notes of Daily Scrum Meeting(11.15)
Notes of Daily Scrum Meeting(11.15) 今天周六我们的主要工作是把这周落下的一些工作补回来,这是写程序的最后阶段,准备进入测试阶段了,所以之前的工作 要补齐,今天大家的 ...
随机推荐
- 洛谷P1310 表达式的值——题解
题目传送 题的难点:1.有运算优先级,不好判断.2.有破坏整体和谐性的讨厌的括号.3.不知道哪里要填数.4.要求方案数很大,搜索不会做呐. 发现难点1和2都是中缀表达式的缺点.转成后缀表达式后难点1. ...
- Web开发者易犯的五大严重错误
无论你是编程高手,还是技术爱好者,在进行Web开发过程中,总避免不了犯各种各样的错误. 犯了错误,可以改正.但如果犯了某些错误,则会带来重大损失.遗憾.令人惊讶的是,这些错误往往是最普通,最容易避免. ...
- 笨办法学Python(learn python the hard way)--练习程序41
下面是练习41,基于python3 #ex41.py 1 #打印文档字符串 print(函数名.__doc__) 2 from sys import exit 3 from random import ...
- 正则表达式小结,数据预处理中常用的shell命令
数据预处理中,这部分命令非常有用. 不需要编写代码,直接通过shell脚本通常就能修改文件格式.有时候sed和awk联合几乎能实现所有功能. 管道命令 | 重定向命令>,2>,>&g ...
- (转载)《利用Python进行数据分析·第2版》电子书
https://www.jianshu.com/p/04d180d90a3f https://www.jianshu.com/p/04d180d90a3f https://www.jianshu.co ...
- 用Vue来实现音乐播放器(九):歌单数据接口分析
z这里如果我们和之前获取轮播图的数据一样来获取表单的数据 发现根本获取不到 原因是qq音乐在请求头里面加了authority和refer等 但是如果我们通过jsonp实现跨域来请求数据的话 是根本 ...
- oracle 11g不能导出空表的解决方法
在oracle 11g r2中,发现传统的exp居然不能导出空的表,然后查询一下, 发现需要如下的步骤去搞,笔记之. oracle 11g 新增了一个参数:deferred_segment_c ...
- 关于 token
用户在浏览器做一系列操作,后台服务怎么判断这些操作是来自同一个用户? 1. seesion 用户登录后,后台生成 sessionid 返回给浏览器,浏览器的每次请求带上 sessionid,后台关联 ...
- robot framework :List Variables-List变量及其用法
[转自:https://blog.csdn.net/yezibang/article/details/52692342] 这一讲我们重点来介绍List Variables-List变量及其用法. 一. ...
- golang md5 结果类型
golang md5 结果类型 package main import ( "crypto/md5" "encoding/hex" "fmt&quo ...