473,757 Members | 8,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3492

"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:A3******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co mwrote in message
news:A3******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co m>
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
3661
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
8417
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. In the sample code that follows, I have set the width and height of the <div> to be 75%, however the height of the height does not vary with the size of the content window. If it did vary, it probably wouldn't give the desired results because...
5
10146
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? couldn't quite figure it out. -- Ron Vecchi
5
3866
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
9457
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 ratio * Provide white (or other color) borders at the sides or the top/bottom The last point would be used to allow users to resize the panel to any ratio
2
19374
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 (height) x 780 (wide) So the "preferred size" would be 440 x 780
0
1695
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 the controls resize and text also resizes to keep the aspect ratio. In my current form (VB.Net 2005) when I stretch a form the controls which are docked will resize with the form, but the text stays the same size. Is there a way to make a...
3
14123
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 frame due to differnt aspect ratio. Some graphic designer suggests me to keep the aspect ratio of the original graphic and pad the graphic with empty space to fit into the frame. One example, the fixed frame is 100x60 and the image is 120x120, I...
3
4299
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 the edges (left, right, top, bottom) works just fine, but I'm running into a problem when I get to the corners. I'm using Camtasia's screen recorder as my reference. In that program, when you lock the aspect ratio and resize by the corners it...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.