Esempio n. 1
0
        /// <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,
                    false,
                    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);
                    }
                }
            }
        }
Esempio n. 2
0
 public SkinFormControlBoxRenderEventArgs(
     SkinForm SForm,
     Graphics G,
     Rectangle ClipRect,
     bool Active,
     FormControlBoxStyle ControlBoxStyle,
     FormControlBoxState ControlBoxState)
     : base(G, ClipRect)
 {
     this._SkinForm        = SForm;
     this._Active          = Active;
     this._ControlBoxState = ControlBoxState;
     this._ControlBoxStyle = ControlBoxStyle;
 }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnRenderSkinFormControlBox(SkinFormControlBoxRenderEventArgs e)
        {
            SkinForm            form  = e.Form;
            Graphics            g     = e.Graphics;
            Rectangle           rect  = e.ClipRectangle;
            FormControlBoxState state = e.ControlBoxState;
            bool Active = e.Active;

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

            switch (e.ControlBoxStyle)
            {
            case FormControlBoxStyle.Close:
                RenderSkinFormCloseBoxInternal(
                    g,
                    rect,
                    state,
                    Active,
                    minimizeBox,
                    maximizeBox);
                break;

            case FormControlBoxStyle.Maximize:
                RenderSkinFormMaximizeBoxInternal(
                    g,
                    rect,
                    state,
                    Active,
                    minimizeBox,
                    form.WindowState == FormWindowState.Maximized);
                break;

            case FormControlBoxStyle.Minimize:
                RenderSkinFormMinimizeBoxInternal(
                    g,
                    rect,
                    state,
                    Active);
                break;
            }
        }