Exemple #1
0
        protected override void PaintRestore(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.None;

            Size s = new Size(10, 10);
            Rectangle rm = GetSignRect(r, s);
            Region oldClip = g.Clip;

            LinearGradientColorTable buttonTable = isEnabled ? ct.Foreground : new LinearGradientColorTable(GetDisabledColor(ct.Foreground.Start), GetDisabledColor(ct.Foreground.End), ct.Foreground.GradientAngle);
            using (Brush fill = DisplayHelp.CreateBrush(rm, ct.Foreground))
            {
                Rectangle inner = new Rectangle(rm.X + 4, rm.Y + 2, 6, 4);
                g.SetClip(inner, CombineMode.Exclude);
                g.SetClip(new Rectangle(rm.X + 1, rm.Y + 5, 6, 4), CombineMode.Exclude);

                g.FillRectangle(fill, rm.X + 3, rm.Y, 8, 7);
                g.ResetClip();

                inner = new Rectangle(rm.X + 1, rm.Y + 5, 6, 4);
                g.SetClip(inner, CombineMode.Exclude);
                g.FillRectangle(fill, rm.X, rm.Y + 3, 8, 7);
                g.ResetClip();
            }
            if (oldClip != null)
            {
                g.Clip = oldClip;
                oldClip.Dispose();
            }
            g.SmoothingMode = sm;
        }
