public override void RenderViewButton(ViewButton viewButton, Graphics graphics, Rectangle bounds, bool focus, bool hover, bool pressed)
 {
     if (hover || pressed)
     {
         var rc = bounds;
         rc.Width  -= 1;
         rc.Height -= 1;
         Color border;
         Color background;
         if (pressed)
         {
             border     = ColorTable.ViewButtonPressedBorder;
             background = ColorTable.ViewButtonPressedBackground;
         }
         else
         {
             border     = ColorTable.ViewButtonHoverBorder;
             background = ColorTable.ViewButtonHoverBackground;
         }
         using (var brush = new SolidBrush(background))
         {
             graphics.FillRectangle(brush, rc);
         }
         using (var pen = new Pen(border))
         {
             graphics.DrawRectangle(pen, rc);
         }
     }
     if (viewButton.Image != null)
     {
         graphics.DrawImage(viewButton.Image, bounds);
     }
 }
示例#2
0
 public abstract void RenderViewButton(ViewButton viewButton, Graphics graphics, Rectangle bounds, bool focus, bool hover, bool pressed);
示例#3
0
 public override void RenderViewButton(ViewButton viewButton, Graphics graphics, Rectangle bounds, bool focus, bool hover, bool pressed)
 {
     if(hover || pressed)
     {
         var rc = bounds;
         rc.Width -= 1;
         rc.Height -= 1;
         Color border;
         Color background;
         if(pressed)
         {
             border = ColorTable.ViewButtonPressedBorder;
             background = ColorTable.ViewButtonPressedBackground;
         }
         else
         {
             border = ColorTable.ViewButtonHoverBorder;
             background = ColorTable.ViewButtonHoverBackground;
         }
         using(var brush = new SolidBrush(background))
         {
             graphics.FillRectangle(brush, rc);
         }
         using(var pen = new Pen(border))
         {
             graphics.DrawRectangle(pen, rc);
         }
     }
     if(viewButton.Image != null)
     {
         graphics.DrawImage(viewButton.Image, bounds);
     }
 }
