Setting a form's location and size
-
Is it possible to set a form's location and size before displaying it? I have a couple of resizable forms in my current project. I'd like to have the app remember the size and location of the forms when the user last closed them.
-
Is it possible to set a form's location and size before displaying it? I have a couple of resizable forms in my current project. I'd like to have the app remember the size and location of the forms when the user last closed them.
I'll leave the part about saving and retrieving the values up to you since there are so many methods of saving these values somewhere... You can set the Size, Location and StartPosition properties of the form before you call the form's Show or ShowDialog method:
Dim newForm As New Form2
newForm.Size = New Size(100, 200)
newForm.StartPosition = FormStartPosition.Manual
newForm.Location = New Point(50, 50)
newForm.Show()RageInTheMachine9532
-
I'll leave the part about saving and retrieving the values up to you since there are so many methods of saving these values somewhere... You can set the Size, Location and StartPosition properties of the form before you call the form's Show or ShowDialog method:
Dim newForm As New Form2
newForm.Size = New Size(100, 200)
newForm.StartPosition = FormStartPosition.Manual
newForm.Location = New Point(50, 50)
newForm.Show()RageInTheMachine9532
Perfect. And by inserting the middle three lines into the Load event, and changing 'newForm' to 'Me', I've managed to change the main form as well. Don't worry about the saving - I've got that bit sorted out. Thanks for your help.