What is the m_bflag for? No matter what it is, you use it incorrectly. You surely shouldn't zero the flag in a paint event.