示例#4
0
 public override void RenderViewButton(ViewButton viewButton, Graphics graphics, Rectangle bounds, bool focus, bool hover, bool pressed)
 {
     if(hover || pressed)
     {
         var rc = bounds;
         rc.Width -= 1;
         rc.Height -= 1;
         var backgroundColor = pressed ?
             ColorTable.ViewButtonPressedBackground :
             focus ? ColorTable.ViewButtonHoverBackgroundActive : ColorTable.ViewButtonHoverBackgroundInactive;
         using(var brush = new SolidBrush(backgroundColor))
         {
             graphics.FillRectangle(brush, rc);
         }
     }
     switch(viewButton.Type)
     {
         case ViewButtonType.TabsMenu:
             {
                 int x = bounds.X + (bounds.Width - 8) / 2;
                 int y = bounds.Y + (bounds.Height - 8) / 2;
                 using(var brush = new SolidBrush(ColorTable.ViewButtonForeground))
                 {
                     graphics.FillPolygon(brush, new[]
                         {
                             new Point(x + 1, y + 4),
                             new Point(x + 7, y + 4),
                             new Point(x + 4, y + 7),
                             new Point(x + 3, y + 7),
                         });
                 }
                 using(var pen = new Pen(Color.FromArgb(120, ColorTable.ViewButtonForeground)))
                 {
                     graphics.DrawLine(pen, x + 0, y + 4, x + 3, y + 7);
                     graphics.DrawLine(pen, x + 4, y + 7, x + 7, y + 4);
                 }
             }
             break;
         case ViewButtonType.TabsScrollMenu:
             {
                 int x = bounds.X + (bounds.Width - 8) / 2;
                 int y = bounds.Y + (bounds.Height - 8) / 2;
                 using(var brush = new SolidBrush(ColorTable.ViewButtonForeground))
                 {
                     graphics.FillRectangle(brush, x, y, 8, 2);
                     graphics.FillPolygon(brush, new[]
                         {
                             new Point(x + 1, y + 4),
                             new Point(x + 7, y + 4),
                             new Point(x + 4, y + 7),
                             new Point(x + 3, y + 7),
                         });
                 }
                 using(var pen = new Pen(Color.FromArgb(120, ColorTable.ViewButtonForeground)))
                 {
                     graphics.DrawLine(pen, x + 0, y + 4, x + 3, y + 7);
                     graphics.DrawLine(pen, x + 4, y + 7, x + 7, y + 4);
                 }
             }
             break;
         case ViewButtonType.ScrollTabsLeft:
             {
                 using(var brush = new SolidBrush(ColorTable.ViewButtonForeground))
                 {
                     var p1 = new Point(bounds.X + (bounds.Width - 5) / 2, bounds.Y + bounds.Height / 2);
                     var p2 = new Point(p1.X + 5, p1.Y - 5);
                     var p3 = new Point(p1.X + 5, p1.Y + 5);
                     var triangle = new[] { p1, p2, p3 };
                     graphics.FillPolygon(brush, triangle);
                 }
             }
             break;
         case ViewButtonType.ScrollTabsRight:
             {
                 using(var brush = new SolidBrush(ColorTable.ViewButtonForeground))
                 {
                     var p1 = new Point(bounds.X + bounds.Width - (bounds.Width - 5) / 2, bounds.Y + bounds.Height / 2);
                     var p2 = new Point(p1.X - 5, p1.Y - 5);
                     var p3 = new Point(p1.X - 5, p1.Y + 5);
                     var triangle = new[] { p1, p2, p3 };
                     graphics.FillPolygon(brush, triangle);
                 }
             }
             break;
         case ViewButtonType.Normalize:
             {
                 int x = bounds.X + (bounds.Width - 10) / 2;
                 int y = bounds.Y + (bounds.Height - 10) / 2;
                 using(var pen = new Pen(ColorTable.ViewButtonForeground))
                 {
                     graphics.DrawRectangle(pen, x + 0, y + 3, 6, 6);
                     graphics.DrawLine(pen, x + 1, y + 4, x + 5, y + 4);
                     graphics.DrawLine(pen, x + 3, y + 0, x + 3, y + 2);
                     graphics.DrawLine(pen, x + 9, y + 0, x + 9, y + 6);
                     graphics.DrawLine(pen, x + 9, y + 0, x + 9, y + 6);
                     graphics.DrawLine(pen, x + 4, y + 0, x + 8, y + 0);
                     graphics.DrawLine(pen, x + 4, y + 1, x + 8, y + 1);
                     graphics.DrawLine(pen, x + 7, y + 6, x + 8, y + 6);
                 }
             }
             break;
         case ViewButtonType.Maximize:
             {
                 int x = bounds.X + (bounds.Width - 9) / 2;
                 int y = bounds.Y + (bounds.Height - 9) / 2;
                 using(var pen = new Pen(ColorTable.ViewButtonForeground))
                 {
                     graphics.DrawRectangle(pen, x + 0, y + 0, 8, 8);
                     graphics.DrawLine(pen, x + 1, y + 1, x + 7, y + 1);
                     graphics.DrawLine(pen, x + 1, y + 2, x + 7, y + 2);
                 }
             }
             break;
         case ViewButtonType.Unpin:
             {
                 int x = bounds.X + (bounds.Width - 11) / 2;
                 int y = bounds.Y + (bounds.Height - 11) / 2;
                 using(var pen = new Pen(ColorTable.ViewButtonForeground))
                 {
                     graphics.DrawLine(pen, x + 3, y + 0, x + 7, y + 0);
                     graphics.DrawLine(pen, x + 3, y + 1, x + 3, y + 5);
                     graphics.DrawLine(pen, x + 6, y + 1, x + 6, y + 5);
                     graphics.DrawLine(pen, x + 7, y + 1, x + 7, y + 5);
                     graphics.DrawLine(pen, x + 2, y + 6, x + 8, y + 6);
                     graphics.DrawLine(pen, x + 5, y + 7, x + 5, y + 10);
                 }
             }
             break;
         case ViewButtonType.Pin:
             {
                 int x = bounds.X + (bounds.Width - 11) / 2;
                 int y = bounds.Y + (bounds.Height - 11) / 2;
                 using(var pen = new Pen(ColorTable.ViewButtonForeground))
                 {
                     graphics.DrawLine(pen, x + 10, y + 3, x + 10, y + 7);
                     graphics.DrawLine(pen, x + 9, y + 3, x + 5, y + 3);
                     graphics.DrawLine(pen, x + 9, y + 6, x + 5, y + 6);
                     graphics.DrawLine(pen, x + 9, y + 7, x + 5, y + 7);
                     graphics.DrawLine(pen, x + 4, y + 2, x + 4, y + 8);
                     graphics.DrawLine(pen, x + 3, y + 5, x + 0, y + 5);
                 }
             }
             break;
         case ViewButtonType.Close:
             {
                 int x = bounds.X + (bounds.Width - 10) / 2;
                 int y = bounds.Y + (bounds.Height - 10) / 2;
                 using(var pen = new Pen(Color.FromArgb(120, ColorTable.ViewButtonForeground)))
                 {
                     graphics.DrawLine(pen, x + 0, y + 1, x + 7, y + 8);
                     graphics.DrawLine(pen, x + 2, y + 1, x + 9, y + 8);
                     graphics.DrawLine(pen, x + 7, y + 1, x + 0, y + 8);
                     graphics.DrawLine(pen, x + 9, y + 1, x + 2, y + 8);
                 }
                 using(var pen = new Pen(ColorTable.ViewButtonForeground))
                 {
                     graphics.DrawLine(pen, x + 1, y + 1, x + 8, y + 8);
                     graphics.DrawLine(pen, x + 8, y + 1, x + 1, y + 8);
                 }
             }
             break;
         default:
             if(viewButton.Image != null)
             {
                 graphics.DrawImage(viewButton.Image, bounds);
             }
             break;
     }
 }
示例#5
0
 public abstract void RenderViewButton(ViewButton viewButton, Graphics graphics, Rectangle bounds, bool focus, bool hover, bool pressed);