Hi,
My app is very slow and I am trying to make it more efficient but can't seem to work out which method to override.
I have a lot of buttons (100 - 200) added to a panel and wish to resize the panel so that the buttons resize themselves in the window. The buttons are quite long (200 pixels or so) and so if they reach the end of the page they split into two buttons, one starting on the next line.
This works very well, but it is terribly slow. Every time I resize, it removes all the buttons from the panel one at a time and then adds them back one at a time. (this cannot be changed due to the purpose of my app). The panel is drawn on every add or remove.
This is a considerable amount of redrawing, but I can't work out which method to overload. I wish the buttons to be removed and added again without performing a redraw until the end.
I have tried double buffering but cant get it to draw to just this panel.
I thought that I could just catch paint events in the panel and then ignore them until all the buttons had been removed and added, but these events are not created as I expected.
Does anyone have any idea how to prevent all this excessive drawing?
Thanks,
Dan
My app is very slow and I am trying to make it more efficient but can't seem to work out which method to override.
I have a lot of buttons (100 - 200) added to a panel and wish to resize the panel so that the buttons resize themselves in the window. The buttons are quite long (200 pixels or so) and so if they reach the end of the page they split into two buttons, one starting on the next line.
This works very well, but it is terribly slow. Every time I resize, it removes all the buttons from the panel one at a time and then adds them back one at a time. (this cannot be changed due to the purpose of my app). The panel is drawn on every add or remove.
This is a considerable amount of redrawing, but I can't work out which method to overload. I wish the buttons to be removed and added again without performing a redraw until the end.
I have tried double buffering but cant get it to draw to just this panel.
I thought that I could just catch paint events in the panel and then ignore them until all the buttons had been removed and added, but these events are not created as I expected.
Does anyone have any idea how to prevent all this excessive drawing?
Thanks,
Dan