Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 8 GDI Orientation and Transformations Visual C++ and MFC Fundamentals


LogPen.lopnWidth = CPoint(1, 105);
LogPen.lopnColor = RGB(235, 115, 5);

NewPen.CreatePenIndirect(&LogPen);

CPen* pPen = pDC->SelectObject(&NewPen);

pDC->Ellipse(60, 40, 82, 80);
pDC->Ellipse(80, 20, 160, 125);
pDC->Ellipse(158, 40, 180, 80);

pDC->Ellipse(100, 60, 110, 70);
pDC->Ellipse(130, 60, 140, 70);
pDC->Ellipse(100, 90, 140, 110);

// Restore the previous pen
pDC->SelectObject(pPen);
}

7.5.4 Retrieving a Pen...................................................................................


If you want to know the currently selected pen used on a device context, you can call the
CPen::GetLogPen() member function. Its syntax is:

int GetLogPen(LOGPEN* pLogPen);

To get the characteristics of the current pen, pass a pointer to the LOGPEN structure to
this GetLogPen() method. The returned pLogPen value would give you the style, the
width, and the color of the pen.

7.6 Brushes...........................................................................................................


7.6.1 Introduction...........................................................................................


A brush is a drawing tool used to fill out closed shaped or the interior of lines. A brush
behaves like picking up a bucket of paint and pouring it somewhere. In the case of
computer graphics, the area where you position the brush is called the brush origin. The
Free download pdf