Problems with Icon in PictureBox (very small)

01-29-2005, 11:01 AM

I've a problem while loading an icon into a picturebox. The icon appears only with 16x16 pixels. Is there any sollution for this problem.

The vbLPLarge property doesn't help.

Greetz Ancestor

01-29-2005, 11:10 AM
Explain in some detail how you are drawing the icon and how many sizes the icon contains.

01-29-2005, 11:18 AM
Explain in some detail how you are drawing the icon and how many sizes the icon contains.

I attached an icon which is only available in 16x16 pixels by adding it to the picture property of the pictureBox or the imagelist. Its maximum size is 128x128 pixels.

01-29-2005, 11:26 AM
LoadPicture is probably confused by the fact that the icon is 32bit color. Reduce the number of colors of the icon to 256 and it should work.

01-29-2005, 11:32 AM
Is there any freewaretool to reduce the colors...?

01-29-2005, 11:43 AM
The old shareware microangelo couldn't handle it. VS.NET 2003 could. I just created new icons of 256 colors and copy/pasted in the 32bit images. Last I deleted the 32bit images from the ICO.

01-29-2005, 11:49 AM
Btw, you will have to access the icon like so:

Option Explicit

Private Sub Form_Load()
Set Picture1.Picture = LoadPicture("c:\adaware256.ico", vbLPLarge, vbLPColor, 32, 32)
End Sub

01-29-2005, 12:13 PM
Thanks a lot.
It works with 256 colors after adding the vbLPColor statement.
Is there any posibility to add 32bit or just 16bit icons via pivture box or is this the only solution to reduce the colors...

01-29-2005, 12:28 PM
VB cannot natively handle the drawing of icons with more than 256 colors. However, you should be able to use GDI+ to draw them. I'll give it a try and let you know. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum