Using C# .NET Compact Framework I am creating a GUI control that contains and controls children that are also custom controls (i.e. System.Windows.Forms.UserControl). Both, children and parent have custom drawing routines (OnPaint). To better understand and optimize the drawing routines I would like to clarify the draw order under .NET.
(1) What would be the correct order of the following events, when the whole thing is displayed the first time:
parent.OnPaintBackground
child.OnPaintBackground
parent.OnPaint
child.OnPaint
(2) Does the order of Control.Invalidate() calls impact the order of OnPaint / OnPaintBackground events?
(3) If child control invokes its own child.Invalidate(), does parent get the OnPaint / OnPaintBackground event too?
(4) How does system determine, which control is parent to which children and vice-versa? Is Control.Parent the only indication of this relationship?