dotnetmonitor.com

 
Index
Previous
Next

 

Problem: Changing properties such as Bounds, Size, Location, Visible and Text/Image/etc for AutoSized controls InitializeComponent and/or Suspend/ResumeLayout can cause perf problems. Each time one of these properties are touched a layout is forced. Changing any of these in Form.Load is particularly bad, at that point the handles have all been created, and window messages have to be sent to change size/locations.

 

Solution: Add a Suspend/Resume Layout to prevent extra layouts from occurring. If possible, make all of these changes within InitializeComponent this way only one layout is ever needed

Terms
Docking Anchor Layout
What happens when I have Dock and Anchors that conflict?
Dock Scenarios
Padding Margin
You have a perf problem with Layout - how to diagnose?