0

I m developing a window optimization application in C#. In that Project I have tablelayout panel. And i added pictureboxes to all cells. In application the user can add columns and rows at run-time.

But when the user dynamically add column or row, the application begins to slow down.

My question is with using panel instead of pictureboxes will speed up? (Panel backround image property do same job) Or it doesn't change anything?

I have already set double buffered proterty to true.

enter image description here

Gokhan
  • 453
  • 4
  • 10
  • 3
    "a window optimization application" -- somewhat ironic for how unoptimized this approach is! – Blindy Aug 05 '21 at 14:07
  • 1
    So your question is essentially "here's a screenshot of my program, why is it slow?". I'm not sure if we're going to be able to do anything with that.. doublebuffering is not a mechanism for speeding things up btw – Caius Jard Aug 05 '21 at 14:07
  • @CaiusJard thanx for comment. I only ask does choosing different controls make any difference to the performance of the program.which one is heavier. Picturebox or panel? – Gokhan Aug 06 '21 at 05:29

1 Answers1

2

I have tablelayout panel. And i added pictureboxes to all cells.

If I understand you correctly, this won't work in WinForms. Here all controls are actual Windows windows, with OS-level handles and all the message pumping logic that entails. Plus the table layout triggers resizing in every single window under it, putting more pressure on it all.

Either go the less lazy route of drawing it all yourself in a memory bitmap and put it in a PictureBox to display, or use a more modern framework like WPF which doesn't have any of the afore-mentioned limitations. In fact, this is trivial in XAML.

Blindy
  • 65,249
  • 10
  • 91
  • 131