简体   繁体   中英

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!

Yes, use Screen.FromControl(Me) .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM