|
-
Oct 20th, 2011, 01:02 PM
#1
Thread Starter
New Member
[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
Last edited by TNDave; Oct 20th, 2011 at 01:15 PM.
Reason: Typos
-
Oct 20th, 2011, 01:16 PM
#2
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
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Oct 20th, 2011, 01:31 PM
#3
Thread Starter
New Member
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.
-
Oct 20th, 2011, 01:39 PM
#4
Junior Member
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.
-
Oct 20th, 2011, 01:49 PM
#5
Thread Starter
New Member
Re: Resize form to a specific height
 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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|