请问如何获得屏幕的分辨率及相对于Winform的鼠标的坐标。

Jamestan 2005-07-29 12:23:21
RT,后面的问题别告诉我:Form.MousePosition.X,哪是相对于屏幕的鼠标位置。

先谢了
...全文
289 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jamestan 2005-07-29
  • 打赏
  • 举报
回复
多谢xyr提醒,System.Windows.Forms.MouseEventArgs e才对。
xyr 2005-07-29
  • 打赏
  • 举报
回复
直接用System.EventArgs e属性中的e.X和e.Y属性即可获得当前鼠标在当前窗体的坐标了!
mapserver 2005-07-29
  • 打赏
  • 举报
回复
Dim X As Short = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
Dim Y As Short = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
MsgBox("您的显示器分辨率是:" & X & " X " & Y)


http://dotnet.aspx.cc/ShowDetail.aspx?id=6977HLMY-ELPN-4KIR-BI89-7YS2LNENT5HR
saucer 2005-07-29
  • 打赏
  • 举报
回复
1. see

http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c84c.aspx#q1001q

18.2 How do I determine the screen resolution?

Use the System.Windows.Forms.Screen.PrimaryScreen.Bounds property.

2.

you can use Form's PointToScreen to convert it to the screen coordinates or PointToClient to convert back to the coordinates wrt to the form

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