I have a view and create a CEdit inside the view. I encountered two
problems:
1. Scroll problem. Why HScroll not show up automatically when the line
is too long?
m_editCtrl.Create(ES_MULTILINE | ES_READONLY | ES_AUTOHSCROLL |
ES_AUTOVSCROLL | WS_VISIBLE, CRect(0,0,100,100), this,
IDC_EDIT_CTRL);
2. OnCtlColor(...)
nCtlColor never equals to CTLCOLOR_EDIT, instead equals to
CTLCOLOR_STATIC. what happened?
HBRUSH CMyView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
HBRUSH hbr = CView::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if (nCtlColor==CTLCOLOR_EDIT ||
pWnd->IsKindOf(RUNTIME_CLASS(CEdit)) ) // I have to add
this line
{
pDC->SetBkMode(TRANSPARENT);
hbr = CreateSolidBrush(RGB(255,255,255));
}
// TODO: Return a different brush if the default is not desired
return hbr;
Quote:
}
------------
Your time and help is highly appreciated.
Daxin