The code I posted earlier works, but it seems to interrupt everything else. This means that, if you're drawing a circle, you get maybe a quarter of the way through before it decides to refresh. For some reason, it seems to want to refresh the whole screen, no matter what variables I use in the message. So when it refreshes, it stops drawing for the amount of time it takes to refresh. Of course, your pen is still moving during this time, so by the time it's done and the app takes over again, you've finished drawing the circle. So it picks up from there, and you end up with a straight line from where the pen was when the refresh started to where the pen was when the refresh ended, instead of a nice circle.

I have no ideas at the moment as to how to get around that. Some possibilities:
1) Only refresh a small section - say 5x5 or 2x2 pixels. However, I don't know how to do that, and I don't know how to get the position of the pen so that I know where to update. This also might still take too long, resulting in more delays.
2) Run the refresh separately from the main program. This way, the main program wouldn't get interrupted by the refresh. But again, no ideas how to do this.
3) Somehow send a refresh call to the system, like the text box does. Even if it's a slow update speed, at least it would be better than nothing, and when the text box refreshes, it doesn't interrupt the typing (as far as I know).

I'd post the version with the updated refresh, but it's actually far more usable without it.