Tab Control draw on Enter Key

375 Views Asked by At

So I have an issue that I assume has been explored before but I can’t seem to find anything on it. I made a custom Tab Control class that is completely custom drawn and shows/hides CDialog object as the user clicks on different tabs. To do this I overloaded the paint method (I did not use the user drawn feature). Everything seems to work fine except for one issue, the problem I am having is that when the user selects one of the controls in the dialog that is currently being shown (i.e. a CEdit) and presses the enter key, the tabCtrl will receive a WMPAINT message which causes the body of the tabCtrl to be drawn over the current dialog. To get around this issue I modified the erase background method of the tabCtrl to show the current dialog which fixes the dialog from being painted over but I get a flicker in the control every time the enter key is presses or held because of the paint/show dialog combination happening. I was wondering if anyone has dealt with this issue before and had a fix or any ideas. I haven’t been able to come up with anything that works. Sorry for the lack of code, I don’t have permission from the owner to share it.

1

There are 1 best solutions below

3
On

double-buffering will help you perhaps. Please google it - there are many examples. Use this article as a starting point