Graphics.DrawRectangle

DrawRectangle(Pen, int, int, int, int)

Draws a rectangle specified by a coordinate pair, a width, and a height.

public void DrawRectangle(Pen pen, int x, int y, int width, int height)
ParameterTypeDescription
penPenPen that determines the color, width, and style of the rectangle.
xInt32The x-coordinate of the upper-left corner of the rectangle to draw.
yInt32The y-coordinate of the upper-left corner of the rectangle to draw.
widthInt32Width of the rectangle to draw.
heightInt32Height of the rectangle to draw.

See Also


DrawRectangle(Pen, Rectangle)

Draws a rectangle specified by a Rectangle structure.

public void DrawRectangle(Pen pen, Rectangle rect)
ParameterTypeDescription
penPenA Pen that determines the color, width, and style of the rectangle.
rectRectangleA Rectangle structure that represents the rectangle to draw.

See Also


DrawRectangle(Pen, float, float, float, float)

Draws a rectangle specified by a coordinate pair, a width, and a height.

public void DrawRectangle(Pen pen, float x, float y, float width, float height)
ParameterTypeDescription
penPenA Pen that determines the color, width, and style of the rectangle.
xSingleThe x-coordinate of the upper-left corner of the rectangle to draw.
ySingleThe y-coordinate of the upper-left corner of the rectangle to draw.
widthSingleThe width of the rectangle to draw.
heightSingleThe height of the rectangle to draw.

See Also