S
SQACSharp
Hi,
I'm trying to do a simple thing since at least 5 hours![Frown :( :(](/styles/default/custom/smilies/frown.gif)
At runtime I add several icon to an imageList and use it later to fill
a treeview.
When adding the icon to the ImageList the transparency is lost and a
blue background is displayed instead.
Here is some code to explain my problem :
//IconHandle is already set to a valid HICON; the Icon of a wordpad
mainWindow by example
....
Icon AppIcon = new Icon(IconHandle );
Bitmap Bmp = new Bitmap(AppIcon.Width, AppIcon.Height);
Graphics g = Graphics.FromImage(Bmp);
g.DrawImage(Bmp,new Point(0,0)); //This ensure transparency
g.Dispose();
pictureBox1.Image = Bmp; // The image is correctly displayed in a
picturebox
MyImageList.Images.Add(Bmp);
pictureBox2.Image = MyImageList.Images[MyImageList.Images.Count-1];
// The image is INCORRECTLY displayed with a "random" color instead of
the transparency color
Question :
How can I add an image to an imageList and keep the transparency. I
already try almost everyting possible with no luck.
Thanks
I'm trying to do a simple thing since at least 5 hours
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
At runtime I add several icon to an imageList and use it later to fill
a treeview.
When adding the icon to the ImageList the transparency is lost and a
blue background is displayed instead.
Here is some code to explain my problem :
//IconHandle is already set to a valid HICON; the Icon of a wordpad
mainWindow by example
....
Icon AppIcon = new Icon(IconHandle );
Bitmap Bmp = new Bitmap(AppIcon.Width, AppIcon.Height);
Graphics g = Graphics.FromImage(Bmp);
g.DrawImage(Bmp,new Point(0,0)); //This ensure transparency
g.Dispose();
pictureBox1.Image = Bmp; // The image is correctly displayed in a
picturebox
MyImageList.Images.Add(Bmp);
pictureBox2.Image = MyImageList.Images[MyImageList.Images.Count-1];
// The image is INCORRECTLY displayed with a "random" color instead of
the transparency color
Question :
How can I add an image to an imageList and keep the transparency. I
already try almost everyting possible with no luck.
Thanks