Lec12 - Lecture 12: Dialogs and Lists PIC 10C Todd Wittman...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 12: Dialogs and Lists PIC 10C Todd Wittman Ch. 9 : Dialogs c A Dialog is a Microsoft common window. c Like ToolTips, these controls do not appear directly on your form. They appear below your form and you can call them. c Common dialogs include: Pop-up window (MessageBox) Select color from palette (ColorDialog) Select font (FontDialog) Browse folders (FolderBrowserDialog) Open File (OpenFileDialog) Save File (SaveFileDialog) Printing, Print Preview, and Page Setup
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Dialog Properties c To bring up a dialog, use the ShowDialog() command (or just Show() for the MessageBox). c The dialog will keep focus until the user presses a button, which is recorded as a DialogResult. c The result depends on the buttons on the window: DialogResult.OK, DialogResult.Yes, DialogResult.Cancel Customizing Your Message Box c The MessageBox with 1 OK button is the default. c You can customize your own Dialog boxes (see p. 254). c For MessageBox, the general form is: MessageBox.Show(message, title, buttons, icon); MessageBox.Show("Do you really want to go on a date with Moleman?", "Really?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
Background image of page 2
3 Opening Dialogs c Opening the common dialog windows usually follows the format: if (dialogName.ShowResult() == DialogResult.OK) **do something with the user input** c Ex Open a file and display the file name in a label. if (openFileDialog1.ShowDialog() == DialogResult.OK)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/18/2010 for the course PIC 10C taught by Professor Wittman during the Spring '10 term at UCLA.

Page1 / 9

Lec12 - Lecture 12: Dialogs and Lists PIC 10C Todd Wittman...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online