HBRUSH CcsDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(nCtlColor == CTLCOLOR_BTN)
{
hbr = (HBRUSH)GetStockObject(NULL_BRUSH);
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
將按鈕控件的背景畫刷選成NULL_BRUSH就可以了
默認情況下按鈕在焦點切換時,windows會用系統默認的一個白色畫刷將背景擦除一遍,導致你會看到閃爍