The transparent areas of the icon are lost when it is converted to a bitmap, and the transparent color of the resulting bitmap is set to RGB(13,11,12). The returned bitmap has the same height and width as the original icon.
The following code example demonstrates how to use the ToBitmap method. This example is designed to be used with Windows Forms. Create a form and paste the following code into it. Call the IconToBitmap method in the form's .Paint event handler, passing e as PaintEventArgs .