获得在C#中的鼠标位置 [英] Getting mouse position in c#
本文介绍了获得在C#中的鼠标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何获得鼠标的位置?我希望它在屏幕上的位置任期。
How do I get the mouse position? I want it in term of screen position.
我开始我的节目,我要设置为当前鼠标的位置。
I start my program I want to set to the current mouse position.
Location.X = ??
Location.Y = ??
编辑:创建表单之前这必须发生
This must happen before the form is created.
推荐答案
您应该使用<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx\">System.Windows.Forms.Cursor.Position: 这再$ P $ A点psents光标在屏幕坐标位置。
You should use System.Windows.Forms.Cursor.Position: "A Point that represents the cursor's position in screen coordinates."
这篇关于获得在C#中的鼠标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文