views:

15

answers:

1

What is the proper way to subclass a tab control in winAPI, having windows perform both the default drawing and your own. Because BeginPaint() and EndPaint() are calling within the default proc, I don't see a way to do this. I did get it working with GetDC(), but it had a very bugs which annoyed the hell out of me.

If what I am asking is impossible, what is the best way to draw the tabs by myself?

+1  A: 

Subclassing is not required in your situation. The tab control supports the TCS_OWNERDRAWFIXED style bit, which allows its parent window to handle WM_DRAWITEM messages and draw the tabs itself.

There's a nice exemple on Codeguru. It uses MFC but don't let that stop you. Check out their CTabCtrlEx::DrawItem() method.

Frédéric Hamidi
This is the reverse of what I want. I need to draw the background myself, and let windows do the tabs.
Alexander Rafferty
Sorry, that wasn't clear in your question (especially the last line). Did you try handling [WM_ERASEBKGND](http://msdn.microsoft.com/en-us/library/ms648055%28VS.85%29.aspx) then?
Frédéric Hamidi