Solved

Is there an easy way to resize forms?

Posted on 2003-11-19
10
489 Views
Last Modified: 2010-04-16
Is there an easier way to resize forms than changing all the controls locations and sizes by hand?  I have many forms and I would like to be able to resize, but all of these forms have many controls on them.  It seems like there might be an easier solution than modifying all the sizes/locations manually based on the new window size.  
0
Comment
Question by:jjacksn
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 1

Expert Comment

by:AJMartin
ID: 9777298
> Is there an easier way to resize forms than changing all the controls locations and sizes by hand?

Yes. :)

Use an automatic layout manager. I use this free one from here:
http://9mm.com/~ogl/packnet/
and found it to be quite good. One does need to do a bit of work on one's objects though to specify minimum sizes for objects on the form.

There are other layout managers, including one on SourceForge, but I haven't used them. You could try experimenting with them if the above layout manager doesn't suit you.
0
 
LVL 1

Expert Comment

by:AJMartin
ID: 9777302
The SourceForge Layout Manager:
http://sourceforge.net/projects/dotnetlayout/
0
 
LVL 6

Expert Comment

by:DaniPro
ID: 9777450
If you set correctly the Anchor propery drawing the form at smallest size the resize of form work fine
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9777953
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9781141
DaniPro, if I specify the anchor, the resizing does not expand any of the controls



0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Assisted Solution

by:DaniPro
DaniPro earned 100 total points
ID: 9785325
But if you Anchor a control to Top, Left, Right, Bottom, it will be resized....
Plese, give me an example of your problem
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9801929
My Anchored controls do not resize... please explain what you mean?  

If I have a RichTextBox in a form, and it is anchored topleft, when I resive the form, the text box does not grow accordingly.
0
 
LVL 1

Accepted Solution

by:
AJMartin earned 150 total points
ID: 9802024
What DaniPro is trying to explain is that your RichTextBox can be Anchor-ed like this:
MyRichTextBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left);
And then when the form is resized, the RichTextBox will change size roughly proportionally to the form.
I hope that helps!
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9835566
oh, ok.  that sounds good.  If I anchor things inside of a panel, and anchor the panel, would that also happen correctly?  Also, can I do that in the designer, or only programmatically?
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9835580
Nevermind, the designer was a stupid question.

thanks, that should work.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now