O'Reilly logo

A Programmer's Guide to .NET by Alexei Fedorov

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

11.4. System.Drawing namespace

The main class in this namespace is Graphics. It provides the device context for drawing. We can create device contexts from handles by using the FromHDC(IntPtr ) method, Windows handles by using the FromHWnd(IntPtr ) method, and images by using the FromImage(Image ) method. After we get the device context, we can manipulate regions, perform rendering and transformation, work with metafiles, and draw various geometric figures – arcs, Bezier curves, ellipses, lines, and so on – on the device surface. This is supported by the set of DrawXXX methods shown below:

  • DrawArc;

  • DrawBezier;

  • DrawClosedCurve;

  • DrawCurve;

  • DrawEllipse;

  • DrawIcon;

  • DrawImage;

  • DrawImageUnscaled;

  • DrawLine;

  • DrawLines;

  • DrawPath;

  • DrawPie;

  • DrawPolygon;

  • DrawRectangle ...

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