Small correction to my own code.
Even though the MSDN documentation says I should return the brush my control should be painted with, this does not work. If you add anything that is not 255,255,255 for RGB it will set it to white anyway.
Documentation says I should set the background color and return the brush. The 2 code snippets below work:
This one will set the static to transparent which is what I needed.
switch (nCtlColor)
{
case CTLCOLOR_STATIC:
pDC->SetBkMode(TRANSPARENT);
return CColorFormView::OnCtlColor(pDC,pWnd,nCtlColor);
break;
default:
return CColorFormView::OnCtlColor(pDC,pWnd,nCtlColor);
}
This will set the static to any color you like:
switch (nCtlColor)
{
case CTLCOLOR_STATIC:
This would work too.
pDC->SetBkColor(GetSysColor(COLOR_WINDOW));
return (HBRUSH)GetStockObject(NULL_BRUSH);
break;
default:
return CColorFormView::OnCtlColor(pDC,pWnd,nCtlColor);
}
Edited by wmundstock 2023-01-25 11:47 PM