locked
A lot of button in my form RRS feed

  • Question

  • Hi to all,

    I have a form that have a lot of buttons (arround 2000). My problem is that when I display the form the buttons are painted  too slow. What can I do for do it more faster? any suggestion or idea?

    Wednesday, July 26, 2006 3:30 PM

Answers

  • At first i think you must review your design but any way

    microsoft recommend the following

    "When adding several controls to a parent control, it is recommended that you call the SuspendLayout method before initializing the controls to be added. After adding the controls to the parent control, call the ResumeLayout method. This will increase the performance of applications with many controls"

    but with this huge number of controls this may not help much

     

     

    Wednesday, July 26, 2006 4:21 PM

All replies

  • Each one of those buttons requires code to be run to paint, raise events, process events, etc.  2000 is a huge number of buttons for a form.  It suggests poor usability.  There's not much you can do to improve the performance of painting a form with 2000 buttons other than to split the form up into multiple forms.
    Wednesday, July 26, 2006 4:03 PM
  • At first i think you must review your design but any way

    microsoft recommend the following

    "When adding several controls to a parent control, it is recommended that you call the SuspendLayout method before initializing the controls to be added. After adding the controls to the parent control, call the ResumeLayout method. This will increase the performance of applications with many controls"

    but with this huge number of controls this may not help much

     

     

    Wednesday, July 26, 2006 4:21 PM