Click here to Skip to main content
15,894,955 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
my windows form is proper working at 17 inch screen but at lower size screens it do not fits i want to know that how it will be fit on all size of screens
Posted

I'll add a few thoughts, based on experience, to the wise thoughts, and insights, of OriginalGriff, and George Jonsson.

1. what you could do if the situation/job/client/user really demanded it is prepare a few different Forms ... all with the same Controls ... designed to look good at screen ratios like 16:9, 16:10, 3:2, etc. You would then (in WinForms) modify the Program.cs file, perhaps launching an Application.Context rather than the usual ... Run(Form1) ...

Then in the pre-start-up code you could get the PrimaryScreenSize, etc. and decide which Form(s) to use.

Of course, you then have to do the right thing that "routes" events properly, that calls methods in a way that's not "locked-in" to any one specific Form, that uses the "current Form," etc. Some work involved, there.

2. you can, through careful planning and use of Panels and other ContainerControls, and use of the Anchor and Dock properties (as well as Margin and Padding), usually get a Form looking pretty good when it is resized within a certain range.
 
Share this answer
 
Comments
George Jonsson 21-Dec-14 11:07am    
Good suggestions.
In Winforms? Pretty much, you can't.
The problem is that although you can rescale items to fit in a smaller space, and you can find out what size the screen is (most of the time) automatically changing it doesn't really work too well - although you can change the size of most controls fairly simply, it doesn't automatically alter font sizes - and that means you end you with larger buttons with tiny, unreadable writing.

To be honest, I've seen people try to adopt to a lower resolution and that worked really badly - but I've never seen anyone try to adapt to a smaller screen size - and I suspect that would work even worse!
I'd leave it: if the user is trying to run on a sub-17" screen, then he will probably be used to not being able to read any details anyway...
 
Share this answer
 
One thing you could try is to make the form scrollable.
In that way the user can at least fit the form inside the screen and then scroll to different parts of the form.
The most important controls in the form should be placed so they are visible even on a smaller screen.

Another way is to separate the functions in the form with a TabControl. By doing this you can make your form smaller.
If this is a possible approach or not, depends on the layout of your form.

Neither of these solutions are really perfect, but maybe it can be acceptable for you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900