vb.net 确定屏幕

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15963552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 13:14:01  来源:igfitidea点击:

vb.net determine Screen

vb.netwinformsscreen

提问by Markus

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!

放置表格。当用户将表单重新定位到另一个屏幕上时,我想保存那个新屏幕的位置!

回答by Blorgbeard is out

Yes, use Screen.FromControl(Me).

是的,使用Screen.FromControl(Me).

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

检索包含指定控件的最大部分的显示器的屏幕。