Exemple #1
0
        internal virtual void RaiseOnPaint(PaintEventArgs e)
        {
            if (uwfShadowBox)
            {
                if (uwfShadowHandler == null)
                {
                    PaintShadow(e, this);
                }
                else
                {
                    uwfShadowHandler(e);
                }
            }

            if (uwfAutoGroup)
            {
                e.Graphics.GroupBegin(this);
            }

            OnPaintBackground(e);
            OnPaint(e);

            if (controls != null)
            {
                for (int i = 0; i < controls.Count; i++)
                {
                    var childControl = controls[i];
                    if (Application.ControlIsVisible(childControl) == false)
                    {
                        continue;
                    }

                    var currentAbspos  = childControl.PointToScreen(Point.Empty);
                    var currentAbsposX = currentAbspos.X;
                    var currentAbsposY = currentAbspos.Y;

                    if (currentAbsposX + childControl.width < 0 ||
                        currentAbsposX > Screen.width ||
                        currentAbsposY + childControl.height < 0 ||
                        currentAbsposY > Screen.height)
                    {
                        continue;
                    }

                    childControl.RaiseOnPaint(e);
                }
            }

            uwfOnLatePaint(e);

            if (uwfAutoGroup)
            {
                e.Graphics.GroupEnd();
            }
        }
