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) 今天周六我们的主要工作是把这周落下的一些工作补回来,这是写程序的最后阶段,准备进入测试阶段了,所以之前的工作 要补齐,今天大家的 ...
随机推荐
- E. Natasha, Sasha and the Prefix Sums
http://codeforces.com/contest/1204/problem/E 给定n个 1 m个 -1的全排 求所有排列的$f(a) = max(0,max_{1≤i≤l} \sum_{j ...
- 创建maven web项目时,没有web.xml文件
1.问题:创建maven项目时,选择的是创建web-app项目,但是结果配置之后,却没有web.xml文件. 2.解决办法: ------------------------------------- ...
- 关于VMware 15搭建MacOS 10.14后无法播放在线视频和客户端视频的问题
最近在自己的电脑上搭建了MacOS10.14系统,搭建是成功了,但是发现一个很坑的事,看视频发现黑屏.就是那种只有声音,没有视频的问题,在多个浏览器上和客户端都是一样的.百度了下,总结有2种可能,一是 ...
- Visual Studio2015 community 许可证到期问题
申请微软账户直接登录可以继续使用.
- 最近使用的两个工具 winscp和xshell
最近在编译MONO源码时用到了这两个工具,感觉挺好,记录备忘 WINSCP 长这样 用于可视化的查看和操作远程服务器上的文件 xshell用于命令行下操作远程服务器,服务器的同学好多在用这个.命令行是 ...
- React-Native 之 GD (二十一)APP 打包
1.生成一个签名密钥: 在 /android/app 下运行 说明:keytool -genkey -v -keystore my-release-key.keystore -alias my-key ...
- kubeadm快速部署kubernetes(十九)
安装要求 部署Kubernetes集群机器需要满足以下几个条件: 一台或多台机器,操作系统 CentOS7.x-86_x64 硬件配置:2GB或更多RAM,2个CPU或更多CPU,硬盘30GB或更多 ...
- scrapy-splash常用设置
# Splash服务器地址 SPLASH_URL = 'http://localhost:8050' # 开启Splash的两个下载中间件并调整HttpCompressionMiddleware的次序 ...
- scrapy 配置文件指定如何导出数据
1.导出文件路径 FEED_URI = 'export_data/%(name)s.data' 2.导出数据格式 FEED_FORMAT = 'csv' 3.导出文件编码 FEED_EXPORT_EN ...
- 阶段1 语言基础+高级_1-3-Java语言高级_02-继承与多态_第2节 抽象类_14-抽象的概念
先来了解什么叫做抽象 父类有个计算面积的方法,但是不同的图形计算面积的方式是不一样的.所以这里的计算面积的方法就是个抽象的方法. 只有到具体的子类里面才能去实现具体的计算面积的方法 动物类是父类.有吃 ...