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); } }
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); } } }
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()); } }
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); } } } }
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); } } } }
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; } }
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); } } } }
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); } } } }