[RESOLVED] Resize form to a specific height
Good afternoon everyone,
I am working on a new program and need a little guidance. What I am wanting to do is setup a form to act like a control panel. When it loads I do not want it to be more than 94px in height but when the maximize button is pressed I would like it to expand the width of the screen.
I was thinking I could do this with an "onload" event in the main form but not sure how to do it. Anyone have any idea's or suggestions that may be of help?
Thanks for any suggestions or assistance :D
Re: Resize for to a specific height
I typed this quickly and didn't tested well:
vb.net Code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Height = 94
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
Me.Location = New Point(0, Screen.PrimaryScreen.WorkingArea.Height - Me.Height)
Me.Width = Screen.PrimaryScreen.WorkingArea.Width
End If
End Sub
:wave:
Re: Resize for to a specific height
Thanks for the reply. Gave it a try and didn't work. Still fills the screen when I press the maximize button.
Re: Resize form to a specific height
Hi.
Its simple enough, on the designer view of your form, set the "MaximumSize" property to whatever width you want and set the height to 94.
The only thing is that if you maximize, the window will stay the same size, but itll move to the top of the screen as with all windows you maximize.
Re: Resize form to a specific height
Quote:
Originally Posted by
Zeth643
Hi.
Its simple enough, on the designer view of your form, set the "MaximumSize" property to whatever width you want and set the height to 94.
The only thing is that if you maximize, the window will stay the same size, but itll move to the top of the screen as with all windows you maximize.
That worked pretty good Zeth :) . Will use it that way for now, since this is a major first time for me with something like this lol.
Many thanks!