private void DrawShape(Graphics g, DecorationMode mode, DecorationShape ds, Pen pen, Rectangle rect) { const int margin = 5; Rectangle where = rect; where.Inflate(-margin, 0); if (mode == DecorationMode.None) { return; } switch (ds) { case DecorationShape.Rectangle: g.DrawRectangle(pen, where); break; case DecorationShape.Ellipse: g.DrawEllipse(pen, where); break; case DecorationShape.Cross: g.DrawLine(pen, new Point(where.X, where.Y), new Point(where.X + where.Width, where.Y + where.Height)); g.DrawLine(pen, new Point(where.X + where.Width, where.Y), new Point(where.X, where.Y + where.Height)); break; default: throw new Exception("Unknown shape"); } }
public Decoration(DecorationMode mode, DecorationShape shape, PenStyle penstyle, int padding) { this.mode = mode; this.shape = shape; this.penstyle = penstyle; this.padding = padding; }
public Decoration(DecorationMode mode, DecorationShape shape) { this.mode = mode; this.shape = shape; this.penstyle = new PenStyle(Color.Black, 1.0f, DashStyle.Solid, ArrowStyle.None); this.padding = 4; }
private void DrawShape(Graphics g, DecorationMode mode, DecorationShape ds, Pen pen, Rectangle rect) { const int margin = 5; Rectangle where = rect; where.Inflate(-margin, 0); if (mode == DecorationMode.None) return; switch (ds) { case DecorationShape.Rectangle: g.DrawRectangle(pen, where); break; case DecorationShape.Ellipse: g.DrawEllipse(pen, where); break; case DecorationShape.Cross: g.DrawLine(pen, new Point(where.X, where.Y), new Point(where.X + where.Width, where.Y + where.Height)); g.DrawLine(pen, new Point(where.X + where.Width, where.Y), new Point(where.X, where.Y + where.Height)); break; default: throw new Exception("Unknown shape"); } }