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