Static Text on Tab Controls

This is a discussion on Static Text on Tab Controls within the Windows Programming forums, part of the Platform Specific Boards category; Hello Everybody.
I currently have a tab control that has a static control that is made for each tab. Then ...

Static Text on Tab Controls

Hello Everybody.

I currently have a tab control that has a static control that is made for each tab. Then each static text is then added onto the static control to make it possible for tab switching. The text can be drawn correctly, but I have a problem. The text has a static, gray-like, background that I am trying to remove. How would I go about doing that?

I think that you have to ownerdraw the control to change the background color (with edit controls you can work with WM_CTLCOLOREDIT and WM_CTLCOLORSTATIC messages, but this don't apply to static controls). Just assign the SS_OWNERDRAW style and check the WM_DRAWITEM message on the control's parent window, the display it on your way:

I think that you have to ownerdraw the control to change the background color (with edit controls you can work with WM_CTLCOLOREDIT and WM_CTLCOLORSTATIC messages, but this don't apply to static controls). Just assign the SS_OWNERDRAW style and check the WM_DRAWITEM message on the control's parent window, the display it on your way:

You have to set the 'SS_OWNERDRAW' style on the control declaration, and wait for the message on the controls parent window: you are appending the 'test' control to the 'hwnd_tabs_content[0]' window, so you have to search the message on its window procedure; as 'hwnd_tabs_content[0]' is a standard control you have to subclasse it to check for the WM_DRAWITEM message. Or till on ownerdraw mode you have to draw the entire control you also con subclasse that control instead searching for the message on its parent window.

"WM_CTLCOLORSTATIC
A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control. "

This is why dialogs (containing the ctrls) are generally used for this type of thing (as a TAB ctrl does not have a callback but uses notify reflects for msg processing/handling).