Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

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


pDC->Polyline(Pt, 7);
}

Besides the Polyline() method, the CDC class provides the PolylineTo() member
function. Its syntax is:

BOOL PolylineTo(const POINT* lpPoints, int nCount);

The lpPoints argument is the name of an array of POINT or CPoint objects. The nCount
argument specifies the number of points that would be included in the figure. Here is an
example:

void CExoView::OnDraw(CDC* pDC)
{
CPoint Pt[7];

Pt[0] = CPoint(20, 50);
Pt[1] = CPoint(180, 50);
Pt[2] = CPoint(180, 20);
Pt[3] = CPoint(230, 70);
Pt[4] = CPoint(180, 120);
Pt[5] = CPoint(180, 90);
Pt[6] = CPoint(20, 90);

pDC->PolylineTo(Pt, 7);
}
Free download pdf