473,395 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
Jun 11 '07 #1
5 3462

"Rich" <Ri**@discussions.microsoft.comwrote in message
news:A3**********************************@microsof t.com...
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

Jun 11 '07 #2
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.

"Rich" <Ri**@discussions.microsoft.comwrote in message
news:A3**********************************@microsof t.com...
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

Jun 11 '07 #3
On Mon, 11 Jun 2007 09:28:06 -0700, Rich <Ri**@discussions.microsoft.com>
wrote:
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
Jun 12 '07 #4
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?
"Rich" wrote:
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
Jun 12 '07 #5
Rich wrote:
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
Jun 16 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ralph Freshour | last post by:
I'm trying to figure out how to write some php code that will allow me to resize a .jpg image and maintain it's aspect ratio - any help or idea's would be appreciated. Thanks...
7
by: Don G | last post by:
Is it possible to lock the aspect ratio of container using CSS? For example, have a <div> that is resized according to the size of the browser window, but remains square, regardless of it's size....
5
by: Ron Vecchi | last post by:
I know the math I need to perform on width and height to keep an aspect ratio but where and how would I implement keeping a set aspect ratio on a form when a user resizes it. Override OnResize?...
5
by: Arthur Hsu | last post by:
Hello, I have an ImageButton that refers to an external image. How can I keep that image's aspect ratio when I set the ImageButton's size to 120x120? TIA, Arthur
2
by: Carl Gilbert | last post by:
Hi I am looking for either a component or technique to allow me to do the following: * Provide a panel with a background image * Resize the image to best fit the panel to maintain aspect...
2
by: Farce Milverk | last post by:
Hi, I'm looking for an algorithm to resize an image of arbitrary size to a "fixed" / required width and height. For example, my application requires that images be no larger than 440 pixel...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, Is there a property or method or any code for controlling the aspect ratio of a form(s)? Example: In Java if you create a form with Panels... when you stretch/resize the form, all...
3
by: Danny Ni | last post by:
Hi, I am looking for a way to display images with different aspect ratio into frames with fixed width and height, the problem is some images will look distorted if they are forced into fixed...
3
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I'm overriding the WM_SIZE message so that I can lock my form into a specific aspect ratio. I'm allowing the user to turn on and off aspect ratio locking by toggling a checkbox. So far resizing by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.