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 / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

controlling aspect ratio - same as Java  on a form resize? (not im

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rich - 11 Jun 2007 17:28 GMT
Hello,

If I create a form in Java with controls like Panels, textboxes... when I
stretch/shrink the form, all the controls can grow/shrink - along with the
text contained in the textboxes.  This is convenient for resizing a form for
different screen resolutions.  

I can't see how to do this /control this in .Net (VS2005).  I have a user
that uses 800x600 resolution, and my apps appear very large on this user's
workstation.  How can I control the aspect ration besides creating a smaller
scale app (which is what I ended up doing - real small on my workstation but
perfect on the user's workstation).  Or besides physically writing a bunch of
code that resizes each control?

Thanks,
Rich
Michael A. Covington - 11 Jun 2007 23:17 GMT
> Hello,
>
[quoted text clipped - 16 lines]
> Thanks,
> Rich
Michael A. Covington - 11 Jun 2007 23:18 GMT
I believe .NET 3.0 provides a neat way to do this.  In 2.0 and below, the
only way I've ever done it has been to handle the Resize event and compute
new sizes for everything.

> Hello,
>
[quoted text clipped - 16 lines]
> Thanks,
> Rich
Peter Duniho - 12 Jun 2007 01:19 GMT
> If I create a form in Java with controls like Panels, textboxes... when I
> stretch/shrink the form, all the controls can grow/shrink - along with  
> the
> text contained in the textboxes.  This is convenient for resizing a form  
> for
> different screen resolutions.

A suggestion:

You are misusing the term "aspect ratio", which describes the ratio  
between the width and the height, using it instead to simply describe  
scaling of the window.

It is true that if you can accomplish the scaling, you will also likely  
want to control the aspect ratio.  But it appears from your question that  
your primary concern is to control the scaling.

You will get better responses if you use the right terminology in your  
question, since if you are using the wrong terminology, some people who  
might know the answer to your question may just skip over your post  
thinking they don't.

As far as your specific question goes, I don't know the answer off the top  
of my head.  You can accomplish _part_ of what you're asking about by  
using the various the anchoring properties in the controls on your form.  
I suppose you could combine that with some code in the Resize event that  
changes the font size for the form as a function of the size relative to  
the original size, but I've never tried this myself.  My recollection is  
that you can have the child controls inherit the parent's font, but if I'm  
wrong about that you can easily enumerate all the children and set their  
font explicitly.

And as I alluded to, if you do all that you may also want to include code  
in the Resize event that restricts the new size to one with an aspect  
ratio that is identical to the original aspect ratio.

Pete
Rich - 12 Jun 2007 18:43 GMT
Thank you all for your replies.  

Yes, "Scaling / Aspect Ration" I think is what I was trying to ask about.  
Anyway, it seems easier (for now) to do what I have been doing - having 2
different sizes of the same app.  The only hassel is that whatever I do to
one app I have to do to the other app.

I guess I will do the lazy thing and wait for .Net 3.0 to come out in full
bloom.  Will VS2005 work with .Net 3.0?  

> Hello,
>
[quoted text clipped - 12 lines]
> Thanks,
> Rich
Arne Vajhøj - 17 Jun 2007 00:26 GMT
> I guess I will do the lazy thing and wait for .Net 3.0 to come out in full
> bloom.  Will VS2005 work with .Net 3.0?  

Does it have an option to choose .NET version ?

Arne

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.