ComponentFactory.Krypton.Toolkit.VisualContainerControlBase.OnNeedPaint C# (CSharp) Method

OnNeedPaint() protected method

Processes a notification from palette storage of a paint and optional layout required.
protected OnNeedPaint ( object sender, NeedLayoutEventArgs e ) : void
sender object Source of notification.
e NeedLayoutEventArgs An NeedLayoutEventArgs containing event data.
return void
        protected virtual void OnNeedPaint(object sender, NeedLayoutEventArgs e)
        {
            Debug.Assert(e != null);

            // Validate incoming reference
            if (e == null) throw new ArgumentNullException("e");

            // Never try and redraw or layout when disposed are trying to dispose
            if (!IsDisposed && !Disposing)
            {
                // Change in setting means we need to evaluate transparent painting
                _evalTransparent = true;

                // If required, layout the control
                if (e.NeedLayout && !_layoutDirty)
                    _layoutDirty = true;

                if (IsHandleCreated && (!_refreshAll || !e.InvalidRect.IsEmpty))
                {
                    // Always request the repaint immediately
                    if (e.InvalidRect.IsEmpty)
                    {
                        _refreshAll = true;
                        Invalidate();
                    }
                    else
                        Invalidate(e.InvalidRect);

                    // Do we need to use an Invoke to force repaint?
                    if (!_refresh && EvalInvokePaint)
                        BeginInvoke(_refreshCall);

                    // A refresh is outstanding
                    _refresh = true;
                }
            }
        }