Workshop


Quiz

1.

What arguments must you always supply a value for when calling MessageBox.Show()?

2.

If you don't supply a value for the caption parameter of MessageBox.Show(), what is displayed in the title bar of the message?

3.

How many icons can you show in a message box at once?

4.

Which event fires first, the KeyUp or KeyPress event?

5.

How do you determine which button is being pressed in a mouse-related event?

Answers

1.

The prompt and the dialog title (caption). Actually, the caption is technically optional, but it's such a bad idea to leave it off that I consider it required.

2.

Nothing gets displayedthe title bar is empty.

3.

Only one icon can be shown at once.

4.

The KeyPress event fires before the KeyUp event.

5.

By using the e.Button property in the event.

Exercises

1.

Modify your custom dialog box project so that the OK button is the Accept button of the form. That way, the user must only press Enter to dismiss the dialog box. Next, make the Cancel button the Cancel button of the form so that the user can also press the Escape key to dismiss the form.

2.

Modify your mouse paint project so that the form clears each time the user starts drawing. Hint: Clear the graphics object in the MouseDown event.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net