Microsoft KB Archive/90872

= VB3 Converting an Icon (.ICO) to Bitmap (.BMP) Format =

Article ID: 90872

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 1.0 Standard Edition

-



This article was previously published under Q90872



SUMMARY
You can convert a Windows icon file (.ICO) to a Windows bitmap (.BMP) file by storing the icon in a picture box, and then using the SavePicture statement with the Image property of the picture control.



MORE INFORMATION
You may wish to convert an icon format file to the bitmap format to perform operations that cannot be performed on icon format files, such as loading the image into Microsoft Windows Paintbrush.

To convert an icon format file to a bitmap format file, assign the icon to the Picture property of a picture box property (at design-time or run-time). At run-time, use the following statement:

SavePicture Picture1.Image, &quot;filename.bmp&quot;

When you convert an icon to a bitmap, you lose device independence for resolution characteristics. Windows bitmap format files, which usually have a .BMP extension, represent an image with device independent color information. Windows icon files, which usually have an .ICO extension, can contain information for both color and resolution device independence.

The steps listed below demonstrate how to convent an icon format file to a bitmap format file:

 Run Visual Basic for Windows, or from the File menu, choose New Project (press ALT, F, N) if Visual Basic for Windows is already running. Form1 will be created by default. Place a picture box named Picture1 on Form1.  Enter the following code into the form's Click event: Sub Form_Click Picture1.AutoSize = -1 Picture1.Picture = LoadPicture(&quot;icons\arrows\arw01dn.ico&quot;) SavePicture Picture1.Image, &quot;arw01dn.bmp&quot; End Sub

 Press the F5 key to run the program. Click Form1 to convert the file.

