This topic is now archived and is closed to further replies.

Erik Rufelt

Can I get the background color of a windows control?

Recommended Posts

Hi, I''m trying to create a window with tabs, like the Display Settings dialog for example. I''m using Windows XP. I have tried to do this using a Tab Control. This link from MSDN explains how to do this: A quote from that page: "The display area of a tab control is the area in which an application displays the current page. Typically, an application creates a child window or dialog box, setting the window size and position to fit the display area." This was not very hard to do, and it works fine except for one thing, my child-window doesn''t have the same background color as the tab control, which I think looks bad. Is it possible for me to get the background color brush from the tab control? I don''t want to use a pre-defined color to draw the child window background, since the tab control doesn''t always have the same background color, it changes depending on what Theme I select in the Display Settings dialog. I have many buttons and edit controls etc. for every tab page, and I would rather not create them all with the tab window as parent. I believe that would make it more complicated to handle notifications from the controls, since I would have to replace the tab control''s WndProc function. Or is there perhaps a smart way to do this without messing up the standard message handling of the tab control? I have tried to create the controls with the same parent as the tab control, but that makes them flicker a lot when i resize the window and sometimes the tab control will redraw on top of it''s supposed children, even with the WS_CLIPSIBLINGS style. Any help is much appreciated! /Erik

Share this post

Link to post
Share on other sites