Workshop


Quiz

1.

What object is used to draw to a surface?

2.

To set a Graphics object to draw to a form directly, you call what method of the form?

3.

What object defines the characteristics of a line? A fill pattern?

4.

How do you make a color property adjust with the user's Windows settings?

5.

What object is used to define the bounds of a shape to be drawn?

6.

What method do you call to draw an irregular ellipse? A circle?

7.

What method do you call to print text on a Graphics surface?

8.

To ensure that graphics persist on a form, the graphics must be drawn on the form in what event?

Answers

1.

The Graphics object

2.

The CreateGraphics() method

3.

Lines are defined by Pen objects; fill characteristics are defined by Brush objects.

4.

Use System Colors.

5.

A Rectangle object

6.

Both shapes are drawn with the DrawEllipse() method.

7.

The DrawString() method

8.

The form's Paint event

Exercises

1.

Modify the example in this hour to use a font other than Arial. If you're not sure what fonts are installed on your computer, open the Start menu and choose Settings, Control Panel. You'll have an option on the Control Panel for viewing your system fonts.

2.

Create a project that draws an ellipse that fills the form, much like the one you created in this hour. However, draw the ellipse directly to the form in the Paint event. Make sure that the ellipse is redrawn when the form is sized. (Hint: Invalidate the form in the form's Resize() 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