Alpha Blending

All colors in GDI+ have a fourth component in addition to the normal red, green, and blue values. This value is the “alpha” and it controls the amount that the background shows through the object just placed onscreen.

Alpha blending can be applied to all graphical shapes, such as lines and text. It can also be applied to images, either as a global value that affects the appearance of the whole image, or as a value for each individual pixel, which makes parts of the image more transparent than others.

To create a color with an alpha component, you can use the Color.FromARGB(…) method and supply the alpha as a value from 0, totally transparent, to 255, which is opaque.

Listing 3.5.9 demonstrates this effect by creating an array of ...

Get C# and the .NET Framework: The C++ Perspective now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.