In Win32, how can I change the color of STATIC text?

I have static text in a black window and I would like to change it at runtime using the Color Picker dialog box. I successfully received the color, now I just need to change the text! I read that the message WM_CTLCOLORSTATICis the one that is being processed, although it only looks when the control is initially drawn on the screen. Can I use it WM_PAINT?

Code for setting the color that I still have (in case WM_CTLCOLORSTATIC):

if ((HWND)lParam == GetDlgItem(hWnd, uLabelId)
{
    SetBkMode((HDC)wParam, TRANSPARENT);
    SetTextColor((HDC)wParam, crLabelTextColour);
    return (BOOL)CreateSolidBrush(GetSysColor(COLOR_MENU));
}

Perhaps I had a completely wrong stick end approaching this problem, so any help would be greatly appreciated!

+1
source share
2 answers

WM_CTLCOLORSTATIC. , (, RedrawWindow). . , WM_CTLCOLORSTATIC .

+4

:

  • , , WM_CTLCOLORSTATIC, ?

  • return (BOOL)... - ? LRESULT proc.

  • - . Windows .

0

All Articles