Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

How i can change the max size of form in windows application.
In my application several control are there , they are not fix by default max size of
forms. I want to increase especially length of the form..

is it possible, if possible how??

Thanks & Regards
Honey4U
Posted
Updated 24-Oct-11 19:29pm
v2
Comments
Sergey Alexandrovich Kryukov 24-Oct-11 19:28pm    
What is "Length of the form"? :-)
--SA
honey4bee 25-Oct-11 1:13am    
means Height...

the form has a property named max length
 
Share this answer
 
Comments
honey4bee 24-Oct-11 10:43am    
in the property if i gave length 1000 px it wont taken, it takes 780 (default max size)...
R u Understand my question?
Sergey Alexandrovich Kryukov 24-Oct-11 19:26pm    
Not Length, MaximumSize.Width, MaximumSize.Height.
--SA
honey4bee 25-Oct-11 1:13am    
ya.. length means height only..
i want to increase the height of a form,
Is it possible to set 1000 px for height?
if i keep, it will take 780 px only..
To clarify this question, and help you, we need to know:

1. your screen resolution.

2. why you are not focusing on re-sizing the controls to fit your available screen space by using properties such as 'Anchor and 'Dock

The observation that setting the size (and/or maximum size) property of a WinForm larger than the current screen resolution will be ignored, and the current screen size available will be used is correct. This "auto-limit" of Form size will take place both at Design-Time ... and at Run-Time, if you set the Size in code.

OriginalGriff has pointed out to you that one way to get more pixels is to change your screen resolution to a higher resolution.

But do keep in mind that you can create objects inside Forms that are larger than the maximum Form size, or screen size.

For example, my maximum screen-size right now is about 1300x788, but I can create a Panel 3000x2000, add it to a WinForm, make sure it has no Anchor or Dock property set that will bind it to the Form boundaries; I can position this giant Panel partially or fully off the screen.

And I can write code to click and drag that panel around so that the Form is functioning as a "viewport" on that Panel.

... edit #1 ... you can do the same thing with a UserControl:
UserControl1 uc1 = new UserControl1();
uc1.Dock = DockStyle.None;
uc1.Anchor = AnchorStyles.None;
uc1.MaximumSize = new Size(1500, 1200);
uc1.MinimumSize = new Size(1500, 1200);
uc1.Size = new Size(1500, 1200);
uc1.Location = new Point(-1000, -900);
this.Controls.Add(uc1);
uc1.Show();
Whether Panels or UserControls would meet your needs in this scenario: I don't know.

In any case it would be good to know more about these controls of yours that are "too big:" what are they : can they be put in some container that will let you scroll them ? And so forth.
 
Share this answer
 
v3
Comments
honey4bee 25-Oct-11 1:24am    
my max screen resolution is 1024*768,
BillWoodruff 25-Oct-11 1:59am    
Then as long as you use that screen resolution: you will never have a Form larger than that using the Windows Forms environment. (some hacker is probably writing a WndProc to prove this is wrong as I write this :)
You need to assign new value to System.Windows.Forms.Form.MaximumSize. Not Size, Width or Height.

—SA
 
Share this answer
 
Comments
BillWoodruff 25-Oct-11 0:13am    
Sorry, SAK, but ... as noted above: while you can indeed specify a Form.MaximumSize larger than the screen resolution, and the Property Browser will not alter that setting: at Design-Time: if you set the Size property in the Property Browser to larger than screen-resolution: you'll note the Size value displayed "snaps back" to screen resolution.

And, as I commented above, if you try and set the Form Size at run-time ... say in the Form Load function ... larger than screen resolution: an error is not thrown, but the screen size will not exceed screen resolution.

I actually test these answers before I post them :)

best, Bill
Either just hover your mouse over the bottom of the form in the designer, and when it changes shape to a double headed arrow stretch the form to the desired height, or change the Height of the Form directly via the Property pane (it's part of Size, along with Width) You can also set the Size directly from your Form constructor if you need to.
 
Share this answer
 
Comments
honey4bee 24-Oct-11 10:35am    
max size of length in windows is 780 px,
but in my app i need to set the length size 1000px,
if i set this form automatically takes the default max size 780..
This is my problem....if u know ans this
OriginalGriff 24-Oct-11 10:48am    
Since when? Mine grows to 1062 without problems - I think you will find that your current monitor resolution is 1024*768 and that this is what is limiting the growth. Try upping your screen resolution, and try again.
honey4bee 25-Oct-11 1:19am    
if i keep resolution 600*800 it will take uptp
612 only..
how i can set height 1000px..
you can change the window stte property to maximized.
after that whenever you open the form that size is maximum as your sereen or os
 
Share this answer
 
Comments
honey4bee 25-Oct-11 1:28am    
i want to set height =1000 for my screen resolution 1024*768??
but it wont take....
Hey. In the event load you can add this:

VB.net
VB
Me.MaximumSize = New Size(0, 100) 'just to change to height maxium size
Me.MaximumSize = New Size(100, 0) 'just change the width maxium size
Me.MaximumSize = New Size(100, 100) 'change both


C#
C#
this.MaximumSize = new Size(0, 100);
//just to change to height maxium size
this.MaximumSize = new Size(100, 0);
//just change the width maxium size
	//change both
this.MaximumSize = new Size(100, 100);
 
Share this answer
 
Hey, instead of using a form, use User Control.
 
Share this answer
 
Hey, instead of using a form which has a limited size. Use a user control

go to solution explorer >> and new item
choose User Control

Load your User Control to a panel.

Private Sub frmUpdateEmployee_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim usrCntl As New frmUpdateEmployeeData
Me.Panel1.Controls.Add(usrCntl)
usrCntl.Show()
Panel1.AutoScroll = True
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900