Alexander Rafferty
Alexander Rafferty

Reputation: 6233

Subclassing tab control

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?

Upvotes: 0

Views: 721

Answers (1)

Frédéric Hamidi
Frédéric Hamidi

Reputation: 262919

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.

Upvotes: 1

Related Questions