MFC - change text color of a cstatic text control

后端 未结 5 1114
野的像风
野的像风 2020-12-29 07:09

How do you change the text color of a CStatic text control? Is there a simple way other that using the CDC::SetTextColor?

thanks...

5条回答
  •  离开以前
    2020-12-29 07:54

    Very helpful.

    https://msdn.microsoft.com/de-de/library/0wwk06hc.aspx

    Alike to

    HBRUSH hBrush = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    if (nCtlColor == CTLCOLOR_STATIC &&
        pWnd->GetSafeHwnd() == GetDlgItem(XXX)->GetSafeHwnd()
    ) pDC->SetTextColor(RGB(255, 0, 0));    
    return hBrush;
    

提交回复
热议问题