/// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnRenderSkinFormBackground(SkinFormBackgroundRenderEventArgs e)
        {
            Graphics g = e.Graphics;

            Rectangle rect = e.ClipRectangle;

            SkinForm form = e.SkinForm;

            using (FormAntiAliasGraphics antiGraphics = new FormAntiAliasGraphics(g))
            {
                int bc = int.Parse(this.ColorTable.BaseColor.B.ToString());

                int gc = int.Parse(this.ColorTable.BaseColor.G.ToString());

                int rc = int.Parse(this.ColorTable.BaseColor.R.ToString());

                using (LinearGradientBrush brush = new LinearGradientBrush(rect, this.ColorTable.BaseColor, this.GetUndertoneColor(rc, gc, bc), 90f, true))
                {
                    using (GraphicsPath path = FormGraphicsPathHelper.CreatePath(rect, form.Radius, form.RoundStyle, false))
                    {
                        g.FillPath(brush, path);
                    }
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="G"></param>
        /// <param name="Rect"></param>
        /// <param name="State"></param>
        /// <param name="Active"></param>
        /// <param name="MinimizeBox"></param>
        /// <param name="MaximizeBox"></param>
        private void RenderSkinFormCloseBoxInternal(
            Graphics G,
            Rectangle Rect,
            FormControlBoxState State,
            bool Active,
            bool MinimizeBox,
            bool MaximizeBox)
        {
            Color baseColor = ColorTable.ControlBoxActiveColor;

            if (State == FormControlBoxState.Pressed)
            {
                baseColor = ColorTable.ControlCloseBoxPressedColor;
            }
            else if (State == FormControlBoxState.Hover)
            {
                baseColor = ColorTable.ControlCloseBoxHoverColor;
            }
            else
            {
                baseColor = Active ?
                            ColorTable.ControlBoxActiveColor :
                            ColorTable.CaptionDeleteActiveColor;
            }

            FormRoundStyle roundStyle = MinimizeBox || MaximizeBox ?
                                        FormRoundStyle.BottomRight : FormRoundStyle.Bottom;

            using (FormAntiAliasGraphics antiGraphics = new FormAntiAliasGraphics(G))
            {
                FormRenderHelper.RenderBackgroundInternal(
                    G,
                    Rect,
                    baseColor,
                    baseColor,
                    ColorTable.ControlBoxInnerBorderColor,
                    roundStyle,
                    6,
                    .38F,
                    true,
                    false,
                    LinearGradientMode.Vertical,
                    System.Windows.Forms.Orientation.Horizontal);

                using (Pen pen = new Pen(ColorTable.BorderColor))
                {
                    G.DrawLine(pen, Rect.X, Rect.Y, Rect.Right, Rect.Y);
                }

                using (GraphicsPath path = CreateCloseFlagPath(Rect))
                {
                    G.FillPath(Brushes.White, path);
                    using (Pen pen = new Pen(baseColor))
                    {
                        G.DrawPath(pen, path);
                    }
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnRenderSkinFormCaption(SkinFormCaptionRenderEventArgs e)
        {
            Graphics  g        = e.Graphics;
            Rectangle rect     = e.ClipRectangle;
            SkinForm  form     = e.SkinForm;
            Rectangle iconRect = form.IconRect;
            Rectangle textRect = Rectangle.Empty;

            bool closeBox    = form.ControlBox;
            bool minimizeBox = form.ControlBox && form.MinimizeBox;
            bool maximizeBox = form.ControlBox && form.MaximizeBox;

            int textWidthDec = 0;

            if (closeBox)
            {
                textWidthDec += form.CloseBoxSize.Width + form.ControlBoxOffset.X;
            }

            if (maximizeBox)
            {
                textWidthDec += form.MaximizeBoxSize.Width + form.ControlBoxSpace;
            }

            if (minimizeBox)
            {
                textWidthDec += form.MinimizeBoxSize.Width + form.ControlBoxSpace;
            }

            textRect = new Rectangle(
                iconRect.Right + 3,
                form.BorderWidth,
                rect.Width - iconRect.Right - textWidthDec - 6,
                rect.Height - form.BorderWidth);

            using (FormAntiAliasGraphics antiGraphics = new FormAntiAliasGraphics(g))
            {
                DrawCaptionBackground(
                    g,
                    rect,
                    e.Active);

                if (form.ShowIcon && form.Icon != null)
                {
                    DrawIcon(g, iconRect, form.Icon);
                }

                if (!string.IsNullOrEmpty(form.Text))
                {
                    DrawCaptionText(
                        g,
                        textRect,
                        form.Text,
                        form.CaptionFont);
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnRenderSkinFormBorder(SkinFormBorderRenderEventArgs e)
        {
            Graphics g = e.Graphics;

            using (FormAntiAliasGraphics antiGraphics = new FormAntiAliasGraphics(g))
            {
                DrawBorder(
                    g,
                    e.ClipRectangle,
                    e.SkinForm.RoundStyle,
                    e.SkinForm.Radius);
            }
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected void OnTabPageBackground(Color BaseColor, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            Rectangle rect = e.ClipRectangle;

            using (FormAntiAliasGraphics antiGraphics = new FormAntiAliasGraphics(g))
            {
                int bc = int.Parse(BaseColor.B.ToString());

                int gc = int.Parse(BaseColor.G.ToString());

                int rc = int.Parse(BaseColor.R.ToString());

                using (LinearGradientBrush brush = new LinearGradientBrush(rect, BaseColor, this.GetUndertoneColor(rc, gc, bc), 90f, true))
                {
                    using (GraphicsPath path = FormGraphicsPathHelper.CreatePath(rect, 4, FormRoundStyle.All, false))
                    {
                        g.FillPath(brush, path);
                    }
                }
            }
        }