1、获取鼠标位置

private void timer1_Tick(object sender, EventArgs e)
{
// timer1.Stop();
// int x = Control.MousePosition.X;
// int y = Control.MousePosition.Y;
// label1.Text = string.Format("x:{0} y:{1}",x,y);
// timer1.Start(); label1.Text = mouse();
} private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();
} public string mouse()
{
int x = Control.MousePosition.X;
int y = Control.MousePosition.Y;
string mouse_inf = "x:" + x.ToString() + " y:" + y.ToString();
return mouse_inf;
} }
}
timer 是一个触发器 开始搞不明白  用了mousemove事件  发现移出窗口就不触发了。后来找到了这个。

2、获取鼠标点击的类
        public static string mouse_position()
{
int x = Control.MousePosition.X;
int y = Control.MousePosition.Y;
string str_click = "null";
MouseButtons mb = Control.MouseButtons;
if (mb == System.Windows.Forms.MouseButtons.Left) str_click = "Left";
if (mb == System.Windows.Forms.MouseButtons.Right) str_click = "Right";
if (mb == System.Windows.Forms.MouseButtons.Middle) str_click = "Middle"; string mouse_inf = string.Format("{0},{1},{2}", x, y, str_click);
return mouse_inf;
}

调用

 string get = mouse_position();
label1.Text = get;
string[] mouse = get.Split(',');
if (mouse[] != "null")
{
listBox1.Items.Add(get);
}

模拟按键输入

 SendKeys.Send(send_string);

最新文章

  1. ural 1073. Square Country
  2. GUI开发者桌面搜索文件工具
  3. 使用PPT绘制96孔板
  4. react native下android开发环境搭建
  5. 使用phpmaill发送邮件的例子
  6. Action的执行
  7. 让DIV浮动在表格上固定位置,不会随着显示器的分辨率变化。
  8. VIM小技巧之文件名补全
  9. TypeScript 中的 SOLID 原则
  10. Mybatis拦截器实现分页
  11. selenium-弹窗操作(八)
  12. iOS开发之Swift 4 JSON 解析指南
  13. 百度地图自定义icon,定位偏移问题
  14. Vue--vux组件库
  15. cubic与spline插值点处的区别
  16. 使用ecstore-sdk开发包制作易开店和启明星模板
  17. 我的border能自定义四角之border-radius : 左上角,右上角,左下角,右下角。
  18. Node.js创建第一个应用
  19. js & right click menu & 鼠标滑词
  20. SSH 指定密钥,连接远程服务器。

热门文章

  1. Cocos2d-x lua 游戏中的菜单(Menu)
  2. zoj3806Incircle and Circumcircle
  3. windows下如何安装和启动MySQL
  4. Wiki设置
  5. nginx rewrite 实现二级域名跳转
  6. GCC for Win32开发环境介绍
  7. IRLS(迭代加权最小二乘)
  8. PHP 底层的运行机制与原理
  9. (转)assert 断言式编程
  10. web.xml中的contextConfigLocation在spring中的作用