J
jaumef_2000
Hello, I'm developing a Standard Windows App and I need to deal with
Icons.
I've read lots of posts about them and I'm missing something. I put
this code in a button click in a new brand new solution:
Bitmap bmp = new
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsApplication1.Bitmap1.bmp"));
Icon ic = Icon.FromHandle(bmp.GetHicon());
Icon ic2 = new
Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsApplication1.App.ico"));;
this.pictureBox1.Image = bmp;
this.pictureBox2.Image = ic.ToBitmap();
this.pictureBox3.Image = ic2.ToBitmap();
Results are:
bmp is displaying OK.
ic, that should be a copy of bmp is a black square.
ic2 is displaying but with black background instead of transparent.
What I'm missing?? I must work with Icons and none ways work correctly.
I'm using .net Framework 1.1 with SP1. The App.ico is the automatically
generated by VS, the bitmap is generated by VS....
I've tried everything writen in all posts I found and no results.....
When creating an Icon from a bitmap always get a black square,
different bpp = black square, creating a bmp from an icon OK the an
icon from that bmp = black square, I've changed securitypermission to
allow unmanaged code due to the Hicon = black square. I've ran out of
ideas and time....
Please Help needed
Thanks in advance.
Jaume Figueras.
Icons.
I've read lots of posts about them and I'm missing something. I put
this code in a button click in a new brand new solution:
Bitmap bmp = new
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsApplication1.Bitmap1.bmp"));
Icon ic = Icon.FromHandle(bmp.GetHicon());
Icon ic2 = new
Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsApplication1.App.ico"));;
this.pictureBox1.Image = bmp;
this.pictureBox2.Image = ic.ToBitmap();
this.pictureBox3.Image = ic2.ToBitmap();
Results are:
bmp is displaying OK.
ic, that should be a copy of bmp is a black square.
ic2 is displaying but with black background instead of transparent.
What I'm missing?? I must work with Icons and none ways work correctly.
I'm using .net Framework 1.1 with SP1. The App.ico is the automatically
generated by VS, the bitmap is generated by VS....
I've tried everything writen in all posts I found and no results.....
When creating an Icon from a bitmap always get a black square,
different bpp = black square, creating a bmp from an icon OK the an
icon from that bmp = black square, I've changed securitypermission to
allow unmanaged code due to the Hicon = black square. I've ran out of
ideas and time....
Please Help needed
Thanks in advance.
Jaume Figueras.