2023年C限制鼠标移动范围.pdf

上传人:c****1 文档编号:93167918 上传时间:2023-06-29 格式:PDF 页数:7 大小:338.41KB
返回 下载 相关 举报
2023年C限制鼠标移动范围.pdf_第1页
第1页 / 共7页
2023年C限制鼠标移动范围.pdf_第2页
第2页 / 共7页
点击查看更多>>
资源描述

《2023年C限制鼠标移动范围.pdf》由会员分享,可在线阅读,更多相关《2023年C限制鼠标移动范围.pdf(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精品好文档,推荐学习交流 仅供学习与交流,如有侵权请联系网站删除 谢谢1 1 一个鼠标类#region 一个鼠标类 2/*/3/Mouse Control 4/Made by Michael 5/date 2008-01-30 6/7 class Mouse 8 9 internal const byte SM_MOUSEPRESENT=19;10 internal const byte SM_CMOUSEBUTTONS=43;11 internal const byte SM_MOUSEWHEELPRESENT=75;12 13 internal struct POINTAPI 14 15

2、internal int x;16 internal int y;17 18 19 internal struct RECT 20 21 internal int left;22 internal int top;23 internal int right;24 internal int bottom;25 26 27 System.Runtime.InteropServices.DllImport(user32.dll,EntryPoint=SwapMouseButton)28 internal extern static int SwapMouseButton(int bSwap);29

3、30 System.Runtime.InteropServices.DllImport(user32,EntryPoint=ClipCursor)31 internal extern static int ClipCursor(ref RECT lpRect);32 33 System.Runtime.InteropServices.DllImport(user32.dll,EntryPoint=GetCursorPos)34 internal extern static int GetCursorPos(ref POINTAPI lpPoint);35 36 System.Runtime.I

4、nteropServices.DllImport(user32.dll,EntryPoint=ShowCursor)37 internal extern static bool ShowCursor(bool bShow);38 39 System.Runtime.InteropServices.DllImport(user32.dll,EntryPoint=EnableWindow)40 internal extern static int EnableWindow(int hwnd,int fEnable);41 精品好文档,推荐学习交流 仅供学习与交流,如有侵权请联系网站删除 谢谢2 4

5、2 System.Runtime.InteropServices.DllImport(user32.dll,EntryPoint=GetWindowRect)43 internal extern static int GetWindowRect(int hwnd,ref RECT lpRect);44 45 System.Runtime.InteropServices.DllImport(user32.dll,EntryPoint=SetCursorPos)46 internal extern static int SetCursorPos(int x,int y);47 48 System.

6、Runtime.InteropServices.DllImport(user32.dll,EntryPoint=GetSystemMetrics)49 internal extern static int GetSystemMetrics(int nIndex);50 51 System.Runtime.InteropServices.DllImport(user32.dll,EntryPoint=SetDoubleClickTime)52 internal extern static int SetDoubleClickTime(int wCount);53 54 System.Runtim

7、e.InteropServices.DllImport(user32.dll,EntryPoint=GetDoubleClickTime)55 internal extern static int GetDoubleClickTime();56 57 System.Runtime.InteropServices.DllImport(kernel32.DLL,EntryPoint=Sleep)58 internal extern static void Sleep(int dwMilliseconds);59 60/得到鼠标相对与全屏的坐标,不是相对与你的 Form 的,且与你的分辨率有关系 6

8、1 62 public static int FullScreenPosition_X 63 64 get 65 66 POINTAPI _POINTAPI=new POINTAPI();67 68 GetCursorPos(ref _POINTAPI);69 70 return _POINTAPI.x;71 72 73 74 public static int FullScreenPosition_Y 75 76 get 77 78 POINTAPI _POINTAPI=new POINTAPI();79 80 GetCursorPos(ref _POINTAPI);除谢谢精品好文档推荐学习

9、交流隐藏显示鼠标将鼠标锁定在你的里不过你得将你的先锁了就失效了鼠标失效不过失效 型本计算机尚未安装鼠标键滚轮鼠标键鼠标设置鼠标双击时间设置鼠标默认主键仅供学习与交流如有侵权请联系网站 材的参考句型下划线词组短语黑体精美句子方框仅供学习与交流如有侵权请联系网站删除谢谢精品好文档推荐学习交精品好文档,推荐学习交流 仅供学习与交流,如有侵权请联系网站删除 谢谢3 81 82 return _POINTAPI.y;83 84 85 86/隐藏 显示 鼠标 87 public static void Hide()88 89 ShowCursor(false);90 91 92 public static

10、 void Show()93 94 ShowCursor(true);95 96 97/将鼠标锁定在你的 Form 里 不过你得将你的 Form 先锁了,Form Resize 就失效了 98 public static void Lock(System.Windows.Forms.Form ObjectForm)99 100 RECT _FormRect=new RECT();101 102 GetWindowRect(ObjectForm.Handle.ToInt32(),ref _FormRect);103 104 ClipCursor(ref _FormRect);105 106 10

11、7 public static void UnLock()108 109 RECT _ScreenRect=new RECT();110 111 _ScreenRect.top=0;112 _ScreenRect.left=0;113 _ScreenRect.bottom=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom;114 _ScreenRect.right=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right;115 116 ClipCursor(r

12、ef _ScreenRect);117 118 119/鼠标失效,不过失效的好像不只是鼠标,小心哦 120 public static void Disable(System.Windows.Forms.Form ObjectForm)121 除谢谢精品好文档推荐学习交流隐藏显示鼠标将鼠标锁定在你的里不过你得将你的先锁了就失效了鼠标失效不过失效 型本计算机尚未安装鼠标键滚轮鼠标键鼠标设置鼠标双击时间设置鼠标默认主键仅供学习与交流如有侵权请联系网站 材的参考句型下划线词组短语黑体精美句子方框仅供学习与交流如有侵权请联系网站删除谢谢精品好文档推荐学习交精品好文档,推荐学习交流 仅供学习与交流,如有

13、侵权请联系网站删除 谢谢4 122 EnableWindow(ObjectForm.Handle.ToInt32(),0);123 124 125 public static void Enable(System.Windows.Forms.Form ObjectForm)126 127 EnableWindow(ObjectForm.Handle.ToInt32(),1);128 129/得到你的鼠标类型 130 public static string Type 131 132 get 133 134 if(GetSystemMetrics(SM_MOUSEPRESENT)=0)135 1

14、36 return 本计算机尚未安装鼠标;137 138 else 139 140 if(GetSystemMetrics(SM_MOUSEWHEELPRESENT)!=0)141 142 return GetSystemMetrics(SM_CMOUSEBUTTONS)+键滚轮鼠标;143 144 else 145 146 return GetSystemMetrics(SM_CMOUSEBUTTONS)+键鼠标;147 148 149 150 151 152/设置鼠标双击时间 153 public static void DoubleClickTime_Set(int MouseDoubl

15、eClickTime)154 155 SetDoubleClickTime(MouseDoubleClickTime);156 157 158 public static string DoubleClickTime_Get()159 160 return GetDoubleClickTime().ToString();161 162 163/设置鼠标默认主键 164 public static void DefaultRightButton()165 除谢谢精品好文档推荐学习交流隐藏显示鼠标将鼠标锁定在你的里不过你得将你的先锁了就失效了鼠标失效不过失效 型本计算机尚未安装鼠标键滚轮鼠标键鼠标

16、设置鼠标双击时间设置鼠标默认主键仅供学习与交流如有侵权请联系网站 材的参考句型下划线词组短语黑体精美句子方框仅供学习与交流如有侵权请联系网站删除谢谢精品好文档推荐学习交精品好文档,推荐学习交流 仅供学习与交流,如有侵权请联系网站删除 谢谢5 166 SwapMouseButton(1);167 168 169 public static void DefaultLeftButton()170 171 SwapMouseButton(0);172 173 调用如下:1/锁窗体 2 Mouse.Lock(this);3/锁光标 4 Mouse.Disable(this);中考英语作文范文 30 篇

17、文章 Model Writings(以下 30 篇文章仅供同学对不同题材的参考)句型:下划线 词组短语:黑体 精美句子:方框 1.How to Make Friends Its hard to make friends if you stay alone all the time.Its easier to make friends when you have similar interests.Look at people in the eyes when you talk to them.Dont be afraid to show people what you are really g

18、ood at.Talk about the things you like and do best.Be a good listener.Let people talk about themselves before talking about yourself.Be friendly to a lot of people.Try to help your 除谢谢精品好文档推荐学习交流隐藏显示鼠标将鼠标锁定在你的里不过你得将你的先锁了就失效了鼠标失效不过失效 型本计算机尚未安装鼠标键滚轮鼠标键鼠标设置鼠标双击时间设置鼠标默认主键仅供学习与交流如有侵权请联系网站 材的参考句型下划线词组短语黑体精

19、美句子方框仅供学习与交流如有侵权请联系网站删除谢谢精品好文档推荐学习交精品好文档,推荐学习交流 仅供学习与交流,如有侵权请联系网站删除 谢谢6 friends when they are in trouble because a friend in need is a friend indeed.That way youll have a bigger group to choose from and have more chances to make friends.2.My View on Television Television has been in our life for man

20、y years.We cant live happily without television.It can give us the latest information and news.It can open up our eyes and enlarge our knowledge.We can get happiness from the plays on television.Well be bored all day if there is no television.Television programs are attractive.After a whole days har

21、d work,we can sit before the television and drink a cup of tea.How wonderful it is!Television is also bad for peoples health.Its not good for you to watch TV for too long,especially bad for your eyes.It is true that watching TV can influence our behavior and achievement.However,it depends on what we

22、 do.3.Talk about Internet Today,Ill talk about going online.We know that there are too many net-bars(网吧)around us.The Internet can make our lives interesting and enjoyable.Many of us like going online very much because we can learn how to use the computer and get more information from the Internet.W

23、e can learn English.We can read some good newspapers and magazines.It can make us clever 除谢谢精品好文档推荐学习交流隐藏显示鼠标将鼠标锁定在你的里不过你得将你的先锁了就失效了鼠标失效不过失效 型本计算机尚未安装鼠标键滚轮鼠标键鼠标设置鼠标双击时间设置鼠标默认主键仅供学习与交流如有侵权请联系网站 材的参考句型下划线词组短语黑体精美句子方框仅供学习与交流如有侵权请联系网站删除谢谢精品好文档推荐学习交精品好文档,推荐学习交流 仅供学习与交流,如有侵权请联系网站删除 谢谢7 through playing computer games.I can send e-mails to our friends quickly.We can chat online with our friends.It can help us get in touch with(取得联系)除谢谢精品好文档推荐学习交流隐藏显示鼠标将鼠标锁定在你的里不过你得将你的先锁了就失效了鼠标失效不过失效 型本计算机尚未安装鼠标键滚轮鼠标键鼠标设置鼠标双击时间设置鼠标默认主键仅供学习与交流如有侵权请联系网站 材的参考句型下划线词组短语黑体精美句子方框仅供学习与交流如有侵权请联系网站删除谢谢精品好文档推荐学习交

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