如何设置一个编辑框中输入文本的颜色、字体等属性,我用了如下的代码可是不管:
CFont* pFont = NULL; CFont Font;
CFontDialog dlgFont;
if (dlgFont.DoModal() == IDOK)
{
LOGFONT lf;
memcpy(&lf, dlgFont.m_cf.lpLogFont, sizeof(LOGFONT));
Font.CreateFontIndirect(&lf);
} m_edit.SetFont(&Font);
最好能给出代码样例。
CFont* pFont = NULL; CFont Font;
CFontDialog dlgFont;
if (dlgFont.DoModal() == IDOK)
{
LOGFONT lf;
memcpy(&lf, dlgFont.m_cf.lpLogFont, sizeof(LOGFONT));
Font.CreateFontIndirect(&lf);
} m_edit.SetFont(&Font);
最好能给出代码样例。
pBr=new CBrush(RGB(255,0,0));//在构造函数或其它地方添加 if(pWnd->GetDlgCtrlID()==IDC_SAMPLE)
{
pDC->SetTextColor(RGB(255,0,0));
}
else if(pWnd->GetDlgCtrlID()==IDC_EDIT_WIDTH)
{
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)pBr->m_hObject;
}
if(pWnd->GetDlgCtrlID()==IDC_TEXT_MYBOLE)
{
pDC->SelectObject(pFont);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(255,0,0));
}