Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

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


PolyBezier(): To draw a bézier curve, the CDC provides the PolyBezier() method. Its
syntax is:

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

The lpPoints argument is an array of POINT or CPoint values. The nCount argument
specifies the number of points that will be used to draw the line. Here is an example:

void CExoView::OnDraw(CDC* pDC)
{
CPoint Pt[4] = { CPoint(20, 12), CPoint(88, 246),
CPoint(364, 192), CPoint(250, 48) };

pDC->PolyBezier(Pt, 4);
}

In the same way, you can draw a series of complicated subsequent lines. This is done by
adding reference points to the array. To do this, you must add points in increments of
three. After drawing the first curve based on the first four points, to draw the next line,
the function would use the fourth point as the starting point. Since the bézier line requires
Free download pdf