‘?? ”’ <summary>多屏显示屏幕设置</summary>
‘?? ”’ <param name=”obj”>目标窗体</param>
‘?? ”’ <param name=”scrIndex”>由0开始的屏幕索引,0为主屏幕</param>
Function ShowScreens(obj As Form, scrIndex As Integer)
Dim arr As Screen() = Screen.AllScreens
If scrIndex < arr.Length Then
obj.Width = arr(scrIndex).Bounds.Width
obj.Height = arr(scrIndex).Bounds.Height
obj.Left = arr(scrIndex).Bounds.X
obj.Top = 0
Else
Dim mess As String = “当前屏幕索引超出范围,是否要显示在最后一个屏幕?”
Dim result As DialogResult =
MessageBox.Show(mess, “信息提示”,
MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
If result = Windows.Forms.DialogResult.Yes Then
obj.Width = arr(scrIndex).Bounds.Width
obj.Height = arr(scrIndex).Bounds.Height
obj.Left = arr(arr.Length – 1).Bounds.X
obj.Top = 0
End If
End If
End Function
VB.NET 多屏显示
最新推荐文章于 2021-09-09 18:16:27 发布