Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How can I diagnose a performance problem with Layout?

In the UI that you believe to be laying out the most, either override OnLayout or sync the Layout event. In the event use Debug WriteLines to write both the current size of the control and the call stack of how we got here. You can also print out the layoutEventArgs.AffectedProperty. Usually you'll find very interesting results.

For the scenarios where you think the Layout is not necessary, add in a SuspendLayout. When the operation is complete, add a matching ResumeLayout. If you dont feel that a layout is necessary at that time, call ResumeLayout(false) which means dont do the layout just this second.



Page view counter