fix OnPaint event on windows (and everywhere)