Exemple #2
0
 protected override void PaintMinimize(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
 {
     Size s = new Size(9, 2);
     Rectangle rm = GetSignRect(r, s);
     if(isEnabled)
         DisplayHelp.FillRectangle(g, rm, ct.Foreground);
     else
         DisplayHelp.FillRectangle(g, rm, GetDisabledColor(ct.Foreground.Start), GetDisabledColor(ct.Foreground.End), ct.Foreground.GradientAngle);
 }
Exemple #3
0
        protected override void PaintMinimize(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            //SmoothingMode sm = g.SmoothingMode;
            //g.SmoothingMode = SmoothingMode.AntiAlias;

            Size s = new Size(11, 5);
            Rectangle rm = GetSignRect(r, s);

            DisplayHelp.DrawRoundedRectangle(g, ct.DarkShade, ct.Foreground, rm, 1);

            //g.SmoothingMode = sm;
        }
Exemple #4
0
        protected override void PaintMaximize(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            Size s = new Size(10, 10);
            Rectangle rm = GetSignRect(r, s);
            Region oldClip = g.Clip;

            Rectangle inner = new Rectangle(rm.X + 1, rm.Y + 3, ct.DarkShade.IsEmpty ? 8 : 7, ct.DarkShade.IsEmpty ? 6 : 5);
            g.SetClip(inner, CombineMode.Exclude);
            if(isEnabled)
                DisplayHelp.FillRectangle(g, rm, ct.Foreground);
            else
                DisplayHelp.FillRectangle(g, rm, GetDisabledColor(ct.Foreground.Start), GetDisabledColor(ct.Foreground.End), ct.Foreground.GradientAngle);

            if (oldClip != null)
            {
                g.Clip = oldClip;
                oldClip.Dispose();
            }
        }
Exemple #5
0
        protected override void PaintRestore(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            //SmoothingMode sm = g.SmoothingMode;
            //g.SmoothingMode = SmoothingMode.Default;
            
            Size s = new Size(12, 11);
            Rectangle rm = GetSignRect(r, s);
            Region oldClip = g.Clip;

            using (Brush fill = DisplayHelp.CreateBrush(rm, ct.Foreground))
            {
                using (Pen pen = new Pen(ct.DarkShade))
                {
                    using (GraphicsPath path = DisplayHelp.GetRoundedRectanglePath(new Rectangle(rm.X + 5, rm.Y, 8, 8), 1))
                    {
                        Rectangle inner = new Rectangle(rm.X + 7, rm.Y + 4, 4, 2);
                        g.SetClip(inner, CombineMode.Exclude);
                        g.SetClip(new Rectangle(rm.X, rm.Y + 3, 8, 8), CombineMode.Exclude);
                        g.FillPath(fill, path);
                        g.DrawPath(pen, path);
                        g.ResetClip();
                        g.DrawRectangle(pen, inner);
                    }
                    using (GraphicsPath path = DisplayHelp.GetRoundedRectanglePath(new Rectangle(rm.X, rm.Y + 3, 8, 8), 1))
                    {
                        Rectangle inner = new Rectangle(rm.X + 2, rm.Y + 7, 4, 2);
                        g.SetClip(inner, CombineMode.Exclude);
                        g.FillPath(fill, path);
                        g.DrawPath(pen, path);
                        g.ResetClip();
                        g.DrawRectangle(pen, inner);
                    }
                }
            }
            if (oldClip != null)
            {
                g.Clip = oldClip;
                oldClip.Dispose();
            }
            //g.SmoothingMode = sm;
        }
Exemple #6
0
        protected override void PaintMaximize(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            Size s = new Size(11, 9);
            Rectangle rm = GetSignRect(r, s);
            Region oldClip = g.Clip;

            using (Brush fill = DisplayHelp.CreateBrush(rm, ct.Foreground))
            {
                using (Pen pen = new Pen(ct.DarkShade))
                {
                    Rectangle inner = new Rectangle(rm.X + 3, rm.Y + 3, ct.DarkShade.IsEmpty ? 5 : 4, ct.DarkShade.IsEmpty ? 3 : 2);
                    g.SetClip(inner, CombineMode.Exclude);
                    DisplayHelp.DrawRoundedRectangle(g, pen, fill, rm.X, rm.Y, rm.Width, rm.Height, 1);
                    g.ResetClip();
                    g.DrawRectangle(pen, inner);
                }
            }

            if (oldClip != null)
            {
                g.Clip = oldClip;
                oldClip.Dispose();
            }
        }
Exemple #7
0
        protected override void PaintClose(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;

            Size s = new Size(11, 9);
            Rectangle rm = GetSignRect(r, s);

            Rectangle r1 = rm;
            r1.Inflate(-1, 0);
            r1.Height--;

            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddLine(r1.X + 1, r1.Y, r1.X + 3, r1.Y);
                path.AddLine(r1.X + 3, r1.Y, r1.X + 5, r1.Y + 2);
                path.AddLine(r1.X + 5, r1.Y + 2, r1.X + 7, r1.Y);
                path.AddLine(r1.X + 7, r1.Y, r1.X + 9, r1.Y);
                path.AddLine(r1.X + 10, r1.Y + 1, r1.X + 7, r1.Y + 4);
                path.AddLine(r1.X + 7, r1.Y + 4, r1.X + 10, r1.Y + 7);
                path.AddLine(r1.X + 10, r1.Y + 7, r1.X + 9, r1.Y + 8);
                path.AddLine(r1.X + 9, r1.Y + 8, r1.X + 7, r1.Y + 8);
                path.AddLine(r1.X + 7, r1.Y + 8, r1.X + 5, r1.Y + 6);
                path.AddLine(r1.X + 5, r1.Y + 6, r1.X + 3, r1.Y + 8);
                path.AddLine(r1.X + 3, r1.Y + 8, r1.X + 1, r1.Y + 8);
                path.AddLine(r1.X, r1.Y + 7, r1.X + 3, r1.Y + 4);
                path.AddLine(r1.X + 3, r1.Y + 4, r1.X, r1.Y + 1);

                if (isEnabled)
                {
                    DisplayHelp.FillPath(g, path, ct.Foreground);
                    if (!ct.DarkShade.IsEmpty)
                    {
                        using (Pen pen = new Pen(ct.DarkShade))
                        {
                            g.DrawPath(pen, path);
                        }
                    }
                    else
                    {
                        using (Pen pen = new Pen(ct.Foreground.Start))
                        {
                            g.DrawPath(pen, path);
                        }
                    }
                }
                else
                {
                    LinearGradientColorTable lg = new LinearGradientColorTable(ct.Foreground.Start.IsEmpty ? ct.Foreground.Start : Color.FromArgb(128, ct.Foreground.Start),
                        ct.Foreground.End.IsEmpty ? ct.Foreground.End : Color.FromArgb(128, ct.Foreground.End),
                        ct.Foreground.GradientAngle);
                    DisplayHelp.FillPath(g, path, lg);
                    DisplayHelp.DrawGradientPathBorder(g, path, lg, 1);
                }
            }

            g.SmoothingMode = sm;
        }
