Ability of users to resize Winforms in application runtime


Author
Message
William Fields
William Fields
StrataFrame User (252 reputation)StrataFrame User (252 reputation)StrataFrame User (252 reputation)StrataFrame User (252 reputation)StrataFrame User (252 reputation)StrataFrame User (252 reputation)StrataFrame User (252 reputation)StrataFrame User (252 reputation)StrataFrame User (252 reputation)
Group: StrataFrame Users
Posts: 80, Visits: 239
Hello Greg,

I'm in the same boat as many developers, my users want the ability to resize AND zoom forms/controls. I've seen a few WPF samples, and that's exactly what I'm looking for. But SF does not support WPF. Are there any plans to incorporate zooming capabilities in the SF framework, or has SF decided when WPF support will be incorporated into the framework?

Alternately, can anyone recommend the Fengari Software WinFormResizer product? It seems like a small price to pay for zooming capabilities.

Thanks.
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You're only other option, Curt would be to move to WPF programming... since WPF forms can scale any size since they are all vector based.  However, there's not really any way to program in WPF right now except to write the XML code manually because the forms designers won't be available until the next version of Visual Studio.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Curt,



I took a look at the sight you indicated and you are correct, .NET doesn't support this sort of thing out of the box. What you want is for the size of the controls, fonts, graphics to proportionally resize as the form resizes. I.e. this is more of an accessibility issue. Someone with bad eye sight wants the form to be bigger, so they can see it more clearly, thus they want the buttons to be bigger, the fonts to increase...the information displayed is the same, just bigger.



.NET handles two other issues out of the box:



- resizing controls as the form resizes. This is what we've talked about in this post. The font and graphic size are constant, so resizing means that more or less info is visible. This behaves just like windows explorer does when resized. Make the form bigger, you see more file/folders. Make is smaller, you see fewer.



- scaling forms based on desktop resolution. .Net can handle resizing fonts, controls if the user changes their screen resolution. I.e. they change from 96 to 120 dpi, the fonts, controls get bigger.



So, you are either looking at a lot of work, or purchasing a solution such as the one you posted a link to. Sorry Ermm
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
If you cannot resize the form itself, then the property you need to change on the form is the FormBorderStyle property. 

However, if you can resize the form, but the controls just stay in the same place, then there are a couple things you should look at adjusting.  The first is the Dock property on a control.  This is helpful to have a child completely fill to the entire parent size (fill) or to the top, right, bottom, or left of the parent control.  When the parent resizes, then the control resizes as well.  Docking is really only useful for panels and splitter containers and such.  The next property that you need to look into is the Anchor property.  Unlike Dock, the Anchor is bitwise, meaning that a control can be anchored to both the top and left, or the top, left and right, or just the left (or any combination of top, right, bottom, left).  What the Anchor does is keep the edge of the control at the same distance from the edge of the parent no matter what.  By default, everything is anchored to the top and left, so when you resize, they all stay put, (because the origin (0,0) is at the top left, so the controls always stay the same distance from it).  So, if you take a textbox and anchor it to the top, right and left, then when you change the width of the form, the right side of the textbox will stay the same distance from the right side of the form (same as the left side does); this will cause the textbox to resize.  Anchoring on all 4 sides will cause the control to resize it's height as well.

Open up the VS help and search for Dock and Anchor.  They're properties that exist on all controls and will definitely get you going.

Curt Cadwell
Curt Cadwell
StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)
Group: Forum Members
Posts: 2, Visits: 9
Maybe I'm missing something but let me explain. I add new item and select SF Maintenance Form which creates an empty maint form and add a bunch of SF text boxes to the form. I have tried and tried and can't seem to get your suggestions to work. I want the user to be able to automatically increase size of the form and all the controls on the screen would reformat and become larger or smaller depending how the user sizes the form.

I Goggled "Winform" and "controls" and I found a few sites that are selling controls to do this http://www.fengarisoftware.com/Default.aspx?tabid=105 if you take a look at the example that is what I want.

I have that now in the VFP Framework called VMP and that capability is just a part of the framework I took it for granted. I just drop controls text boxes,containers, whatever and at runtime they all automatically grow or shrink depending on how the user sizes the form. 

Am I still missing something? 

Curt Cadwell

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Curt,

Greg has given you a good starting point.  Form and control sizing is a very basic function of the .NET framework and actually requires no additional enhancements in order to be totally usable within your application.

Start by creating a new form and changing the FormBorderStyle property to Sizable.  Next, drop a text box on the form.  Select the text box and go to the anchor property.  Using the visual type editor, select the left,top, and right locations.  Run the application and size the form.  You will see that the text box sizes along with the form.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The form is made resizable using the FormBorderStyle property. Then to handle how controls on the form are resized/moved, you'd use the Anchor or Fill properties.



Just be aware that if a control is inside of a container, like a panel, split container, tab or a toolstripcontainer, you need to configure the container using the anchor or fill properties. I.e. if you set the FormBorderStyle to Sizable, and the anchor property of a multi-line textbox that is on a tab page to Left,Right,Top,Bottom, but don't also set the anchor property of the tab to left,right,top,bottom, the tab page won't resize and thus the textbox won't resize.



Create a sample form and play around with it, it's pretty neat BigGrin
Curt Cadwell
Curt Cadwell
StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)
Group: Forum Members
Posts: 2, Visits: 9
Ok I'm VFP developer and have been developing in VMP framework yeah I know it's about time I get off the fence and start developing in .NET.

Well running the sample apps in Stataframe I haven't seen a way to resize the forms. I did look at the properties autoresize and anchor but noticed the .NET help say's it doesn't work on all the .NET controls and it lists the ones that don't work. My question is if VMP framework can do it in VFP surely .NET and Strataframe can?

I'm a Newbe so be gentle...

Thanks so much

Curt Cadwell

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search