G
Guest
All -
I have a custom control - in which when a property value changes, i call
"PerformLayout" method (becoz my internal layout calculations have changed).
I also override "OnLayout" to do the actual layout calculations.
When the control is used from "VS Designer", form.designer.cs generates
following code:
customControl.SuspendLayout();
customControl.SomeProperty = someValue;
// < the above propertychange will call PerformLayout internally>
customControl.ResumeLayout(false); // Note the "false"
The problem is that since SuspendLayout was called, PerformLayout does a
"NoOP" i guess and the overridden OnLayout is *never* called (confirmed thro'
debugger).
Albeit changing ResumeLayout(false) to ResumeLayout(true) makes everything
work fine.
My question is -
(a) Why z ResumeLayout(false) called by the designer instead of true- not
allowing pending layout events to be processed?
(b) Is my technique of overriding "OnLayout" event to perform layout
calculations and using PerformLayout to force new layout incorrect?
If so what is the correct way to do this?
I am using VS 2005 - C#.
Regardz
Grafix.
I have a custom control - in which when a property value changes, i call
"PerformLayout" method (becoz my internal layout calculations have changed).
I also override "OnLayout" to do the actual layout calculations.
When the control is used from "VS Designer", form.designer.cs generates
following code:
customControl.SuspendLayout();
customControl.SomeProperty = someValue;
// < the above propertychange will call PerformLayout internally>
customControl.ResumeLayout(false); // Note the "false"
The problem is that since SuspendLayout was called, PerformLayout does a
"NoOP" i guess and the overridden OnLayout is *never* called (confirmed thro'
debugger).
Albeit changing ResumeLayout(false) to ResumeLayout(true) makes everything
work fine.
My question is -
(a) Why z ResumeLayout(false) called by the designer instead of true- not
allowing pending layout events to be processed?
(b) Is my technique of overriding "OnLayout" event to perform layout
calculations and using PerformLayout to force new layout incorrect?
If so what is the correct way to do this?
I am using VS 2005 - C#.
Regardz
Grafix.