Drawing and Refreshing

The View System provides two mechanisms for rendering your view:

Draw calls DrawContents, then calls every child's Draw, as shown in Figure 28.


Similarly, Refresh calls RefreshContents, then calls every child's Refresh, as shown in Figure 29. RefreshContents calls DrawContents by default, so the default behaviors of Draw and Refresh are the same.


Only the View System calls your view's Refresh member function, and only to render the view on the device that displays the view's hierarchy. You can override RefreshContents to provide optimizations for the refresh operation. For example, you can use cached, off-screen bitmaps to increase rendering speed in your RefreshContents implementation.

In contrast, any object can call your view's Draw member function, at any time, even before your view is attached to a display device. Even while your view is attached to a display device, anyone can call Draw to render your view on a different display device, such as a printer, with completely different graphic properties. Therefore, you must never use device-dependent operations of any kind in your DrawContents implementation.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker