vu que moi ca marche bien je suspecte 2 choses:
1. this.ilIcons.Images[parNumImg];
kesako? t'es sur que c'est une bitmap correct?
2. p'tet que GetHicon marche que sur des bitmap qui on une taille d'icone
standart?
(16x16, 32x32, 48x48, 64x64, 96x96, 128x128)
ou un nombre de couleur standart (au pif j'dirais 16 & 256 couleurs, mais
j'ai vu des icones plus riches)
--
If you're in a war, instead of throwing a hand grenade at the enemy, throw
one of those small pumpkins. Maybe it'll make everyone think how stupid war
is, and while they are thinking, you can throw a real grenade at them.
Jack Handey.
<simone.poste (AT) libero (DOT) it> wrote
Quote:
I've a problem converting System.Drawing.Bitmap in System.Drawing.Icon
using the GetHicon method.
This is my code sample :
private void pSetIco(int parNumImg)
{
System.Drawing.Bitmap b;
b=new Bitmap(this.ilIcons.Images[parNumImg]);
this.StartIcon.Icon = Icon.FromHandle(b.GetHicon());
}
There are no runtime errors but the result icon is a black box.
I've try to save the bitmap to a file and the file is ok.
Can anyone help me? |