Utkarsh Sinha
Utkarsh Sinha

Reputation: 3305

Performance of C#/.net forms with lots of controls

Does the number of controls on a form affect its performance? What if the controls are marked invisible? What if the several controls are visible, but entirely covered by only a few controls (like a panel containing a couple of controls)?

I'm asking this from a perspective of applications like 3d modeling packages, video editing software, etc. They've got hidden panels, tabs, rollouts, animated drawers and what not.

Has anyone done any such performance tests? Is considering this worthwhile?

Upvotes: 1

Views: 1259

Answers (2)

Mufaka
Mufaka

Reputation: 3444

Yes. Outside of the drawing, each control uses it's own window handle just by initializing it. So even invisible or hidden, it will affect performance.

The type of control makes a difference too. 3rd party or custom controls will sometimes be composed of multiple controls, each having it's own handle.

Usually the up front consideration for the amount of controls is done in the usability context and that generally should help avoid performance issues.

Upvotes: 3

Saeed Amiri
Saeed Amiri

Reputation: 22555

Without doing any performance test it's easy to say that too many controls has performance issue,

  • The memory usage increased (UI objects are very huge).
  • OnPaint and other message base methods will be called (for control or for parent in inheritance hierarchy)

Upvotes: 2

Related Questions