public ViewControl(VisualControl rootControl)
{
Debug.Assert(rootControl != null);
// We use double buffering to reduce drawing flicker
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint, true);
// We need to repaint entire control whenever resized
SetStyle(ControlStyles.ResizeRedraw, true);
// We are not selectable
SetStyle(ControlStyles.Selectable, false);
// Default
_transparentBackground = false;
_inDesignMode = false;
// Remember incoming references
_rootControl = rootControl;
// Create delegate so child elements can request a repaint
_needPaintDelegate = new NeedPaintHandler(OnNeedPaint);
}