Beispiel #1
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            System.Drawing.Point[] DropPoints =
            {
                new Point(0,  0),
                new Point(11, 0),
                new Point(5, 6)
            };
            System.Drawing.Point[] ClosePoints =
            {
                new Point(0,  0),
                new Point(2,  0),
                new Point(5,  3),
                new Point(8,  0),
                new Point(10, 0),
                new Point(6,  4),
                new Point(10, 8),
                new Point(8,  8),
                new Point(5,  5),
                new Point(2,  8),
                new Point(0,  8),
                new Point(4, 4)
            };
            Rectangle rec = new Rectangle();

            rec.Size = new Size(this.Width - 1, this.Height - 1);
            if (m_hot)
            {
                e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias;
                e.Graphics.FillRectangle(new Drawing2D.LinearGradientBrush(new Point(0, 0), new Point(0, this.Height), RenderColors.ControlButtonBackHighColor(m_RenderMode, m_BackHighColor), RenderColors.ControlButtonBackLowColor(m_RenderMode, m_BackLowColor)), rec);
                e.Graphics.DrawRectangle(new Pen(RenderColors.ControlButtonBorderColor(m_RenderMode, m_BorderColor)), rec);
                e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.Default;
            }
            Drawing2D.GraphicsPath g = new Drawing2D.GraphicsPath();
            Drawing2D.Matrix       m = new Drawing2D.Matrix();
            int x = (this.Width - 11) / 2;
            int y = (this.Height - 11) / 2 + 1;

            if (m_style == ButtonStyle.Drop)
            {
                e.Graphics.FillRectangle(new SolidBrush(ForeColor), x, y, 11, 2);
                g.AddPolygon(DropPoints);
                m.Translate(x, y + 3);
                g.Transform(m);
                e.Graphics.FillPolygon(new SolidBrush(ForeColor), g.PathPoints);
            }
            else
            {
                g.AddPolygon(ClosePoints);
                m.Translate(x, y);
                g.Transform(m);
                e.Graphics.DrawPolygon(new Pen(ForeColor), g.PathPoints);
                e.Graphics.FillPolygon(new SolidBrush(ForeColor), g.PathPoints);
            }
            g.Dispose();
            m.Dispose();
        }
 public static Office2007Renderer GetRenderer(RenderColors Color)
 {
     if (Color == RenderColors.Black)
     {
         return new Office2007Renderer(true);
     }
     return new Office2007Renderer();
 }