Exemple #2
0
        internal void RaiseOnPaint(PaintEventArgs e)
        {
            e.Graphics.Control = this;
            Batches            = 0;

            if (ShadowBox)
            {
                if (ShadowHandler == null)
                {
                    ShadowHandler = (pArgs) =>
                    {
                        var psLoc       = PointToScreen(Point.Zero);
                        int shX         = psLoc.X + 6;
                        int shY         = psLoc.Y + 6;
                        var shadowColor = defaultShadowColor;
                        pArgs.Graphics.FillRectangle(shadowColor, shX + 6, shY + 6, Width - 12, Height - 12);
                        pArgs.Graphics.FillRectangle(shadowColor, shX + 5, shY + 5, Width - 10, Height - 10);
                        pArgs.Graphics.FillRectangle(shadowColor, shX + 4, shY + 4, Width - 8, Height - 8);
                        pArgs.Graphics.FillRectangle(shadowColor, shX + 3, shY + 3, Width - 6, Height - 6);
                        pArgs.Graphics.FillRectangle(shadowColor, shX + 2, shY + 2, Width - 4, Height - 4);
                    };
                }

                ShadowHandler.Invoke(e);
            }

            if (AutoGroup)
            {
                int gx = e.ClipRectangle.X;
                int gy = e.ClipRectangle.Y;

                if (gx != 0 && gy != 9) // Reset?
                {
                    e.ClipRectangle = new Rectangle(0, 0, Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
                }

                e.Graphics.Group = new Drawing.Rectangle(gx, gy, Width, Height);
                e.Graphics.GroupBegin(this);
            }
            OnPaintBackground(e);
            OnPaint(e);
            if (Controls != null)
            {
                for (int i = 0; i < Controls.Count; i++)
                {
                    if (Application.ControlIsVisible(Controls[i]) == false)
                    {
                        continue;
                    }

                    var currentAbspos = Controls[i].PointToScreen(System.Drawing.Point.Zero);
                    if (currentAbspos.X + Controls[i].Width <0 || currentAbspos.X> Screen.PrimaryScreen.WorkingArea.Width ||
                        currentAbspos.Y + Controls[i].Height <0 || currentAbspos.Y> Screen.PrimaryScreen.WorkingArea.Height)
                    {
                        continue;
                    }

                    e.Graphics.Control = Controls[i];
                    Controls[i].RaiseOnPaint(e);
                }
            }
            e.Graphics.Control = this;
            if (Application.Debug)
            {
                e.Graphics.DrawString(GetType().Name, Font, Brushes.White, 3, 1, 256, 32);
                e.Graphics.DrawString(GetType().Name, Font, Brushes.White, 5, 3, 256, 32);
                e.Graphics.DrawString(GetType().Name, Font, Brushes.DarkRed, 4, 2, 256, 32);
                e.Graphics.DrawRectangle(Pens.DarkRed, 0, 0, Width, Height);
            }
            OnLatePaint(e);
            if (AutoGroup)
            {
                e.Graphics.GroupEnd();
            }

            e.Graphics.Control = null;
        }
Exemple #3
0
        internal void RaiseOnPaint(PaintEventArgs e)
        {
            e.Graphics.Control = this;
            Batches            = 0;

            if (ShadowBox)
            {
                if (ShadowHandler == null)
                {
                    int shX = e.ClipRectangle.X + 6;
                    int shY = e.ClipRectangle.Y + 6;
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(12, 64, 64, 64)), shX + 6, shY + 6, Width - 12, Height - 12);
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(12, 64, 64, 64)), shX + 5, shY + 5, Width - 10, Height - 10);
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(12, 64, 64, 64)), shX + 4, shY + 4, Width - 8, Height - 8);
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(12, 64, 64, 64)), shX + 3, shY + 3, Width - 6, Height - 6);
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(12, 64, 64, 64)), shX + 2, shY + 2, Width - 4, Height - 4);
                }
                else
                {
                    ShadowHandler.Invoke(e);
                }
            }

            if (UserGroup)
            {
                e.Graphics.Group = new Drawing.Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, Width, Height);
                e.Graphics.GroupBegin(this);
            }
            OnPaintBackground(e);
            OnPaint(e);
            if (Controls != null)
            {
                for (int i = 0; i < Controls.Count; i++)
                {
                    if (Application.ControlIsVisible(Controls[i]) == false)
                    {
                        continue;
                    }

                    var currentAbspos = Controls[i].PointToScreen(System.Drawing.Point.Zero);
                    if (currentAbspos.X + Controls[i].Width <0 || currentAbspos.X> UnityEngine.Screen.width ||
                        currentAbspos.Y + Controls[i].Height <0 || currentAbspos.Y> UnityEngine.Screen.height)
                    {
                        continue;
                    }
                    e.Graphics.Control = Controls[i];
                    Controls[i].RaiseOnPaint(e);
                }
            }
            e.Graphics.Control = this;
            if (Application.Debug)
            {
                e.Graphics.DrawString(GetType().Name, Font, Brushes.White, 3, 1, 256, 32);
                e.Graphics.DrawString(GetType().Name, Font, Brushes.White, 5, 3, 256, 32);
                e.Graphics.DrawString(GetType().Name, Font, Brushes.DarkRed, 4, 2, 256, 32);
                e.Graphics.DrawRectangle(Pens.DarkRed, 0, 0, Width, Height);
            }
            OnLatePaint(e);
            if (UserGroup)
            {
                e.Graphics.GroupEnd();
            }
            Batched = true;

            e.Graphics.Control = null;
        }
        internal virtual void RaiseOnPaint(PaintEventArgs e)
        {
            uwfBatches = 0;

            if (uwfShadowBox)
            {
                if (uwfShadowHandler == null)
                {
                    uwfShadowHandler = (pArgs) =>
                    {
                        var psLoc       = PointToScreen(Point.Empty);
                        int shX         = psLoc.X + 6;
                        int shY         = psLoc.Y + 6;
                        var shadowColor = defaultShadowColor;
                        var localWidth  = Width;
                        var localHeight = Height;
                        var graphics    = pArgs.Graphics;
                        graphics.uwfFillRectangle(shadowColor, shX + 6, shY + 6, localWidth - 12, localHeight - 12);
                        graphics.uwfFillRectangle(shadowColor, shX + 5, shY + 5, localWidth - 10, localHeight - 10);
                        graphics.uwfFillRectangle(shadowColor, shX + 4, shY + 4, localWidth - 8, localHeight - 8);
                        graphics.uwfFillRectangle(shadowColor, shX + 3, shY + 3, localWidth - 6, localHeight - 6);
                        graphics.uwfFillRectangle(shadowColor, shX + 2, shY + 2, localWidth - 4, localHeight - 4);
                    };
                }

                uwfShadowHandler(e);
            }

            if (uwfAutoGroup)
            {
                e.Graphics.GroupBegin(this);
            }

            OnPaintBackground(e);
            OnPaint(e);

            if (controls != null)
            {
                for (int i = 0; i < controls.Count; i++)
                {
                    var childControl = controls[i];
                    if (Application.ControlIsVisible(childControl) == false)
                    {
                        continue;
                    }

                    var currentAbspos  = childControl.PointToScreen(Point.Empty);
                    var currentAbsposX = currentAbspos.X;
                    var currentAbsposY = currentAbspos.Y;

                    if (currentAbsposX + childControl.width < 0 ||
                        currentAbsposX > Screen.width ||
                        currentAbsposY + childControl.height < 0 ||
                        currentAbsposY > Screen.height)
                    {
                        continue;
                    }

                    childControl.RaiseOnPaint(e);
                }
            }

            uwfOnLatePaint(e);

            if (uwfAutoGroup)
            {
                e.Graphics.GroupEnd();
            }
        }