This appendix provides information about graphics classes.
This section describes the most important graphics namespaces and their most useful classes, structures, and enumerated values.
This namespace defines the most important graphics objects such as Graphics, Pen, Brush, Font, FontFamily, Bitmap, Icon, and Image. The following table describes the namespace’s most useful classes and structures.
Classes and Structures | Purpose |
---|---|
Bitmap | Represents a bitmap image defined by pixel data. |
Brush | Represents area fill characteristics. |
Color | Defines a color’s red, green, blue, and alpha components as values between 0 and 255. Alpha = 0 means the object is transparent; alpha = 255 means it is opaque. |
Font | Represents a particular font (name, size, and style, such as italic or bold). |
FontFamily | Represents a group of typefaces with similar characteristics. |
Graphics | Represents a drawing surface. Provides methods to draw on the surface. |
Icon | Represents a Windows icon. |
Image | Abstract base class from which Bitmap, Icon, and Metafile inherit. |
Metafile | Represents a graphic metafile. |
Pen | Represents line drawing characteristics (such as color, thickness, and dash style). |
Pens | Provides a large number of predefined pens with different colors and width 1. |
Point | Defines a point’s X and Y coordinates. |
PointF | Defines a point’s X and Y coordinates with floating-point values. |
Rectangle | Defines a rectangle using a Point and a Size. |
RectangleF | Defines a rectangle using a PointF and a SizeF (with floating-point values). |
Region | Defines a shape created from rectangles and paths for filling, hit testing, or clipping. |
Size | Defines a width and height. |
SizeF | Defines a width and height with floating-point values. |
SolidBrush | Represents a solid brush. |
This namespace contains classes for more advanced two-dimensional drawing. Some of these classes refine more basic drawing classes. For example, the HatchBrush class represents a specialized type of Brush that fills with a hatch pattern. Other classes define values for use by other graphics classes. For example, the Blend class defines color-blending parameters for a LinearGradientBrush.
The following table describes this namespace’s most useful classes and enumerations.
Classes and Enumerations | Purpose |
---|---|
Blend | Defines blend characteristics for a LinearGradientBrush. |
ColorBlend | Defines blend characteristics for a PathGradientBrush. |
DashCap | Enumeration that determines how the ends of a dash in a dashed line are drawn. |
DashStyle | Enumeration that determines how a dashed line is drawn. |
GraphicsPath | Represents a series of connected lines and curves for drawing, filling, or clipping. |
HatchBrush | Defines a Brush that fills an area with a hatch pattern. |
HatchStyle | Enumeration that determines the hatch style used by a HatchBrush object. |
LinearGradientBrush | Defines a Brush that fills an area with a linear color gradient. |
LineCap | Enumeration that determines how the ends of a line are drawn. |
LineJoin | Enumeration that determines how lines are joined by a GDI method that draws connected lines. |
Matrix | Represents a transformation matrix. |
PathGradientBrush | Defines a Brush that fills an area with a color gradient that follows a path. |
This namespace contains objects that deal with more advanced bitmap graphics. It includes classes that define image file formats such as GIF and JPG, classes that manage color palettes, and classes that define metafiles. The following table describes this namespace’s most useful classes.
Class | Purpose |
---|---|
ColorMap | Defines a mapping from old color values to new ones. |
ColorPalette | Represents a palette of color values. |
ImageFormat | Specifies an image’s format (bmp, emf, gif, jpeg, and so on). |
Metafile | Represents a graphic metafile that contains drawing instructions. |
MetafileHeader | Defines the attributes of a Metafile object. |
MetaHeader | Contains information about a Windows metafile (WMF). |
WmfPlaceableFileHeader | Specifies how a metafile should be mapped to an output device. |
System.Drawing.Text | This namespace contains only three classes for working with installed fonts. The following table describes these classes. |
Class | Purpose |
---|---|
FontCollection | Base class for the derived InstalledFontCollection and PrivateFontCollection classes. |
InstalledFontCollection | Provides a list of the system’s installed fonts. |
PrivateFontCollection | Provides a list of the application’s privately installed fonts. |
This namespace contains objects for printing and managing the printer’s characteristics. The following table describes the most useful of these classes.
Class | Purpose |
---|---|
PageSettings | Defines the page settings for either an entire PrintDocument or for a particular page. This object has properties that are Margins, PaperSize, PaperSource, PrinterResolution, and PrinterSettings objects. |
Margins | Defines the margins for the printed page. |
PaperSize | Defines the paper’s size. |
PaperSource | Defines the printer’s paper source. |
PrinterResolution | Defines the printer’s resolution. |
PrinterSettings | Defines the printer’s settings. |