henriquesirot
henriquesirot

Reputation: 115

C# Multi-panel/layer winform application

I've been designing a pretty complicated avionics application. The thing is, it has many menu buttons to be clicked (12 to be exact) and each one of them perform a different action. For instance, one could be a login panel and the other one a PDF reader. How could I organize this programmatically?

Currently, I've been setting each item in a panel and setting it to visible or invisible, according to the active or clicked item.

How would you guys do this? Thanks in advance!

Upvotes: 1

Views: 3273

Answers (2)

Andrew Kennan
Andrew Kennan

Reputation: 14157

Like IAbstract says, you should consider separating the different UI elements as UserControls. You can then do things like use a factory to construct them and add them to your window as required.

I've found this sort of approach, used with a Model-View-Presenter type pattern, works really well for WinForms apps with dynamic user interfaces.

Upvotes: 0

IAbstract
IAbstract

Reputation: 19881

You might consider a FlowLayoutPanel, although I'm not sure how flexible it would be in meeting your requirements. If you set your panels up with docking properties, you should be able to manage.

I would also recommend using a UserControl to separate code and functionality. If panels need to communicate, implement the observer/observable pattern instead of subscribing to events between user controls.

Upvotes: 2

Related Questions