vb.net determine Screen

坚强是说给别人听的谎言 提交于 2020-01-03 16:51:16

问题


Is it possible to determine the screen where a form is located? Not the position or the Size!

I used

Dim myScreens() As Screen = Screen.AllScreens

Me.Left = (myScreens(0).WorkingArea.Width - Me.Size.Width) / 2
Me.Top = (myScreens(0).WorkingArea.Height - Me.Size.Height) / 2

to postion the Form. When the user relocates the form onto another screen, I want to save that postion of that new screen!


回答1:


Yes, use Screen.FromControl(Me).

Retrieves a Screen for the display that contains the largest portion of the specified control.



来源:https://stackoverflow.com/questions/15963552/vb-net-determine-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!