Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Setting the colour of a checkbox (Win32 API NOT MFC)
I've created a check box on a window using the following call to CreateWindowEx()..
(note: h_check is a window handle(HWND), h_mainwindow is a handle to the parent window which has been created, CBID_CW is a constant and is used as an id number, app_instance is the hInstance passed to WinMain())
h_check = CreateWindowEx(NULL, "BUTTON", "Blah", WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_TEXT, 0, 0, 100, 17, h_mainwindow, (HMENU)(CBID_CW), app_instance, NULL);
My problem lies here.. The main window background is white but the check box has a grey background behind the text. I want to change the colour of the grey area behind the check boxes text to white so it matches the rest of the window.
Can anyone give me an example of how to do this without drawing the check box myself?
If i have to draw the checkbox myself that doesn't matter but it would be easier if i could just get windows to draw it a different colour.
0 · ·