Soldato
- Joined
- 20 Jan 2005
- Posts
- 2,722
- Location
- Whitley Bay
Hi there,
I'm trying to find a way of changing the startup location of a form depending on the screen resolution of the primary monitor.
By default the startup position is set to manual with a location of (0, 0).
As the form size is optomised for 1024x768 I want to centre the form if the screen width is greater than 1024.
I've got something along the lines of:
Dim screenWidth As Integer = My.Computer.Screen.Bounds.Width
If screenWidth > "1024" Then
Main.StartPosition = FormStartPosition.CenterScreen
Main.Show()
End If
It isn't changing the location unfortunately.
I'm probably overlooking something simple but any help would be appreciated!
Thanks
Si

I'm trying to find a way of changing the startup location of a form depending on the screen resolution of the primary monitor.
By default the startup position is set to manual with a location of (0, 0).
As the form size is optomised for 1024x768 I want to centre the form if the screen width is greater than 1024.
I've got something along the lines of:
Dim screenWidth As Integer = My.Computer.Screen.Bounds.Width
If screenWidth > "1024" Then
Main.StartPosition = FormStartPosition.CenterScreen
Main.Show()
End If
It isn't changing the location unfortunately.
I'm probably overlooking something simple but any help would be appreciated!
Thanks
Si
