As needed, the background color of the GroupBox control and the text control static is set to match.
Set GroupBox background color in Onctrlcolor:
if (Pwnd->getdlgctrlid () ==idc_g) {//groupbox background color
CRect RC;
GetDlgItem (Idc_g)->getclientrect (&RC);
Pdc->fillsolidrect (Rc,rgb (70,219,182));
}
if (Pwnd->getdlgctrlid () ==idc_static1) {//static background color
Pdc->setbkcolor (RGB (70,219,182));
}
Set the effect after:
There is a white background does not meet the requirements:
Need to add this sentence: hbr= (hbrush) CreateSolidBrush (RGB (70,219,182));
if (Pwnd->getdlgctrlid () ==idc_static1) {//static background color
Hbr= (Hbrush) CreateSolidBrush (RGB (70,219,182));
Pdc->setbkcolor (RGB (70,219,182));
}
The effect is as follows:
/* Set Control background transparent */
Hbrush Ctooldlg::onctlcolor (cdc* PDC, cwnd* pwnd, UINT nCtlColor)
{
Hbrush HBR = Cdialogex::onctlcolor (PDC, pwnd, nCtlColor);
if (nCtlColor = = ctlcolor_static)
{
Pdc->setbkmode (transparent);/Set Background transparent
Pdc->settextcolor (RGB (255,255,0));//Set Font to Yellow
Return (Hbrush):: Getstockobject (Null_brush);
}
TODO: If the default is not the desired brush, return another brush
return HBR;
}