|
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."- Marked As Answer byAland LiMSFT, ModeratorFriday, September 25, 2009 6:48 AM
-
| | 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- Marked As Answer byAland LiMSFT, ModeratorFriday, September 25, 2009 6:48 AM
-
| | 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."- Marked As Answer byAland LiMSFT, ModeratorFriday, September 25, 2009 6:48 AM
-
| | 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- Marked As Answer byAland LiMSFT, ModeratorFriday, September 25, 2009 6:48 AM
-
| | Reed Copsey, Jr. Wednesday, September 23, 2009 7:04 PM |
|