C# Window Forms, what a Custom Layout should return on his LayoutEngine#Layout method
I recently started with Window Forms, I'm implementing a custom layout engine and I find myself wondering about what should I return for the LayoutEngine#Layout method.
Here I've found an answer, though I'm not sure of the implications and what I should do in my concrete implementation.
(a) If "true" is returned, does this mean that a LayoutEvent is triggered on all parent's children?
(b) Why the above article suggests that in some case it may be wise to return the parent's AutoSize property?
Feel free to add any pointer that may be 开发者_开发技巧valuable for understanding how layout works in Window Forms.
P.S. The layout engine I need to implement is sort of a FlowLayout with size and alignment constraints (somehow similar to a Java's Swing BoxLayout, if that helps).
The documentation for Layout is quite specific (emphasis added):
Return true if your layout engine logic determines that layout should be performed again by the parent of the container. This might occur, for example, when the layout engine resizes child controls and determines that the container must be increased in size to accommodate the new layout.
More generally, there's a (rather old) article on MSDN: Providing Custom Layout Engines for Windows Forms
精彩评论