public SkinFormControlBoxRenderEventArgs(CForm form, Graphics graphics, Rectangle clipRect, bool active,
                                          ControlBoxStyle controlBoxStyle, ControlBoxState controlBoxState)
     : base(graphics, clipRect)
 {
     Form            = form;
     Active          = active;
     ControlBoxtate  = controlBoxState;
     ControlBoxStyle = controlBoxStyle;
 }
        public override Region CreateRegion(CForm form)
        {
            var rect = new Rectangle(Point.Empty, form.Size);

            using (var path = DrawHelper.CreateRoundPath(rect, form.Radius, form.RoundStyle, false)) //
            {
                return(new Region(path));
            }
        }
Beispiel #3
0
 public BaseForm(CForm main)
 {
     InitializeComponent();
     ShadowColors = new[] { Color.FromArgb(60, Color.Black), Color.Transparent };
     CornerColors = new[] { Color.FromArgb(180, Color.Black), Color.Transparent };
     Main         = main;
     InitializeComponent();
     SetStyles();
     Init();
 }
Beispiel #4
0
        /// <summary>
        /// 渲染最小化按钮
        /// </summary>
        /// <param name="g"></param>
        /// <param name="rect"></param>
        /// <param name="state"></param>
        /// <param name="active"></param>
        /// <param name="form"></param>
        private void RenderSkinFormMinimizeBoxInternal(Graphics g, Rectangle rect, ControlBoxState state, bool active,
                                                       CForm form)
        {
            // Bitmap image = null;
            Bitmap image            = (Bitmap)form.btnMinImage;
            int    i                = 0;
            var    controlBoxActive = ColorTable.ControlBoxActive;

            if (state == ControlBoxState.Pressed)
            {
                //  image = (Bitmap)form.MiniDownBack;
                i = 2;
                controlBoxActive = ColorTable.ControlBoxPressed;
            }
            else if (state == ControlBoxState.Hover)
            {
                i = 1; //  image = (Bitmap)form.MiniMouseBack;
                controlBoxActive = ColorTable.ControlBoxHover;
            }
            else
            {
                //  image = (Bitmap)form.MiniNormlBack;
                i = 0;
                controlBoxActive = active ? ColorTable.ControlBoxActive : ColorTable.ControlBoxDeactive;
            }
            if (image != null)
            {
                Rectangle srcRect = new Rectangle(image.Width / 3 * i, 0, image.Width / 3, image.Height);
                g.DrawImage(image, rect, srcRect, GraphicsUnit.Pixel);
            }
            else
            {
                var bottomLeft = RoundStyle.BottomLeft;
                using (new AntiAliasGraphics(g))
                {
                    RenderHelper.RenderBackgroundInternal(g, rect, controlBoxActive, controlBoxActive,
                                                          ColorTable.ControlBoxInnerBorder, bottomLeft, 6, 0.38f, true, false, LinearGradientMode.Vertical);
                    using (var pen = new Pen(ColorTable.Border))
                    {
                        g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y);
                    }
                    using (var path = CreateMinimizeFlagPath(rect))
                    {
                        g.FillPath(Brushes.White, path);
                        using (var pen2 = new Pen(controlBoxActive))
                        {
                            g.DrawPath(pen2, path);
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public override Region CreateRegion(CForm form)
        {
            var rect = new Rectangle(Point.Empty, form.Size);

            using (var path = DrawHelper.CreateRoundPath(rect, form.Radius, form.RoundStyle, false)) //
            {
                return(new Region(path));
            }

            //using (var path = DrawHelper.CreateRoundPath(rect.Width-5, rect.Height-5, form.Radius)) //
            //{
            //    return new Region(path);
            //}
        }
Beispiel #6
0
        /// <summary>
        /// 渲染自定义按钮
        /// </summary>
        /// <param name="g"></param>
        /// <param name="rect"></param>
        /// <param name="state"></param>
        /// <param name="active"></param>
        /// <param name="form"></param>
        private void RenderSkinFormSysBottomInternal(Graphics g, Rectangle rect, ControlBoxState state, bool active,
                                                     CForm form)
        {
            Bitmap image = (Bitmap)form.btnCustomImage;

            if (image == null)
            {
                return;
            }
            int i = 0;
            var controlBoxActive = ColorTable.ControlBoxActive;

            if (state == ControlBoxState.Pressed)
            {
                //   image = (Bitmap)form.SysBottomDown;
                i = 2;
                controlBoxActive = ColorTable.ControlBoxPressed;
            }
            else if (state == ControlBoxState.Hover)
            {
                i = 1;
                // image = (Bitmap)form.SysBottomMouse;
                controlBoxActive = ColorTable.ControlBoxHover;
            }
            else
            {
                i = 0;
                // image = (Bitmap)form.SysBottomNorml;
                controlBoxActive = active ? ColorTable.ControlBoxActive : ColorTable.ControlBoxDeactive;
            }
            if (image != null)
            {
                Rectangle srcRect = new Rectangle(image.Width / 3 * i, 0, image.Width / 3, image.Height);
                g.DrawImage(image, rect, srcRect, GraphicsUnit.Pixel);
            }
            else
            {
                var bottomLeft = RoundStyle.BottomLeft;
                using (new AntiAliasGraphics(g))
                {
                    RenderHelper.RenderBackgroundInternal(g, rect, controlBoxActive, controlBoxActive,
                                                          ColorTable.ControlBoxInnerBorder, bottomLeft, 6, 0.38f, true, false, LinearGradientMode.Vertical);
                    using (var pen = new Pen(ColorTable.Border))
                    {
                        g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y);
                    }
                }
            }
        }
Beispiel #7
0
 public override void InitSkinForm(CForm form)
 {
     form.BackColor = ColorTable.Back;
 }
Beispiel #8
0
 private void DrawBorder(Graphics g, Rectangle rect, RoundStyle roundStyle, int radius, CForm frm)
 {
     g.SmoothingMode = SmoothingMode.HighQuality;
     rect.Width--;
     rect.Height--;
     using (var path = DrawHelper.CreateRoundPath(rect, radius, roundStyle, false)) //
     {
         using (var pen = new Pen(ColorTable.Border))
         {
             g.DrawPath(pen, path);
         }
     }
     rect.Inflate(-1, -1);
     using (var path2 = DrawHelper.CreateRoundPath(rect, radius, roundStyle, false)) //
     {
         using (var pen2 = new Pen(ColorTable.InnerBorder))
         {
             g.DrawPath(pen2, path2);
         }
     }
 }
Beispiel #9
0
 public abstract void InitSkinForm(CForm form);
Beispiel #10
0
 public abstract Region CreateRegion(CForm form);
        private void RenderSkinFormMaximizeBoxInternal(Graphics g, Rectangle rect, ControlBoxState state, bool active,
                                                       bool minimizeBox, bool maximize, CForm form)
        {
            Bitmap    image            = maximize ? ((Bitmap)form.btnRestoreImage) : ((Bitmap)form.btnMaxImage);
            var       controlBoxActive = ColorTable.ControlBoxActive;
            int       i = 0;
            Rectangle srcRect;

            if (state == ControlBoxState.Pressed)
            {
                i = 2; controlBoxActive = ColorTable.ControlBoxPressed;
            }
            else if (state == ControlBoxState.Hover)
            {
                i = 1; controlBoxActive = ColorTable.ControlBoxHover;
            }
            else
            {
                i = 0; controlBoxActive = active ? ColorTable.ControlBoxActive : ColorTable.ControlBoxDeactive;
            }
            if (image != null)
            {
                srcRect = new Rectangle(i * image.Width / 3, 0, image.Width / 3, image.Height);
                g.DrawImage(image, rect, srcRect, GraphicsUnit.Pixel);
            }
            else
            {
                var style = minimizeBox ? RoundStyle.None : RoundStyle.BottomLeft;
                using (new AntiAliasGraphics(g))
                {
                    RenderHelper.RenderBackgroundInternal(g, rect, controlBoxActive, controlBoxActive,
                                                          ColorTable.ControlBoxInnerBorder, style, 6, 0.38f, true, false, LinearGradientMode.Vertical);
                    using (var pen = new Pen(ColorTable.Border))
                    {
                        g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y);
                    }
                    using (var path = CreateMaximizeFlafPath(rect, maximize))
                    {
                        g.FillPath(Brushes.White, path);
                        using (var pen2 = new Pen(controlBoxActive))
                        {
                            g.DrawPath(pen2, path);
                        }
                    }
                }
            }
        }
 public SkinFormCaptionRenderEventArgs(CForm skinForm, Graphics g, Rectangle clipRect, bool active)
     : base(g, clipRect)
 {
     SkinForm = skinForm;
     Active   = active;
 }
 public void Dispose()
 {
     _owner = null;
 }
 public ControlBoxManager(CForm owner)
 {
     _owner = owner;
 }