哪位大神能帮帮我
覃煜 2014-04-12 09:44:38 void CMyFontDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
//MessageBeep((WORD)-1);
//device context for painting
CPaintDC dc(this);
//Update control's variables
UpdateData(TRUE);
//Set the background mode to transparent
dc.SetBkMode(TRANSPARENT);
//Create a font object
CFont MyFont;
MyFont.CreateFont(25+25*m_SizeRadio,
0,
0,
0,
400,
FALSE,
FALSE,
0,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH|FF_SWISS,
" ");
HWND hW=::GetFocus();
HDC hdc=::GetDC(hW);
LOGFONT lf;
memset(&lf,0,sizeof(lf));
lf.lfCharSet = CHINESEBIG5_CHARSET; //如果该值为DEFAULT_CHARSET将会列出所有字体
lf.lfFaceName = " ";
lf.lfPitchAndFamily = 0;
EmunFontFamiliesEx(hdc,&lf,myEnumFontFamExProc,0,0);
int CALLBACK myEnumFontFamExProc(ENUMLOGFONTEX
*lpelfe,NEWTEXTMETRICEX *lpntme, int FontType,LPARAM lParam)
{
TRACE("font family name\n",lpelfe->elfLogFont.lfFaceName);
//将该字体LOGFONT或是FaceName保存到自己的数据中
}
//Select the new font object
CFont * pOldFont=dc.SelectObject(&MyFont);
if(m_ShadowCheck==TRUE)
{
//Set the color of the text
dc.SetTextColor(RGB(255,0,0));
//Draw the text
dc.TextOut(150,120,m_DataEdit);
}
//Set the color of the text
dc.SetTextColor(RGB(0,255,0));
//Draw the text
dc.TextOut(150+10,120+10,m_DataEdit);
//Select the old font
dc.SelectObject(pOldFont);
CDialog::OnPaint();
}
}
--------------------Configuration: MyFont - Win32 Debug--------------------
Compiling...
MyFontDlg.cpp
E:\VC\备用\MyFont好\MyFontDlg.cpp(203) : error C2440: '=' : cannot convert from 'char [2]' to 'char [32]'
There is no context in which this conversion is possible
E:\VC\备用\MyFont好\MyFontDlg.cpp(205) : error C2064: term does not evaluate to a function
E:\VC\备用\MyFont好\MyFontDlg.cpp(208) : error C2601: 'myEnumFontFamExProc' : local function definitions are illegal
Error executing cl.exe.