Paint Component

The paint component is doing something I didn’t expect. Here’s what I’ve done:

I have a screen with two paint components. They are the exact same size, and are overlayed on top of each other. In one component, I draw all of the fast updating items. In the other component, I draw all of the slow updating items.

The problem is that they do not repaint independently. In fact, if I don’t call repaint at all on the slow paint component, it still updates every time the fast one updates. This defeats the whole purpose of overlaying them.

What else triggers a repaint event other than changing the repaint property? Should I be able to repaint only one paint component at a time?

Yes, non-opaque components overlaid on each other will trigger each other to repaint. You’d get garbage otherwise. You have to understand that the screen itself is a simple raster device - there are no ‘layers’. So for instance, if your fast component was painting in an area in one repaint, but in the next repaint it stops painting in that area, the components underneath it must paint again in order to fill in that area, otherwise the old pixel data would persist, and you’d get an effect much like the classic solitaire ‘win screen’.