Joan Venge
Joan Venge

Reputation: 331140

How to store sets of controls in an assembly?

I have sets of controls contained in individual GroupBox controls.

So say GroupBoxCommon contains Common UI Items, GroupBoxSpecific contains Specific UI items, etc.

I have a way of stacking them in a single UI (floating panel) based on the current selection in the app.

I am just wondering how I should store these sets of controls? Should I create separate forms for each inside this single assembly (that's used by the app).

Should I create them dynamically, as in:

Create GroupBoxCommon
Add Button
Add Button
...

Or should I have them in a single form but offsetted?

To me #1 seems to be the way, but there might be a better way to do this?

In the all I will do is to fetch these sets of controls and stack them in a single UI.

Upvotes: 0

Views: 59

Answers (1)

Christian Hayter
Christian Hayter

Reputation: 31071

Put each group of controls inside a UserControl. That's what they are designed for, and it will probably make your form code simpler because it will be dealing with less controls.

There is no problem defining UserControls inside a DLL, there's even a project template for it ("Windows Forms Control Library" IIRC).

Upvotes: 3

Related Questions