Windows Develop Bookmark and Share   
 index > Windows Forms General > Freezing control drawing when controls are added dynamically added to Panel
 

Freezing control drawing when controls are added dynamically added to Panel

Hi,
Is it possible to freeze controls drawing when adding controls dynamically? will SuspendLayout() and ResumeLayout() work??

Thanks
nitroxn  Wednesday, September 23, 2009 6:54 PM
Yes, calling Suspend should stop Layout events while you adjust the new controlss properties, and add them to the form.

What problem are you really having, or seeing?

Mark the best replies as answers. "Fooling computers since 1971."
Rudedog2  Wednesday, September 23, 2009 7:04 PM
Yes. SuspendLayout() and ResumeLayout() prevent controls from adjusting their layout while you're adding controls to a parent. Once you add the newly created controls, you may want to call PerformLayout() as well.

See any Windows Forms designer file for an example of how this works. The form.designer.cs file contains the proper sequence as its creating and adding controls to the form.

Reed Copsey, Jr. - http://reedcopsey.com
Reed Copsey, Jr.  Wednesday, September 23, 2009 7:04 PM
Yes, calling Suspend should stop Layout events while you adjust the new controlss properties, and add them to the form.

What problem are you really having, or seeing?

Mark the best replies as answers. "Fooling computers since 1971."
Rudedog2  Wednesday, September 23, 2009 7:04 PM
Yes. SuspendLayout() and ResumeLayout() prevent controls from adjusting their layout while you're adding controls to a parent. Once you add the newly created controls, you may want to call PerformLayout() as well.

See any Windows Forms designer file for an example of how this works. The form.designer.cs file contains the proper sequence as its creating and adding controls to the form.

Reed Copsey, Jr. - http://reedcopsey.com
Reed Copsey, Jr.  Wednesday, September 23, 2009 7:04 PM

You can use google to search for other answers

Custom Search

More Threads

• A problem regarding an ActiveX component and winform focus.
• How to run a function from a MDIi Child in a MDI Parent
• Fading between panels
• Internet Application - need help, simple question
• combobox collapse drawing problem
• Cant add SQL Express database to local Winforms Application
• How can I use checkbox inside a list box?
• Casing Problem
• load child forms of MDI on a separate thread
• How to drag and drop data from original datagridview to destination datagridview?