Link to home
Start Free TrialLog in
Avatar of Larry Biederman
Larry BiedermanFlag for United States of America

asked on

proportional resizing a window in vb.net

Experts,

I am trying to allow users of a vb.net 2013 app to resize a window, runtime.
In past Infragistics had a 'resizer' object for VB6, that could be dropped on window, allowing user to drag bottom right corner of window, and all objects proportionally resized with window.

VB.net 2013 has the "containerControl class", but I cant find sample code.
A third party object would also be acceptable, if simpler and works well.

Purpose is to Accommodate  different monitor sizes.

Any suggestions appreciated !

-Larry
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Resizing is built into the Windows Forms. You control it through the Anchor property of each individual control.

You use it of fix the distance of some of the borders of the control with the equivalent border of the screen.

The default if Top-Left, meaning that the distance between the top of the control and the top of the control, as well as the distance between the left of the control and the left of the form does not change. The control does stay put in relation to the top and the left. It does not move when you enlarge or reduce the form.

If you set the Anchor to Bottom-Right, it stays put the lower right corner of the form and follows it when you enlarge the form.

Left-Rigt gives you a Control that enlarge horizontally, but not vertically. Top-Bottom is the reverse.

If you set all the 4 anchors, the control always keeps the same margins all around, so it enlarges as the form does.

If you set only the Right anchor, the control will follow the right border when you enlarge, but keeps its relative position vertically. If it's 1/3 down, it will stay 1/3 down relative to the new height.

And so on.

On a complex form, controls might easily overlap each other when resizing. You can control that by putting the controls into Panel controls or other containers. The Anchor is then relative to the container instead of relative to the form.

The MaximumSize and MinimumSize of the form can be set to prevent the user from overdoing the resizing and render the form useless.
SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi James. I'm totally agree, but.
Did you see any VB6 resizer (including Infragistics one)? All them resized fonts as well. I just added those 2 cents in case TS need this future too.
Avatar of Larry Biederman

ASKER

Art and James,

I haven't had success with the anchors. Using a sizable border on forms, it still does not perform well.

1- Yes the resizer was part of Data Widgets 3.1 from infragistics (which was Sheridan befre Infragistics took over).

2- What about the containercontrol class methods built into vb.net?
http://msdn.microsoft.com/en-us/library/system.windows.forms.containercontrol(v=vs.110).aspx

Thanks fellows,
Larry
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Fellows,
Thanks for the new, expert info.  I will try this soon.
I Will be away a few days.

Will test and award points in few days.

Thanks so much, Larry
Experts,
I'm Back at work.  Will check this out this week.

Thanks for patience, Lbiederman
Ive tried anchors in all four corners in this app.
Its in VB.net 2013.
I put anchors on four corners of the panel on the form.  Form is resizable.
Try it.  Nothing resizes at all.

Experts Exchange disallows the upload, So I have it on this link:

test1.zip (466.6 KB) =>

https://files.secureserver.net/0s91Kxaq0i9mdw

Ideas??
Thanks, LBiederman
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks JamesBurger,

That was just a demo form I created for you, as Experts-Exchange blocks many files in VB.net projects.

I know excel etc. do not resize.  BUT.. IE browser does!!!
Try this:
Minimize IE. Then expand it to half screen.  Now drag bottom right corner.
It minimizes about 20% then portions begin  to hide.
If you resize bottom center up, it does not resize.

How is that done?
If I could do same as Internet explorer does, It would suffice.

Can you look at it, and advise?
Thanks so much Jim,

Larry
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Lots of good information, just no good solution exists out there, apparently.

Your education and code samples much appreciated !!

LBiederman
http://www.lyoung.com/ does what you need.
Thanks JamesBurger,
If tried this before, but you have given al little more info.
Will play with it this week.

Thanks,
LarryBiederman
i have one small app that needs to display fair auction bid results on  multiple tvs and monitors . this control scales everything to maximum size of tvs where i to not have to worry about resolutions.