private void RenderSkinFormMinimizeBoxInternal(
            Graphics g,
            Rectangle rect,
            ControlBoxState state,
            bool active)
        {
            Color baseColor = ColorTable.ControlBoxActive;

            if (state == ControlBoxState.Pressed)
            {
                baseColor = ColorTable.ControlBoxPressed;
            }
            else if (state == ControlBoxState.Hover)
            {
                baseColor = ColorTable.ControlBoxHover;
            }
            else
            {
                baseColor = active ?
                            ColorTable.ControlBoxActive :
                            ColorTable.ControlBoxDeactive;
            }

            RoundStyle roundStyle = RoundStyle.BottomLeft;

            using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g))
            {
                RenderHelper.RenderBackgroundInternal(
                    g,
                    rect,
                    baseColor,
                    baseColor,
                    ColorTable.ControlBoxInnerBorder,
                    roundStyle,
                    6,
                    .38F,
                    true,
                    false,
                    LinearGradientMode.Vertical);

                using (Pen pen = new Pen(ColorTable.Border))
                {
                    g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y);
                }

                using (GraphicsPath path = DrawUtil.CreateMinimizeFlagPath(rect))
                {
                    g.FillPath(Brushes.White, path);
                    using (Pen pen = new Pen(baseColor))
                    {
                        g.DrawPath(pen, path);
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 画最小按钮
        /// </summary>
        /// <param name="g"></param>
        /// <param name="rect"></param>
        /// <param name="state"></param>
        /// <param name="active"></param>
        private void RenderSkinFormMinimizeBoxInternal(
            Graphics g,
            Rectangle rect,
            ControlBoxState state,
            bool active,
            SkinForm form)
        {
            Bitmap          image     = null;
            SkinPictureForm imageForm = (SkinPictureForm)form;
            Color           baseColor = ColorTable.ControlBoxActive;

            if (state == ControlBoxState.Pressed)
            {
                image     = (Bitmap)imageForm.MiniDownBack;
                baseColor = ColorTable.ControlBoxPressed;
            }
            else if (state == ControlBoxState.Hover)
            {
                image     = (Bitmap)imageForm.MiniMouseBack;
                baseColor = ColorTable.ControlBoxHover;
            }
            else
            {
                image     = (Bitmap)imageForm.MiniNormlBack;
                baseColor = active ? ColorTable.ControlBoxActive : ColorTable.ControlBoxDeactive;
            }

            if (image != null)
            {
                g.DrawImage(image, rect);
            }
            else
            {
                RoundStyle roundStyle = RoundStyle.BottomLeft;

                using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g))
                {
                    RenderHelper.RenderBackgroundInternal(
                        g,
                        rect,
                        baseColor,
                        baseColor,
                        ColorTable.ControlBoxInnerBorder,
                        roundStyle,
                        6,
                        .38F,
                        true,
                        false,
                        LinearGradientMode.Vertical);

                    using (Pen pen = new Pen(ColorTable.Border))
                    {
                        g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y);
                    }

                    using (GraphicsPath path = DrawUtil.CreateMinimizeFlagPath(rect))
                    {
                        g.FillPath(Brushes.White, path);
                        using (Pen pen = new Pen(baseColor))
                        {
                            g.DrawPath(pen, path);
                        }
                    }
                }
            }
        }