Maximize form on Display2

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Does anyone know a simple way to have a program start with the main
form maximized on Display2?
 
Does anyone know a simple way to have a program start with the main
form maximized on Display2?

Assuming Display2 shows up as Screen.AllScreens(1) add this to a
module:

Public Sub Main()
Application.EnableVisualStyles()

Dim f As New MainForm()

f.StartPosition = FormStartPosition.Manual

' You'll want to do some checking/error handling here to
' prevent an IndexOutOfRangeException from occuring

f.Top = Screen.AllScreens(1).WorkingArea.Y
f.Left = Screen.AllScreens(1).WorkingArea.X

f.WindowState = FormWindowState.Maximized

f.ShowDialog()
End Sub

Doing this requires you turn off the ApplicationFramework and select
Sub Main as the starting point.

Thanks,

Seth Rowe
 
Thanks for the reply, but actually I found Screen.AllScreens() just
after posting the question (Guess I should've looked a little harder,
eh?). Then I did a For...Each loop to get the working area of each
screen.

Works great. Thanks again.
 
Back
Top