小弟请教两个问题。一、是我在设置cedit中的字体大小时怎么设置的字体没什么变化?代码如下。
HBRUSH CVCsampleDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
CFont f;
if(pWnd == &m_TID) {
if(m_error){
pDC->SetTextColor(RGB(255,0,0));
}else{
pDC->SetTextColor(RGB(0,0,0));
}
f.CreateFont(
100, // nHeight
100, // nWidth
0, // nEscapement
0, // nOrientation
FW_HEAVY, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
TRUE, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
NULL); // lpszFacename
CClientDC dc(pWnd);
CFont *defont=dc.SelectObject(&f);
pWnd->SetFont(defont,FALSE);
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
二、请问要实现窗口最大化并保持控件的美观该怎么实现?
HBRUSH CVCsampleDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
CFont f;
if(pWnd == &m_TID) {
if(m_error){
pDC->SetTextColor(RGB(255,0,0));
}else{
pDC->SetTextColor(RGB(0,0,0));
}
f.CreateFont(
100, // nHeight
100, // nWidth
0, // nEscapement
0, // nOrientation
FW_HEAVY, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
TRUE, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
NULL); // lpszFacename
CClientDC dc(pWnd);
CFont *defont=dc.SelectObject(&f);
pWnd->SetFont(defont,FALSE);
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
二、请问要实现窗口最大化并保持控件的美观该怎么实现?
最大化的时候就要自己响应OnSize函数了!