public void Draw(Graphics graphics) { Pen pen = new Pen(BorderStyle.Color, BorderStyle.Width); pen.DashStyle = BorderStyle.Type; //установить паттерн if (BorderStyle.Type != DashStyle.Solid) { pen.DashPattern = DefaultDashPatterns.GetPattern(BorderStyle.Type); } //Point start = new Point(Center.X - Radius, Center.Y - Radius); //Point end = new Point(Center.X + Radius, Center.Y + Radius); Rectangle rect = new Rectangle(Center.X - Radius, Center.Y - Radius, Radius * 2, Radius * 2); if (FillStyle.isFilled) { SolidBrush brush = new SolidBrush(FillStyle.Color); graphics.FillEllipse(brush, rect); brush.Dispose(); } graphics.DrawEllipse(pen, rect); pen.Dispose(); }
public virtual void Draw(Graphics graphics) { Point center = new Point((StartPoint.X + EndPoint.X) / 2, (StartPoint.Y + EndPoint.Y) / 2); Size halfSize = GetHalfSize(); Rectangle rect = new Rectangle(center - halfSize, halfSize + halfSize); Matrix m = new Matrix(); m.RotateAt(Angle, center); graphics.Transform = m; Pen pen = new Pen(BorderStyle.Color, BorderStyle.Width); pen.DashStyle = BorderStyle.Type; //установить паттерн if (BorderStyle.Type != DashStyle.Solid) { pen.DashPattern = DefaultDashPatterns.GetPattern(BorderStyle.Type); } if (FillStyle.isFilled) { SolidBrush brush = new SolidBrush(FillStyle.Color); graphics.FillRectangle(brush, rect); brush.Dispose(); } graphics.DrawRectangle(pen, rect); graphics.ResetTransform(); pen.Dispose(); }
public void Draw(Graphics graphics) { Pen pen = new Pen(LineStyle.Color, LineStyle.Width); pen.DashStyle = LineStyle.Type; //установить паттерн if (LineStyle.Type != DashStyle.Solid) { pen.DashPattern = DefaultDashPatterns.GetPattern(LineStyle.Type); } graphics.DrawLines(pen, Points); }