Search code examples
c#responsive-designresponsivedesktop-applicationwindows-forms-designer

Responsive Applications


I am developing a c# application using windows forms and I wonder if it is possible to make the application responsive somehow, I've searched a lot and found that the anchor could be used but it doesn't resize things so it doesn't look responsive, is there a way that I can make c# responsive desktop applications?

For Example:

Here when I maximize the pannels they fit the window but the text will just look bad.

Before Maximization

After Maximization


Solution

  • If you want to simply distribute the components in the maximized window, without scale the components up, I suggest you use the TableLayoutPanel, instead of the Panel.

    Using a TableLayoutPanel, you can divide the screen, for instance in 4 parts, 2 columns and 2 rows with 25% in each. And then distribute the components. Don't forget to set the Dock property of TableLayoutPanel to fill, or set the anchor property appropriately.

    You can Stil put a FlowLayoutPanel inside the TableLayoutPanle row, doing that will provide a dynamic layout for the child controls that can be arranged horizontally or vertically.

    Search for TableLayoutPanel to get some samples.

    Some articles about it:

    https://www.codeproject.com/Articles/8845/FlowLayoutPanel-TableLayoutPanel-controls-Visual-S

    https://www.developer.com/net/net/article.php/11087_3671986_3/Changing-Layout-Dynamically-in-Windows-Forms.htm