如何改变对话框程序中"标题栏的颜色"和"静态文本控件中字的颜色"???谢谢!

解决方案 »

  1.   

    静态文本的颜色可以在WM_CTLCOLOR中设置,标题栏则需要自画了
      

  2.   

    HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
       // Call the base class implementation first! Otherwise, it may
       // undo what we're trying to accomplish here.
       HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);   // Are we painting the IDC_MYSTATIC control? We can use
       // CWnd::GetDlgCtrlID() to perform the most efficient test.
       if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
       {
          // Set the text color to red
          pDC->SetTextColor(RGB(255, 0, 0));      // Set the background mode for text to transparent 
          // so background will show thru.
          pDC->SetBkMode(TRANSPARENT);      // Return handle to our CBrush object
          hbr = m_brush;
       }   return hbr;
    }
      

  3.   

    MSDN里找到了例子,呵呵,可以改变颜色了
    // This OnCtlColor handler will change the color of a static control
    // with the ID of IDC_MYSTATIC. The code assumes that the CMyDialog
    // class has an initialized and created CBrush member named m_brush.
    // The control will be painted with red text and a background
    // color of m_brush. if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
    {
    // Set the text color to red
    pDC->SetTextColor(RGB(255, 255, 0));

    // Set the background mode for text to transparent 
    // so background will show thru.
    pDC->SetBkMode(TRANSPARENT);

    // Return handle to our CBrush object
    hbr = m_brush;
    }如果是改变按纽的颜色,可不可以用这个呢?
    可没有SetButtonColor阿?
      

  4.   

    我这有一个类,可是改变静态文本框的字体(颜色,大小等)想要告我邮箱只需用此类替换掉CStatic类即可不过你这分太少了
      

  5.   

    CLabel类,你到网上找,很多。它能实现你的要求