Morten,
The paint event is treiggered by a WM_PRINTCLIENT messages receieved by the
form.
I believe this has something to do with VisualStyles, but the interesting
part is that this message is send only by the push button. Check boxes for
example doesn't have this effect. Sop what I did is to handle that message
in the WndProc. Doing this I managed to suppress the strange paint event and
everything with the XP styles looks fine. However I think this is send by
the button for a reason and I cannot guarantee that there won't be any
problems beside the fact that the control won't respond to the
WM_PRINTCLIENT message correctly
.
Override the form's WndProc method and add the following code
const int WM_PRINTCLIENT = 0x0318;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PRINTCLIENT)
{
return;
}
base.WndProc(ref m);
}
}
--
HTH
Stoitcho Goutsev (100)
Kürsat said:
Hi,
No, Enter/Leave events aren't handled. Button itself triggers paint event.
Tested on different systems. Strange but true! (Button is XP style)