Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hey Guys,

i have a simple sounding problem with a CTabCtrl derived class.
I support Drag and Drop to reorder the Tabs.

Now i have a Problem with the Tab Background.
Look at this image:
http://www.directupload.net/file/d/3693/di4xe5gq_png.htm[^]

I have searched but i don't find anything useful...
I have tried to return TRUE in OnEraseBackground() and nothing happend.
Then i have tried to draw the Background in red to see if anything happens.

Could anyone help me please to draw this area transparent?
I need this completly transparent because our design has decided to place some controls in this free space...

Thank you so much for helping me!
Posted
Comments
Richard MacCutchan 24-Jul-14 7:02am    
OK, I have looked at the image, but I can't see what the problem is. What is it that you want in red, and what do you want to be transparent?
C3D1 24-Jul-14 7:07am    
Sorry for the confusion. I'm trying to get the space right of the Tabs transparent. I tryed a few things, but all the time nothing happens. So i decided to color the area in red to see if anything happens inside OnEraseBkgnd.
At the picture you can see the Button hided a little bit the grey area. This grey area i'm trying to get transparent.

Sorry for my bad english!
I hope you could understand what i mean
Richard MacCutchan 24-Jul-14 7:19am    
I don't know how you could do that except by overriding the CTabCtrl and adding your own handler for the WM_PAINT messages. It would be much simpler to expand the main window and move the button.
C3D1 24-Jul-14 7:45am    
Yes, that's the problem. I don't want to handle WM_PAINT by myself.
And tell it to our design team to expand the main window and move the button. They want to have it exactly in this area right of the tabs. There is no compromise...
Richard MacCutchan 24-Jul-14 8:04am    
I really cannot understand why people can be so stupid as not to accept that expanding the window is less than a minutes's work to solve something like this. If they continue to refuse then you need to explain to them, and the management that it is likely to be more than a month's work to fix it. And what happens next time they decide to add a similar change. Tell them to read http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx which shows how a tabbed control should be done.

if you want the background to be painted you got do it yourself. The Messagehandler OnEraseBackground is fine, to do CDC::FillSolidRect(....) in that function

For some transpaerency you should read this: Using Layered Windows
 
Share this answer
 
v2
Comments
C3D1 26-Jul-14 14:10pm    
sorry, i have tryed that, but that doesent work.
I don't want to paint a solid color, i want to paint the area transparent to show a underlaying control
Hello C3D1,


  • for the first - the Tab controls outer background is erased in the WM_PRINTCLIENT message sent to the parent window.
  • The tab control must have the WS_CLIPSIBLINGS style.
  • And you should set the tab control at the bottom of the controls by SetWindowPos(hTab,HWND_BOTTOM,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);.


Best regards.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900