Exemple #8
0
        protected override void PaintHelp(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            SmoothingMode sm = g.SmoothingMode;
            TextRenderingHint th = g.TextRenderingHint;
            g.SmoothingMode = SmoothingMode.Default;
            g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
#if FRAMEWORK20
            using (Font font = new Font(SystemFonts.DefaultFont, FontStyle.Bold))
#else
			using(Font font = new Font("Arial", 10, FontStyle.Bold))
#endif
            {
                Size s = TextDrawing.MeasureString(g, "?", font);
                s.Width += 4;
                s.Height -= 2;
                Rectangle rm = GetSignRect(r, s);

                rm.Offset(1, 1);
                using (SolidBrush brush = new SolidBrush(ct.DarkShade))
                    g.DrawString("?", font, brush, rm);
                rm.Offset(-1, -1);
                using (SolidBrush brush = new SolidBrush(ct.Foreground.Start))
                    g.DrawString("?", font, brush, rm);

            }
            g.SmoothingMode = sm;
            g.TextRenderingHint = th;
        }
Exemple #9
0
        protected override void PaintClose(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;

            Size s = new Size(8, 8);
            Rectangle rm = GetSignRect(r, s);

            Rectangle r1 = rm;
            r1.Offset(0, -1);

            if (isEnabled)
            {
                using (Pen pen = new Pen(ct.Foreground.Start, 2))
                {
                    g.DrawLine(pen, r1.X, r1.Y, r1.Right, r1.Bottom);
                    g.DrawLine(pen, r1.Right, r1.Y, r1.X, r1.Bottom);
                }
            }
            else
            {
                using (Pen pen = new Pen(GetDisabledColor(ct.Foreground.Start), 2))
                {
                    g.DrawLine(pen, r1.X, r1.Y, r1.Right, r1.Bottom);
                    g.DrawLine(pen, r1.Right, r1.Y, r1.X, r1.Bottom);
                }
            }

            g.SmoothingMode = sm;
        }
Exemple #10
0
        protected virtual void PaintMaximize(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;

            Size s = new Size(9, 8);
            Rectangle rm = GetSignRect(r, s);

            Color color = isEnabled ? ct.DarkShade : Color.FromArgb(128, ct.DarkShade);
            DisplayHelp.DrawLine(g, rm.X, rm.Y, rm.Right - 1, rm.Y, color, 1);
            rm.Y++;
            rm.Height--;
            color = isEnabled ? ct.Foreground.Start : Color.FromArgb(128, ct.Foreground.Start);
            DisplayHelp.DrawLine(g, rm.X, rm.Y, rm.Right - 1, rm.Y, color, 1);
            rm.Y++;
            rm.Height--;
            Rectangle r1 = rm;
            r1.Height--;
            if(isEnabled)
                DisplayHelp.DrawGradientRectangle(g, r1, ct.Foreground, 1);
            else
                DisplayHelp.DrawGradientRectangle(g, r1, Color.FromArgb(128, ct.Foreground.Start), Color.FromArgb(128, ct.Foreground.End), ct.Foreground.GradientAngle, 1);

            color = isEnabled ? ct.LightShade : Color.FromArgb(128, ct.LightShade);
            DisplayHelp.DrawLine(g, rm.X, rm.Bottom - 1, rm.Right - 1, rm.Bottom - 1, color, 1);

            g.SmoothingMode = sm;
        }
