public void FillRectangle(Point location, Size size, Color color) { var rectangle = new RectangleF(location.ToPointF(), size.ToSizeF()); using (var brush = new SolidBrush(color.ToColor())) { m_Graphics.FillRectangle(brush, rectangle); } }
public void FillPolygon(IEnumerable <Point> points, Color color) { var pointsF = points.Select(p => p.ToPointF()).ToArray(); using (var brush = new SolidBrush(color.ToColor())) { m_Graphics.FillPolygon(brush, pointsF); } }
public void DrawRectangle(Point location, Size size, Color color, LineStyle lineStyle) { var rectangle = new RectangleF(location.ToPointF(), size.ToSizeF()); using (var pen = new Pen(color.ToColor())) { Point topLeft = location; Point topRight = location.Offset(size.Width, 0); Point bottomLeft = location.Offset(0, size.Height); Point bottomRight = location.Offset(size.Width, size.Height); DrawLineCore(topLeft, topRight, pen.Width, color, lineStyle); DrawLineCore(topRight, bottomRight, pen.Width, color, lineStyle); DrawLineCore(bottomRight, bottomLeft, pen.Width, color, lineStyle); DrawLineCore(bottomLeft, topLeft, pen.Width, color, lineStyle); } }