Problems with Icon in PictureBox (very small)

Ancestor
01-29-2005, 10:01 AM
Hi,

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

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

Ancestor
01-29-2005, 10: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.

OnErr0r
01-29-2005, 10: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.

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

OnErr0r
01-29-2005, 10: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.

OnErr0r
01-29-2005, 10: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

Ancestor
01-29-2005, 11:13 AM
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...

OnErr0r
01-29-2005, 11:28 AM
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