O'Reilly logo

Microsoft® .NET Compact Framework (Core Reference) by Mark Sutton, Rory MacLoed, Robert Burbidge, Stephen Wheelwright, Andy Wigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Graphics Class Drawing Methods

To begin using any of the graphics functions in the .NET Compact Framework, you must first obtain an instance of the Graphics class. You can then use its methods to render shapes, lines, text, and bitmaps to its surface. You obtain a Graphics object reference in one of the following ways:

  • Use the CreateGraphics method of the form or custom control to obtain a reference to the Graphics object that represents the drawing surface of the control or form. This method is used to draw to a form or custom control that already exists, as shown in the following code:

    Graphics MyGraphicsObject = this.CreateGraphics();
  • Use the FromImage method to work with an object that inherits from the Image class (such as a bitmap). Using this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required