O'Reilly logo

Graphics Programming with GDI+ by Mahesh Chand

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

7.6. Working with Icons

The Icon class represents a Windows icon, which is a small transparent bitmap. Just like the Bitmap class, this class is inherited from the Image class.

An application can create an Icon object from a stream, string, icon, icon file, or type by using the Icon class constructors with the size of the icon as an optional parameter. The Icon class provides four read-only properties—Handle, Height, Size, and Width—which return a window handle to the icon, height, size, and width of an icon, respectively.

Listing 7.21 creates an Icon object from an icon file and sets the icon of a form using the Form class’s Icon property.

Listing 7.21. Creating an icon and setting a form’s Icon property
 private void Form1_Load(object sender, ...

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