Dialogs

You've already seen how to create and show forms, but there is a special usage of forms that show as dialogs. Although it's not always the case, dialogs are typically modal and exist to take information from a user before a task can be completed—in other words, a dialog is a form that has a “dialog” with the user. For example, the Options dialog in Figure 1.15 was created by right-clicking on a project in Solutions Explorer and choosing Add Windows Form. Implementing the form was a matter of exposing the favorite color setting as a property, dropping the controls onto the form's design surface, and setting the ControlBox property to false so that it looks like a dialog.

Figure 1.15. A Dialog Box

You can use this form as a modal dialog ...

Get Windows Forms Programming in C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.