Visual C++ and MFC Fundamentals Chapter 8 GDI Orientation and Transformations
font.DeleteObject();
}
To produce a shadow effect, you can add another copy of the same text on a slightly
different location and call the CDC::SetBkMode() method. Here is an example:
void CExoView::OnDraw(CDC* pDC)
{
CExoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CFont font;
font.CreatePointFont(920, "Garamond");
CFont *pFont = pDC->SelectObject(&font);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(110, 185, 250));
pDC->TextOut(26, 24, "Christine", 9);
pDC->SetTextColor(RGB(0, 0, 255));
pDC->TextOut(20, 18, "Christine", 9);
pDC->SelectObject(pFont);
font.DeleteObject();
}
One of the most complete means of creating a font is by using the CFont::CreateFont()
method. Its syntax is:
BOOL CreateFont(int nHeight,
int nWidth,
int nEscapement,
int nOrientation,
int nWeight,
BYTE bItalic,
BYTE bUnderline,
BYTE cStrikeOut,