如题 
改变对话框的背景色(变为白色)后, 使用 Static Text控件(Radio Button这类控件也一样 )时  文字的背景为那种灰色 该怎么该 ?(例如该成白色) 那种灰色真不好看 !

解决方案 »

  1.   

    响应WM_CTLCOLORSTATIC:
    brush = CreateSolidBrush(0x00FFFFFF);
    return (BOOL)brush;
      

  2.   

    OnCtlColor事件中添加:
    if (nCtlColor==CTLCOLOR_STATIC || nCtlColor==CTLCOLOR_EDIT)
    {
    pDC->SetBkMode(TRANSPARENT);
    return (HBRUSH)::GetStockObject(NULL_BRUSH);
    }
      

  3.   

    HBRUSH CRecover::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_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;
    }
      

  4.   

    HBRUSH CIECDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
    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;
    }
      

  5.   

    响应WM_CTLCOLORSTATIC或WM_CTLCOLOR消息:pDC->SetBkMode(TRANSPARENT);
    return (HBRUSH)::GetStockObject(NULL_BRUSH);
      

  6.   

    static HBRUSH BlackBackgroundBrush = 0;case WM_CTLCOLOREDIT: {
    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) );