Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I serialize a .NET control to CODE?

I want to create a .NET Form at runtime, add buttons and other controls to that (also at runtime), and then be able to generate a something.designer.cs file from that form (which can then be added to a C# solution and compiled).

What I want to do is very similar to what the WinForm designer does. But instead of having a drag/drop interface for the user, I want to dynamically build the Form/Controls myself at runtime.

I was thinking I could just reuse what the WinForm designer is doing.

Is that possible?

like image 869
NotDan Avatar asked Dec 01 '25 21:12

NotDan


1 Answers

This MSDN magazine article should have everything you need.

like image 139
Hans Passant Avatar answered Dec 04 '25 09:12

Hans Passant



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!