MFC 写艺术字

来源:互联网 发布:qemu使用教程 windows 编辑:程序博客网 时间:2024/06/02 22:12
//艺术字体
void CGameScore::DrawTextString(CD3DDevice * pD3DDevice, LPCTSTR pszString, D3DCOLOR crText, D3DCOLOR crFrame, LPRECT lpRect,UINT nFormat)
{
//定义字体
CD3DFont escapeFont;
escapeFont.CreateFont(130, TEXT("宋体"), 1L);

//变量定义
INT nXExcursion[8]={1,1,1,0,-1,-1,-1,0};
INT nYExcursion[8]={-1,0,1,1,1,0,-1,-1};


//绘画边框
for (INT i=0;i<CountArray(nXExcursion);i++)
{
//计算位置
CRect rcFrame;
rcFrame.top=lpRect->top+nYExcursion[i];
rcFrame.left=lpRect->left+nXExcursion[i];
rcFrame.right=lpRect->right+nXExcursion[i];
rcFrame.bottom=lpRect->bottom+nYExcursion[i];


//绘画字符
escapeFont.DrawText(pD3DDevice,pszString,&rcFrame,nFormat,crFrame);
}


//绘画字符
escapeFont.DrawText(pD3DDevice,pszString,lpRect,nFormat,crText);


escapeFont.DeleteFont();


return;

}

说明:

这个函数的使用是给写的字进行描边,实现字体的美化,描边的方法,对坐标的往周围8个方向移动。

0 0