Using a Panel or ContainerControl

  • Thread starter Thread starter Torbjorn Stavas
  • Start date Start date
T

Torbjorn Stavas

I got several groups of components on a form that should be shown or
hidden depending on certain events.

In order to not to have to set the Visible property on all the
different components, i add them to different ContainerControls, and
use the containercontrols visible property. When i had used
ContainerControls for a while, i came to think of the almost non
existing difference of ContainerControl compared to a panel.

What option is best, when considering the performance of my
application... Should i use panels or containercontrols...?

//Regards, Torbjorn
 
I don't have any hard numbers, but I would think that the actual performance
difference, in terms of creation, between a ContainerControl and a Panel
wouldn't be noticeable. Minimal, if any. However, since the Panel is a
"built-in" control in the ToolBox, it becomes easier to visually create and
maintain your Form by using a Panel object. One thing that may steer you
toward the Panel, and I'd have to double check this to be sure so you may
want to try this for yourself, is that the Compact Framework version of the
ContainerControl does not pass focus to the proper contained control when
you're tabbing through the controls on the Form. A Panel will handle this
correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top