Chapter 18 Quick Reference


To

Do this

Draw on a form.

Create a Graphics object using the form’s CreateGraphics function. For example:

Graphics* gr = myForm->CreateGraphics();

Remember to call Dispose on the Graphics object when you’ve finished with it.

gr->Dispose();

Draw lines and the outlines of shapes.

Create Pen objects, and use them in calls to Graphics class drawing functions. Use the Pens and SystemPens classes to obtain Pens with standard colors.

Fill shapes.

Create Brush objects, and use them in calls to Graphics class drawing functions. Use the Brushes and SystemBrushes classes to obtain brushes with standard colors.

Use colors.

Create Color objects, and use them when constructing Pen and Brush objects.

Display images.

Create a Bitmap object, passing it the name of an image file. Then use the DrawImage function of the Graphics class to render the image.

Print from an application.

Create a PrintDialog. Create a PrintDocument and assign it to the Document property of PrintDialog. Show the dialog box, and check whether it returns DialogResult::OK. Create a callback function, attach it to the PrintPage event of PrintDocument, and then call the Print function of PrintDocument to print the page.




Microsoft Visual C++  .NET(c) Step by Step
Microsoft Visual C++ .NET(c) Step by Step
ISBN: 735615675
EAN: N/A
Year: 2003
Pages: 208

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