September 14th, 2012, 01:54 PM
Defining different layouts for a Windows form.
Hello all -
I have a form with a number of various controls on it. Given different modes my application is running in, I'd like to provide different layouts for this form. I'd like to re-use existing code that interacts with the form because all the controls will still be on it, just in a different layout. In MFC, you can easily do this by providing different dialog templates to the same CDialog or CFormView class. Is there a way to do this easily in C#/.Net?
I don't want to use any of the layout panels, because my controls could be in completely different locations relative to each other. It's best if I could define a different layout and load it at runtime depending on the app mode.
When doing internationalization, a new resx file is generated and in the Designer.cs file of my form, you can provide different text or sizes dynamically using the ApplyResources method on the ComponentResourceManager. The appropriate resx file is loaded for your form based on the culture. I'd like to do something similar, but for the same culture have different layouts.
Any suggestions out there? Thanks in advance.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.