Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 7: GDI Accessories and Tools


Pt[10] = CPoint(170, 140);
Pt[11] = CPoint(230, 110);

pDC->PolyPolygon(Pt, lpPts, 4);
}

6.3.6 Rectangles and Squares......................................................................


A rectangle is a geometric figure made of four sides that compose four right angles. Like
the line, to draw a rectangle, you must define where it starts and where it ends. This can
be illustrated as follows:

The drawing of a rectangle typically starts from a point defined as (X1, Y1) and ends at
another point (X2, Y2).

To draw a rectangle, you can use the CDC::Rectangle() method. Its syntax is:

BOOL Rectangle(int x1, int y1, int x2, int y2);
Free download pdf