CODE
case WM_CTLCOLORSTATIC:
{
console::info("WM_CTLCOLORSTATIC");
int nCntrlID = GetDlgCtrlID((HWND) lparam);
HDC hdc = (HDC) wparam;
SetBkMode(hdc, TRANSPARENT);
switch (nCntrlID)
{
case IDC_COLOR_TEXT:
return (LRESULT) hbrText;
case IDC_COLOR_SELECTION_TEXT:
return (LRESULT) hbrSelectionText;
case IDC_COLOR_BACKGROUND:
return (LRESULT) hbrBackground;
case IDC_COLOR_SELECTION_BACKGROUND:
return (LRESULT) hbrSelectionBackground;
}
}
return NULL; //don't change colour of any other static control
{
console::info("WM_CTLCOLORSTATIC");
int nCntrlID = GetDlgCtrlID((HWND) lparam);
HDC hdc = (HDC) wparam;
SetBkMode(hdc, TRANSPARENT);
switch (nCntrlID)
{
case IDC_COLOR_TEXT:
return (LRESULT) hbrText;
case IDC_COLOR_SELECTION_TEXT:
return (LRESULT) hbrSelectionText;
case IDC_COLOR_BACKGROUND:
return (LRESULT) hbrBackground;
case IDC_COLOR_SELECTION_BACKGROUND:
return (LRESULT) hbrSelectionBackground;
}
}
return NULL; //don't change colour of any other static control
Where hbrText, hbrSelectionText, etc. are my solid-color-brushes (they are created elsewhere), and IDC_COLOR_TEXT, IDC_COLOR_SELECTION_TEXT, etd. are IDs of my static rectangles (code from my *.rc: "CONTROL "",IDC_COLOR_TEXT,"Static",SS_LEFTNOWORDWRAP | SS_NOTIFY | WS_GROUP,84,156,64,14,WS_EX_STATICEDGE").
Here is the problem: everything is painted OK, but the Dialog is created slow and its responsiveness is *terribly* slow (but only when I'm using CTLCOLORSTATIC) -> just look here (go to plugin's preferences and try to select some text in 'Available fields'). I also noticed that WM_CTLCOLORSTATIC is processed way more times than the number of statics I have on my dialog. Is there any other way to color those statics?