Not very fashionable, still using vc6, boring to write ............
You can change the background color in the SDI view in two steps. The effect is still very good.
First, add the color to the ondraw of the cxxview class.
Void cdigimizerview: ondraw (CDC * PDC)
{
Cdigimizerdoc * pdoc = getdocument ();
Assert_valid (pdoc );
Crect rect;
Getclientrect (rect );
Colorref rcolor = getsyscolor (color_3dface); // color_btnface
PDC-> fillsolidrect (rect, rcolor );
// Todo: Add draw code for native data here
}
But when the window size is changed, the background color looks like a flash,
The cxxview Class responds to the wm_erasebkgnd message and comment out the generated return cview: onerasebkgnd (PDC); that is, do not call the onerasebkgnd () function of cview and return true directly. as shown below.
Bool cdigimizerview: onerasebkgnd (CDC */* PDC */)
{
// Return cview: onerasebkgnd (PDC );
Return true;
}
PS: the code is written in one piece.
Bool cdigimizerview: onerasebkgnd (CDC * PDC)
{
// Return cview: onerasebkgnd (PDC );
Crect rect;
Getclientrect (& rect );
PDC-> fillsolidrect (& rect,: getsyscolor (color_appworkspace); // color_btnface
Return true;
}