Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vb.net determine Screen

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!

like image 584
Markus Avatar asked Apr 12 '13 05:04

Markus


1 Answers

Yes, use Screen.FromControl(Me).

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

like image 152
Blorgbeard Avatar answered Nov 15 '22 03:11

Blorgbeard