// TODO: Change any attributes of the DC here //设置文本框的背景为透明 if (nCtlColor==CTLCOLOR_STATIC || nCtlColor==CTLCOLOR_EDIT) { pDC->SetBkMode(TRANSPARENT); return (HBRUSH)::GetStockObject(NULL_BRUSH); } if (nCtlColor==CTLCOLOR_DLG) return (HBRUSH)m_BKBrush.GetSafeHandle(); // TODO: Return a different brush if the default is not desired return hbr; }
brush = CreateSolidBrush(0x00FFFFFF);
return (BOOL)brush;
if (nCtlColor==CTLCOLOR_STATIC || nCtlColor==CTLCOLOR_EDIT)
{
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)::GetStockObject(NULL_BRUSH);
}
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
//设置文本框的背景为透明
if (nCtlColor==CTLCOLOR_STATIC || nCtlColor==CTLCOLOR_EDIT)
{
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)::GetStockObject(NULL_BRUSH);
}
if (nCtlColor==CTLCOLOR_DLG)
return (HBRUSH)m_BKBrush.GetSafeHandle();
// TODO: Return a different brush if the default is not desired
return hbr;
}
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch(nCtlColor)
{
case CTLCOLOR_STATIC:
pDC->SetBkMode(TRANSPARENT);
//break; case CTLCOLOR_DLG:
if(m_brush.GetSafeHandle())
hbr = (HBRUSH)m_brush.GetSafeHandle();
break; default:
break;
} return hbr;
}
return (HBRUSH)::GetStockObject(NULL_BRUSH);
if ( (HWND)lParam == GetDlgItem(hDlg,IDC_EDIT)
)
{
SetTextColor( (HDC)wParam, RGB(255,255,255) );
SetBkColor( (HDC)wParam, RGB(0,0,0) );//
return (int) BlackBackgroundBrush;
}
}
break;
CASE WM_INITDIALOG:
BlackBackgroundBrush = CreateSolidBrush( RGB(38,24,13) );
BREAK; BlackBackgroundBrush = CreateSolidBrush( RGB(38,24,13) );