WPF 定时器DispatcherTimer+GetCursorPos 的使用,动态查看屏幕上任一点坐标
原文:WPF 定时器DispatcherTimer+GetCursorPos 的使用,动态查看屏幕上任一点坐标
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.IO;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Diagnostics;using System.Runtime.InteropServices;using System.Windows.Threading;namespace AiGame{ public partial class MainWindow : Window { public struct POINT { public int X; public int Y; } [DllImport("user32.dll", CharSet = CharSet.Auto)]//导入Dll public static extern bool GetCursorPos(ref POINT pt);//定义相对应的函数,需使用ref传入结构,这里是传入结构的引用 public MainWindow() { InitializeComponent(); DispatcherTimer dTimer = new System.Windows.Threading.DispatcherTimer(); dTimer.Tick += new EventHandler(dTimer_Tick); dTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); dTimer.Start(); } void dTimer_Tick(object sender, EventArgs e) { POINT p = new POINT(); GetCursorPos(ref p);//这里传入结构实例 this.Title= p.X.ToString() + " " + p.Y.ToString();//鼠标的实时坐标在标题上体现出来 } }}
WPF 定时器DispatcherTimer+GetCursorPos 的使用,动态查看屏幕上任一点坐标的更多相关文章
- C# WPF定时器
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来.我们都知道计算机技术发展日新月异,速度惊人的快,你我稍不留神,就会被慢慢淘汰!因此:每日不间断的学习是避免被 ...
- Linux动态查看网络流量iptraf
iptraf工具可以动态查看网络流量 yum install iptraf 查看所有网卡流量 iptraf -g
- WPF中静态引用资源与动态引用资源的区别
WPF中静态引用资源与动态引用资源的区别 WPF中引用资源分为静态引用与动态引用,两者的区别在哪里呢?我们通过一个小的例子来理解. 点击“Update”按钮,第2个按钮的文字会变成“更上一层楼”, ...
- 如何使用Excel表格状态栏动态查看统计
该文是以前的博文,本文中有一列是快递单号,其实这一列根本不需要,一般快递几天就到,在excel表中存快递单号,纯属浪费时间,快递单号一般都会有客户留存联,而且也登入了网上的表格,所以个人用的excel ...
- WPF编程,通过Double Animation动态旋转控件的一种方法。
原文:WPF编程,通过Double Animation动态旋转控件的一种方法. 版权声明:我不生产代码,我只是代码的搬运工. https://blog.csdn.net/qq_43307934/art ...
- WPF编程,通过Double Animation动态更改控件属性的一种方法。
原文:WPF编程,通过Double Animation动态更改控件属性的一种方法. 版权声明:我不生产代码,我只是代码的搬运工. https://blog.csdn.net/qq_43307934/a ...
- WPF编程,通过Double Animation动态缩放控件的一种方法。
原文:WPF编程,通过Double Animation动态缩放控件的一种方法. 版权声明:我不生产代码,我只是代码的搬运工. https://blog.csdn.net/qq_43307934/art ...
- linux日常管理-top动态查看负载
动态查看负载命令,具体哪个程序,哪个进程造成的系统负载. top 回车查看 3秒更新一次 第一行和uptime和w第一行显示的一样. CPU使用率,us sy 内存相关,Mem 一共多少,使用了多少, ...
- 通过日志动态查看正在执行的mysql语句
通过日志动态查看正在执行的mysql语句 :tail -f /tmp/general_log.log
随机推荐
- Satisfying memory ordering requirements between partial reads and non-snoop accesses
A method and apparatus for preserving memory ordering in a cache coherent link based interconnect in ...
- Canvas基础知识总结之中的一个
canvas的HTML语法: <canvas> Canvas not supported </canvas> 上面这句代码中内容部分所含的文本,这种文本的叫法"后备内 ...
- GAN(Generative Adversarial Networks) 初步
1. Generator vs. Discriminator 首先需要指出的是生成式模型(generative models)和判别式模型(discriminative models)的区别: dis ...
- [AHK]自定义默认浏览器
https://blog.csdn.net/liuyukuan/article/details/78844383
- hadoop一些常见报错的解决方式
Failed to set setXIncludeAware(true) for parser 遇到此问题通常是jar包冲突的问题. 一种情况是我们向java的lib文件夹加入我们自己的jar包导致h ...
- [内核编程] Windebug双机调试环境搭建
Windebug双机调试环境搭建 开始进行内核编程/驱动编程的调试工作是非常烦人的,由于程序运行与内核层不受操作系统的管控,所以容易引起主机蓝屏和崩溃是常有的事.这也就使得内核程序的调试成了一大 ...
- 【30.49%】【codeforces 569A】Music
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- keepalived.conf 配置文件小结
vrrp_script vs_mysql_82 { script "/etc/keepalived/checkMySQL.py -h 192.168.11.82 -P 3306&qu ...
- Spring mvc 多文件上传
http://blog.csdn.net/swingpyzf/article/details/20230865
- [CSS Flex] Justify-content
justify content contol how element inside flex box align, it can be "right / end", or &quo ...