Question

I have a CTabCtrl subclass which I'm trying overriding WM_PAINT to perform custom drawing. The only problem is, when I change the selected tab, I get artifacts left on the dialog where the old paint code hasn't been erased before the new code is painted on top. (The standard tab controls have the selected tab appear 2 pixels bigger than non-selected tabs, so when you change from selected to non-selected, you are left with the previous paint artifacts).

What is the best way of "repainting" this area? I've tried getting the parent control's DC and BitBlt'ing that onto the child's DC, but that doesn't work because the parent DC already contains an image of this control.

Was it helpful?

Solution

Do you override the WM_ERASEBACKGROUND message as well? You should probably do that and erase the area in the control.

You could use DrawThemeParentBackground to draw the background (XP and later) if you don't want to replace all the drawing logic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top