[Bug 44633] Checboxes and Radiobuttons blank out the text area that follows them

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Feb 28 13:03:33 CST 2018


https://bugs.winehq.org/show_bug.cgi?id=44633

--- Comment #2 from ryampolsky at yahoo.com ---
Created attachment 60629
  --> https://bugs.winehq.org/attachment.cgi?id=60629
Trivial test app binary

Okay.  I've attached a trivial test app.  It creates a red checkbox immediately
after creating the main window.  The checkbox has no label (null string), but
is sized big enough for the "Red Checkbox" label.

Then the main message handler traps WM_CTLCOLORSTATIC, sets the background mode
to TRANSPARENT, draws the button label itself with DrawText and then returns
NULL-BRUSH.

The "Red Checkbox" label shows up with no theme enabled, but does not show up
when there is a theme enabled.

I can send you the source code if you want.  But here are the two bits of code
that I added to an empty project:

This bit goes in InitInstance:

   // Create a checkbox with red text.
   // Because Windows won't let you control the color of themed radiobutton
text, create the button with
   // null text, and draw the text ourselves in the CTLCOLOR_BTN handler.

   // Size the checkbox to the size of the label.
   hDC = GetDC(hWnd);
   SetRect(&rc, 0, 0, 10000, 100);
   DrawText(hDC, L"Red Checkbox", strlen("Red Checkbox"), &rc, DT_CALCRECT);
   width = rc.right;            // text width
   width += CHECKBOX_BITMAP_FUDGE;    // checkbox bitmap width
   hCheck = CreateWindow(L"Button", L"", WS_CHILD | BS_CHECKBOX, 20, 20, width,
20, hWnd, NULL, hInstance, NULL);
   ShowWindow(hCheck, SW_NORMAL);

And this bit is in WinProc:

    case WM_CTLCOLORBTN:
    case WM_CTLCOLORSTATIC:
        SetTextColor((HDC)wParam, RGB(192, 0, 0));
        GetClientRect((HWND)lParam, &rc);
        rc.left += 15;
        DrawText((HDC)wParam, L"Red Checkbox", strlen("Red Checkbox"), &rc,
DT_SINGLELINE | DT_LEFT | DT_BOTTOM | DT_VCENTER);
        return (LRESULT) GetStockObject(NULL_BRUSH);

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list