protected override void OnPaint(PaintEventArgs e)
{
// Cannot process a message for a disposed control
if (!IsDisposed)
{
// Do we have a manager to use for painting?
if (ViewManager != null)
{
// If the layout is dirty, then perform a layout now
if (_layoutDirty)
{
Size beforeSize = ClientSize;
PerformLayout();
// Did the layout cause a change in the size of the control?
if ((beforeSize.Width < ClientSize.Width) ||
(beforeSize.Height < ClientSize.Height))
{
// Have to reset the _refresh before calling need paint otherwise
// it will not create another invalidate or invoke call as necessary
_refresh = false;
_refreshAll = false;
PerformNeedPaint(false);
}
}
// Ask the view to repaint the visual structure
ViewManager.Paint(Renderer, e);
// Request for a refresh has been serviced
_refresh = false;
_refreshAll = false;
}
}
}