Exemple #11
0
        protected virtual void PaintRestore(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;

            Size s = new Size(9, 8);
            Rectangle rm = GetSignRect(r, s);

            Rectangle r1 = new Rectangle(rm.X, rm.Y + 1, 7, 7);
            Region oldClip = g.Clip;
            for (int i = 0; i < 2; i++)
            {
                DisplayHelp.DrawGradientRectangle(g, new Rectangle(r1.X, r1.Y + 1, r1.Width, r1.Height - 1), ct.Foreground, 1);
                DisplayHelp.DrawLine(g, r1.X, r1.Y, r1.Right - 1, r1.Y, ct.DarkShade, 1);
                DisplayHelp.DrawLine(g, r1.X + 1, r1.Y + 2, r1.Right - 2, r1.Y + 2, ct.LightShade, 1);
                DisplayHelp.DrawLine(g, r1.X + 1, r1.Y + 2, r1.Right - 2, r1.Y + 2, ct.LightShade, 1);
                g.SetClip(r1, CombineMode.Exclude);
                r1.Offset(2, -1);
            }

            if (oldClip != null)
                g.Clip = oldClip;
            else
                g.ResetClip();

            g.SmoothingMode = sm;
        }
Exemple #12
0
        protected virtual void PaintMinimize(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct, bool isEnabled)
        {
            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;

            Size s = new Size(7, 3);
            Rectangle rm = GetSignRect(r, s);

            DisplayHelp.DrawLine(g, rm.X, rm.Y, rm.Right, rm.Y, ct.DarkShade, 1);
            rm.Offset(0, 1);
            DisplayHelp.DrawLine(g, rm.X, rm.Y, rm.Right, rm.Y, ct.Foreground.Start, 1);
            rm.Offset(0, 1);
            DisplayHelp.DrawLine(g, rm.X, rm.Y, rm.Right, rm.Y, ct.LightShade, 1);

            g.SmoothingMode = sm;
        }
Exemple #13
0
        /// <summary>
        /// Paints the background of the button using specified color table colors.
        /// </summary>
        /// <param name="g">Graphics object.</param>
        /// <param name="r">Background bounds</param>
        /// <param name="ct">Color Table</param>
        protected virtual void PaintBackground(Graphics g, Rectangle r, Office2007SystemButtonStateColorTable ct)
        {
            int cornerSize = 2;
            Rectangle border = r;
            if (ct.OuterBorder != null && !ct.OuterBorder.IsEmpty)
                r.Inflate(-1, -1);

            Rectangle rt = new Rectangle(r.X, r.Y, r.Width, r.Height / 2);
            if (ct.TopBackground!=null && !ct.TopBackground.IsEmpty)
            {
                rt.Height++;
                if (ct.BottomBackground == null) rt = r;
                DisplayHelp.FillRectangle(g, rt, ct.TopBackground);
                rt.Height--;
            }

            //Region oldClip = g.Clip;

            if (ct.BottomBackground!=null && !ct.BottomBackground.IsEmpty)
            {
                rt.Y += rt.Height;
                rt.Height = (r.Height - rt.Height);
                DisplayHelp.FillRectangle(g, rt, ct.BottomBackground);
            }

            // Highlight
            if (ct.TopHighlight != null && !ct.TopHighlight.IsEmpty)
            {
                Rectangle fill = r;
                fill.Height = fill.Height / 2;
                DrawHighlight(g, ct.TopHighlight, fill, new PointF(fill.X + fill.Width / 2, fill.Bottom));
            }

            // Highlight
            if (ct.BottomHighlight != null && !ct.BottomHighlight.IsEmpty)
            {
                Rectangle fill = r;
                fill.Height = fill.Height / 2;
                fill.Y += (r.Height - fill.Height);
                DrawHighlight(g, ct.BottomHighlight, fill, new PointF(fill.X + fill.Width / 2, fill.Bottom));
            }

            if (ct.OuterBorder!=null && !ct.OuterBorder.IsEmpty)
            {
                DisplayHelp.DrawRoundGradientRectangle(g, border, ct.OuterBorder, 1, cornerSize);
                border.Inflate(-1, -1);
            }

            if (ct.InnerBorder != null && !ct.InnerBorder.IsEmpty)
            {
                DisplayHelp.DrawRoundGradientRectangle(g, border, ct.InnerBorder, 1, cornerSize);
            }
        }