Font
/获得窗口的客户区设备上下文句柄
CClientDC dc(this);
//更改当前字体
LOGFONT lf;
dc.GetCurrentFont()->GetLogFont(lf);
CFontfont,*pOldFont;
lf.lfCharSet=134;
lf.lfHeight=-150;
lf.lfWidth=0;
strcpy(lf.lfFaceName,"隶书");
font.CreateFontIndirect(lf);
pOldFont=dc.SelectObject(&font);
dc.SetBkMode(TRANSPARENT);
//更改当前画笔为空
CPenpen(PS_NULL,1,RGB(255,0,0)),*pOldPen;
pOldPen=dc.SelectObject(pen);
//更改当前刷子
CBrushbr,*pOldBrush;
pOldBrush=dc.SelectObject(br);
//开始一个路径
dc.BeginPath();
dc.TextOut(10,10,"渐变字");
dc.EndPath();
//绘制渐变效果
dc.SelectClipPath(RGN_COPY);
for(inti=255;i>0;i--)
{
intiRadius=(600*i)/255;
dc.SelectObject(pOldBrush);
br.DeleteObject();
br.CreateSolidBrush(RGB(255,i,0));
dc.SelectObject(br);
dc.Ellipse(-iRadius,-iRadius/3,iRadius,iRadius/3);
}
//恢复设备上下文的原有设置
dc.SelectObject(pOldFont);
dc.SelectObject(pOldPen);
dc.SelectObject(pOldBrush);
源文档 <http://fengqing888.blog.163.com/blog/static/3301141620106625315919/?suggestedreading&wumii>