Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

Resizing a form to shrink or grow according to the controls that are added

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
illegal.prime@gmail.com - 06 Jul 2006 04:38 GMT
Hi all, I realize this should be obvious, but I don't know what I'm not
doing.  I have a form to which I add a variable number of controls.
All I need the form to do is to shrink or grow according to the size of
the controls added.

I suppose I could manually calculate the dimensions that the controls
occupy and then manually set the Form's dimensions.  But there has to
be a more automatic way - I thought the AutoScale property being true
would handle this, but I think that only scales the controls as the
Form is resized - not vice-versa.

Thanks for any suggestions,
Novice
illegal.prime@gmail.com - 06 Jul 2006 04:45 GMT
Correction - I am adding the controls to a panel that is docked to the
top of the form.

Novice

> Hi all, I realize this should be obvious, but I don't know what I'm not
> doing.  I have a form to which I add a variable number of controls.
[quoted text clipped - 9 lines]
> Thanks for any suggestions,
> Novice
illegal.prime@gmail.com - 06 Jul 2006 04:55 GMT
So right now, I have it working by adding up the control sizes and
setting the form size accordingly.  This will suffice for now - until I
get a better suggestion.

One other thing I notice is that there are three striped diagnol lines
in the bottom right hand corner - indicating the user can resize the
form.  I don't want to allow that - how can I both make the form
non-resizeable and remove those diagnol lines.

Thanks again,
Novice

illegal.pr...@gmail.com wrote:
> Correction - I am adding the controls to a panel that is docked to the
> top of the form.
[quoted text clipped - 14 lines]
> > Thanks for any suggestions,
> > Novice
illegal.prime@gmail.com - 06 Jul 2006 04:58 GMT
Ah - I can just set the FormBorderStyle to FixedDialog.

Now if anyone has a better suggestion for the form resizing I would be
thankful.  I seem to remember there is a ShrinkToFit property or
something like that.  The code currently works, but no sense in
inventing my own way of doing something when it is already done and
more importantly in a standard way.

Thanks,
Novice

illegal.pr...@gmail.com wrote:
> So right now, I have it working by adding up the control sizes and
> setting the form size accordingly.  This will suffice for now - until I
[quoted text clipped - 27 lines]
> > > Thanks for any suggestions,
> > > Novice

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.