如何设置文字的颜色?能否给出个代码?
谢谢~

解决方案 »

  1.   

    HBRUSH CMyView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
       HBRUSH hbr = CView::OnCtlColor(pDC, pWnd, nCtlColor);  
       if(nCtlColor == CTLCOLOR_STATIC &&
            pWnd->GetSafeHwnd() == ((CWnd*)GetDlgItem(IDC_STATIC1))->GetSafeHwnd())
              pDC->SetTextColor( RGB(255,0,0));


    // TODO: Return a different brush if the default is not desired
    return hbr;
    }
      

  2.   

    HDC hdc = ::GetDC(NULL);
    COLORREF crColor = RGB(r, g, b); // eg : RGB(255, 255, 255)
    ::SetTextColor(hdc, crColor);