Chapter 14. The System.Drawing Namespace
The System.Drawing
namespace contains the classes that make up the .NET implementation
of GDI+—Microsoft’s next-generation graphics
architecture. If you are familiar with the C++ implementation shipped
with Microsoft’s Platform SDK, then you will
recognize most of the classes found here. However,
System.Drawing is not a wrapper around the C++
code; both are implemented in terms of a common, low-level graphics
architecture, which at the time of writing has an unpublished API.
All drawing is carried out on a Graphics surface,
using various kinds of Pen,
Brush, and Image objects. You
can control the Color (including transparency),
Font, line style, and fill patterns of these
objects, but the Graphics surface itself is
responsible for the actual painting, providing methods such as
DrawString(), DrawRectangle(), and FillClosedCurve() for this
purpose. You can set up clipping Regions, control
rendering styles such as antialiasing and compositing, or use a
transform matrix (see
System.Drawing.Drawing2D.Matrix) to rotate, scale,
shear, and translate the drawing.
Usually, you will be supplied a Graphics surface
on which to draw in the PaintEventArgs passed to
your Control object’s paint
handler. However, you can also create surfaces from
Control objects, Image objects
(such as Bitmap and Metafile),
or native GDI device contexts (through interop).
Because there are no objects that represent the drawing operations themselves, you cannot simply persist ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access