Working with Rectangles

Before learning how to draw shapes, you need to understand the concept of a rectangle as it relates to C# programming. A rectangle isn't necessarily used to draw a rectangle (although it can be). Rather, a rectangle is a structure used to hold bounding coordinates used to draw a shape. Obviously, a square or rectangle can fit within a rectangle. However, so can circles and ellipses. Figure 10.3 illustrates how most shapes can be bound by a rectangle.

Figure 10.3. Rectangles are used to define the bounds of most shapes.

To draw most shapes, you must have a rectangle. The rectangle you pass to a drawing method is used as a ...

Get Sams Teach Yourself C#™ in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.