[英]vb.NET Screen Location
I'm working with a multi monitor setup. 我正在使用多显示器设置。 I know that you can do Screen.AllScreens(x) to get a specific screen, but is there any way to identify which screen is in which position?
我知道您可以执行Screen.AllScreens(x)来获取特定的屏幕,但是有什么方法可以识别哪个屏幕在哪个位置?
IE IE浏览器
Screen 0 is on the right, screen 1 is on the left, screen 2 is in the middle 屏幕0在右侧,屏幕1在左侧,屏幕2在中间
I'm trying to position one form at the top left of each screen, and the only way i can think to do this is something like 我正在尝试在每个屏幕的左上方放置一种表单,而我能想到的唯一方法是
Me.Location = New Point(-Screen.AllScreens(1).Bounds.Width, Screen.AllScreens(1).Bounds.Top)
(That is assuming that screen 1 is on the left) (假设屏幕1在左侧)
Any help? 有什么帮助吗?
Wrapping it in some sort of a loop that would autogenerate the forms for each screen would be amazing too, but i can handle that myself. 将其包装在可以自动为每个屏幕生成表单的某种循环中也将是惊人的,但是我可以自己处理。 I just need to know how to position each one at the top left of each screen..
我只需要知道如何将每个屏幕放置在每个屏幕的左上方即可。
Thanks :3 谢谢:3
As I mentioned on another site, if I'm understanding you correctly then something like this should do as you want: 就像我在另一个站点上提到的那样,如果我正确地理解了您,那么您应该可以执行以下操作:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim number = 1
For Each scr In Screen.AllScreens.OrderBy(Function(s) s.Bounds.Left)
Dim f As New Form With {.Text = number.ToString(),
.StartPosition = FormStartPosition.Manual,
.Location = scr.Bounds.Location}
f.Show()
number += 1
Next
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.