Jeff Sargent
October 16th, 1999, 03:35 PM
I want to change the background color of my CEditView from white to gray before it is shown. In PreCreateWindow(CREATESTRUCT& cs) I have a call to SetClassLong. Well, here's the code:
MyCEditViewClass::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
BOOL bPreCreated = CEditView::PreCreateWindow(cs);
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping
SetClassLong(AfxGetMainWnd()->GetSafeHwnd(), GCL_HBRBACKGROUND, COLOR_BTNFACE);
return bPreCreated;
}
It compiles and runs, but the color of the CEditView remains white. Perhaps I'm getting the HWND the wrong way? If so, how do I do it? Perhaps I need to move the code? OnDraw? Please help :)
Thanks,
Jeff
MyCEditViewClass::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
BOOL bPreCreated = CEditView::PreCreateWindow(cs);
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping
SetClassLong(AfxGetMainWnd()->GetSafeHwnd(), GCL_HBRBACKGROUND, COLOR_BTNFACE);
return bPreCreated;
}
It compiles and runs, but the color of the CEditView remains white. Perhaps I'm getting the HWND the wrong way? If so, how do I do it? Perhaps I need to move the code? OnDraw? Please help :)
Thanks,
Jeff