Adding controls to FlowLayoutPanel
-
Hello, I am adding a bunch of usercontrols to a flow layout panel, but it takes a very long time for the controls to show up in the flowpanel. Is there a way to speed up the process? There are almost 600 controls that are added to the flowpanel. Thank you
-
Hello, I am adding a bunch of usercontrols to a flow layout panel, but it takes a very long time for the controls to show up in the flowpanel. Is there a way to speed up the process? There are almost 600 controls that are added to the flowpanel. Thank you
Are you creating the controls individually and then adding them to the panel by calling
panel.Controls.Add
? You might want to create your controls and add them to an array orList<Control>
. Once all of the controls have been created, add them to the panel by callingpanel.Controls.AddRange
. This should provide some noticeable speed improvements. Also, be sure to callSuspendLayout
before you start adding controls and thenResumeLayout `when you are done. ----------------------------- In just two days, tomorrow will be yesterday.`