2007年7月11日星期三

枚举所有字体

枚举所有字体
LOGFONT lf;
lf.lfCharSet = DEFAULT_CHARSET; // Initialize the LOGFONT structure
strcpy(lf.lfFaceName,"");
CClientDC dc (this);

//Enumerate the font families
::EnumFontFamiliesEx((HDC) dc,&lf,
(FONTENUMPROC) EnumFontFamProc,(LPARAM) this,0);

//枚举函数
int CALLBACK EnumFontFamProc(LPENUMLOGFONT lpelf,LPNEWTEXTMETRIC lpntm,DWORD nFontType,long lparam)
{
    // Create a pointer to the dialog window
    CDay7Dlg* pWnd = (CDay7Dlg*) lparam;
    // add the font name to the list box

    pWnd ->m_ctlFontList.AddString(lpelf ->elfLogFont.lfFaceName);

    // Return 1 to continue font enumeration
    return 1;
}
其中m_ctlFontList是一个列表控件变量

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

1 条评论:

匿名 说...

Hi would you mind letting me know which web host you're working with? I've loaded your blog in 3 different browsers and I must say this blog loads
a lot quicker then most. Can you suggest a good web hosting provider at a honest
price? Many thanks, I appreciate it!

My site - cellulite treatment cream