Click here to Skip to main content
15,119,285 members
Please Sign up or sign in to vote.
2.50/5 (3 votes)
See more:
can any one tell me how to make windows form responsive in c# windows form application.
like all form looks similar in all computer and laptop.
actually when i runs form in diffrent device it looks bad label goes right and all that.

so please help me
thank you.
Posted
Updated 18-Apr-19 13:08pm
v2
Comments
Mitchell J. 16-Mar-14 2:58am
   
Can you post a sample of the code that, while running, makes the form unresponsive?
People can then have a look to see how you can fix your code.
Abhinav Gauniyal 16-Mar-14 14:15pm
   
Might meant responsive as screen adaptive!

By careful use of the 'Anchor and 'Dock properties of Controls on a Windows Form, you can achieve proper placement of Controls as the perceived visual size of the Form changes as it is displayed on different resolution, and form-factor, screens.

Windows Forms is really a bad choice if you want visual elements, like Fonts, to actually scale; as Abhinav S recommends, WPF is a much better choice for that.

While I have written an experimental UI that scales all its Controls, including their Fonts, automatically in Windows Forms, the result was not satisfactory, and I have never seen any Win Forms based solution that enabled smooth scaling across any size factor.
   
Responsive form is a different thing.
I think in your case, you are looking for a scenario where the same form can work on different resolution screens.

You can scale controls to some extent - Automatic Scaling in Windows Forms[^].
However, in general, Windows Forms is not good in terms of working with different resolutions. WPF is better.
   
Comments
Abhinav Gauniyal 16-Mar-14 14:15pm
   
WPF applications are resolution independent!
ketan Ram Patil 21-Aug-17 0:39am
   
How to make responsive design in wpf vb ?
lmoelleb 28-Mar-19 6:08am
   
https://docs.microsoft.com/en-us/windows/uwp/design/layout/layouts-with-xaml - it was not exactly hard to google.

This is XAML where the view is defined, so doesn't matter if you use VB or C#. There is one peace of C# example code, but it is very simple - just checking the window width and calling a method.
WPF is much better if you want to make it responsive.
I mean yeah, you can go for Anchoring and Docking Properties[^] of the controls, but there you need to place all the controls in proper manner. (must be tedious ;)).

Go for WPF.

-KR
   
Comments
ketan Ram Patil 19-Aug-17 8:09am
   
How to make responsive design in wpf vb ?
Use TableLayoutPanel
   
v2
Comments
Richard Deeming 7-Dec-18 12:02pm
   
How is a JAVA control going to help in a WINDOWS FORMS application?

Perhaps you meant the TableLayoutPanel?
Member 13312004 27-Mar-19 23:43pm
   
Yes, what I meant is TableLayoutPanel

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