Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML layout for winforms

Tags:

winforms

Instead of arranging controls on a winform form by specifying pixel locations, I'd like to lay it out similar to the way you'd layout a form in html. This would make it scale better (for larger fonts etc).

Does anyone know of a layout library that allows you to define the form in xml and lay it out similar to html?

like image 266
dan gibson Avatar asked Feb 03 '26 22:02

dan gibson


2 Answers

Have you checked out the TableLayoutPanel and FlowLayoutPanel in the .NET framework? It might be what you are looking for.

like image 178
Patrik Svensson Avatar answered Feb 07 '26 00:02

Patrik Svensson


Yeah, it's called WPF :)

Seriously, there are some newer panel types in WinForms 2.0 that will let you place controls without setting Location and Size. They are FlowLayoutPanel and TableLayoutPanel.

You should also look into the AutoSize property. It takes care of sizing when the value of the label, say, changes. Also, don't forget about Docking and Anchoring.

Once you master those concepts, writing a little parser that converts from XML to controls shouldn't be that hard if you feel you really need it.

like image 27
ageektrapped Avatar answered Feb 07 '26 00:02

ageektrapped



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!