Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
754 Programming Windows with C# The ColorFillDialogOnApply event handler casts the object argument to an object of type ColorFillDialogBoxWithApply in order to get access to the Color and Fill properties. The program then sets its fields from the properties and invalidates the client area. As I mentioned earlier, even if a modal dialog box is active, an application form can still get Paint events. So, the client area is able to update itself based on the new dialog box settings. The Modeless Dialog Box At the beginning of this chapter, I mentioned that dialog boxes can be either modal or modeless. So far we've been looking at modal dialog boxes, certainly the more common of the two types. Modeless dialog boxes allow the user to switch be- tween the dialog box and the form that created it. Modeless dialog boxes are preferred when the user would find it conve- nient to keep the dialog box displayed for a while. Perhaps the most common modeless dialog boxes are the Find and Replace dialog boxes displayed by word processing programs. As a user, you probably want to keep such a dialog box active for a while so that you can do multiple find or replace actions. Yet while