UserControls or WinForms???

  • Thread starter Thread starter ?scar Martins
  • Start date Start date
?

?scar Martins

Hello ppl


I'm developing an app which has one panel in main form. Now, I´m
building different forms that are added to the controls collection of
that panel... In this way, dinamically, I can show different forms in
a sdi project.
What I want to know is whether to use forms or usercontrols...what the
difference between this objects when applied to this kind of app??

Note: The user will interact with the form the panel is showing in
that specific moment and, maybe, click a button that will SendToBack
that form and bringtofront each other... It´s this kind of interface
that I have now... But what´s the best way to achieve this? With
usercontrols or windows forms?

Thanks in advance
 
Hi,

This seems similar to a tab control without tabs (or a wizard without
next/back).
Most design patterns for this have a single controller/container and several
pages they control added by an external client.
The controller provides services to the pages through a well defined
interface.
The pages adhere to another interface required by the controller (e.g.
IPage.onActivated, IPage .onAction...) and communicate with each other
through the controller only (e.g. IController.SetState(ctx),
IController.SetNextPage(id)…).
In addition to the services it provides to its controlled pages, the
controller provides services for its clients such IController .AddPage( IPage
p) and IController .Show().

Both the Controller and the pages may be controls or forms, or even inherit
from the required propriety interfaces only and have a method of providing a
visible control (e.g Control IPage.GetUIControl()). As long as you keep the
design as above and provide a way to be displayed, you will do ok.

Hope this helps,

Dani
 
Ok.. It seems I'm in the right way but regarding to performance and
memory usage what the best way? Or is the same as long as I keep the
design as you described?
 
Back
Top