Question

I am having a strange problem ( well, at least i find it strange =) ). I am writing my own GUI library, which is a wrapper around windows api (and yes, i am aware of WTL and frameworks like MFC =) ). At the current stage i have incapsulated common controls in such manner: for example, Edit class consists of a simple window and an standard edit window above it ( MainWindow -> GhostWindow -> EditBox ). That is how i can for example change a background colour of an edit inside an edit class itself:

myedit->SetBkColor ( RGB ( 0, 0, 0 ) );

And it worked fine, until i called InitCommonControlsEx and attached manifest file to my program. After doing this, my edits become capable of changing colours only when they have focus. To be honest, i don't have a comprehensive thoughts about why do the behave like this and what am i doing wrong, so i will appreciate any help.

Thank you, #535.

Was it helpful?

Solution 2

Well, everything is much easier, than i thought. I was just too inattentive =( When one don't use styling, one cane use ::SetBkColor(...) to change background colour, and return a brush from WM_CTLCOLOR* to change a border colour. Things become different after enabling styling. Now ::SetBkColor(...) correspond to focus colour and returning brush changes background colour. Shame on me =(

OTHER TIPS

  1. When you attach the version 6 manifest, the call to InitcommonControlsEx becomes unnecessary.

  2. Anyway. with the version 6 common controls loaded, XP theming is used even for the standard windows controls. The background colors for the controls are painted using the xp-theme color, so the WM_CTLCOLOR* messages are used less.

  3. You are currently overriding the coolor of various control elements using the WM_CTLCOLOR* messages?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top