Problems with GetHicon method - 09-28-2005 , 07:58 AM
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)
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?
Re: Problems with GetHicon method - 09-28-2005 , 08:59 AM
vu que moi ca marche bien je suspecte 2 choses:
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
(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.
<simone.poste (AT) libero (DOT) it> wrote
Re: Problems with GetHicon method - 09-28-2005 , 12:29 PM
I fill shoure that the bitmap in the imagelist is ok and the size is
16x16. I've try to save che bitmap after extrat it from the imagelist.
I've also try to save the bitmap as Icon and that to load an icon from
this file but the system gives me a cast conversion error.
Re: Problems with GetHicon method - 10-07-2005 , 08:50 AM
I've solved the problem :
before the Main sub there was a directive : [STAThread]
Deleting this code line my application running well.
But now my question is : why till 1 month ago I can run application
with[STAThread] without problem and today it doesn't work? And more
What does [STAThread] means?
|Thread Tools||Search this Thread|