示例#1
0
 public static void DrawCheckBox(Graphics g, RoundRectangle roundRect)
 {
     using (GraphicsPath path = roundRect.ToGraphicsBezierPath())
     {
         using (PathGradientBrush pathGradientBrush = new PathGradientBrush(path))
         {
             pathGradientBrush.CenterColor    = SkinManager.CurrentSkin.BaseColor;
             pathGradientBrush.SurroundColors = new Color[1]
             {
                 SkinManager.CurrentSkin.BorderColor
             };
             Blend blend = new Blend();
             blend.Positions = new float[3]
             {
                 0f,
                 0.18f,
                 1f
             };
             blend.Factors = new float[3]
             {
                 0f,
                 0.89f,
                 1f
             };
             pathGradientBrush.Blend = blend;
             g.FillPath(pathGradientBrush, path);
         }
         DrawPathBorder(g, roundRect);
     }
 }
示例#2
0
 public static void DrawPathBorder(Graphics g, RoundRectangle roundRect, Color color, int borderWidth)
 {
     using (GraphicsPath path = roundRect.ToGraphicsBezierPath())
     {
         using (Pen pen = new Pen(color, (float)borderWidth))
         {
             g.DrawPath(pen, path);
         }
     }
 }
示例#3
0
 private void ResetRegion()
 {
     if (_CornerRadius > 0)
     {
         Rectangle      rect           = new Rectangle(Point.Empty, base.Size);
         RoundRectangle roundRectangle = new RoundRectangle(rect, new CornerRadius(_CornerRadius));
         if (base.Region != null)
         {
             base.Region.Dispose();
         }
         base.Region = new Region(roundRectangle.ToGraphicsBezierPath());
     }
 }
示例#4
0
 public static void FillPath(Graphics g, RoundRectangle roundRect, Color color1, Color color2)
 {
     if (roundRect.Rect.Width > 0 && roundRect.Rect.Height > 0)
     {
         using (GraphicsPath path = roundRect.ToGraphicsBezierPath())
         {
             using (LinearGradientBrush brush = new LinearGradientBrush(roundRect.Rect, color1, color2, LinearGradientMode.Vertical))
             {
                 g.FillPath(brush, path);
             }
         }
     }
 }
示例#5
0
 public static void FillRectangle(Graphics g, RoundRectangle roundRect, Color color)
 {
     if (roundRect.Rect.Width > 0 && roundRect.Rect.Height > 0)
     {
         using (GraphicsPath path = roundRect.ToGraphicsBezierPath())
         {
             using (Brush brush = new SolidBrush(color))
             {
                 g.FillPath(brush, path);
             }
         }
     }
 }
示例#6
0
 internal void CreateToolStripRegion(ToolStrip toolStrip, RoundRectangle roundRect)
 {
     using (GraphicsPath graphicsPath = roundRect.ToGraphicsBezierPath())
     {
         Region region = new Region(graphicsPath);
         graphicsPath.Widen(new Pen(MenuBorderColor));
         region.Union(graphicsPath);
         if (toolStrip.Region != null)
         {
             toolStrip.Region.Dispose();
         }
         toolStrip.Region = region;
     }
 }
示例#7
0
 public static void FillRectangle(Graphics g, RoundRectangle roundRect, GradientColor color)
 {
     if (roundRect.Rect.Width > 0 && roundRect.Rect.Height > 0)
     {
         using (GraphicsPath path = roundRect.ToGraphicsBezierPath())
         {
             using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(roundRect.Rect, color.First, color.Second, LinearGradientMode.Vertical))
             {
                 linearGradientBrush.Blend.Factors   = color.Factors;
                 linearGradientBrush.Blend.Positions = color.Positions;
                 g.FillPath(linearGradientBrush, path);
             }
         }
     }
 }
示例#8
0
 private void DrawFormBorder(Graphics g)
 {
     if (base.WindowState != FormWindowState.Maximized)
     {
         Rectangle      rect           = new Rectangle(0, 0, base.Width - 2, base.Height - 2);
         RoundRectangle roundRectangle = new RoundRectangle(rect, new CornerRadius(CornerRadius));
         GDIHelper.DrawPathBorder(g, roundRectangle);
         using (GraphicsPath path = (_CornerRadius == 0) ? roundRectangle.ToGraphicsBezierPath() : roundRectangle.ToGraphicsArcPath())
         {
             using (Pen pen = new Pen(SkinManager.CurrentSkin.BorderColor))
             {
                 g.DrawPath(pen, path);
             }
         }
     }
 }