PNG images have an alpha cannel, wich control their transparencie...
Try to use a BMP version of the same image...
As I understand, the transparency feature works by getting the o,o (x,y)pixel color, and then set them all to the same collor as the background...
Hello gs4322
You must know that the upper left pixel determines the transparency color.
If you have placed your button with the Designer you can select or unselect the Tranparent property which defines the state at programm start.
If you have placed the control by code in the App_Start routine you should set the Transparent property to true or false depending on what you need.
I have used this method with buttons with white as transparency color and a black frame around but white pixels in the corner because it determines the transparency color with bitmaps.
I found the problem, when I resized the PNG images I must lost some property format or did not save correctly. The original PNG was 128x128 pix. Anyway, I used the original and resize the ImageBtn to 48x48pix and the image looks fine now.
This problem started wanting to display ICONS (ico) formats.
The ImageButton transparent parts show the forms colors.
You will need to remove the image and the panel and draw the image on the form.
See the attached file.
I have modified your program with 4 ImageButtons.
The upper two's parent control is Form1
the lower two's parent control is Panel1
the left two with .png images
the right two with .bmp images
And Button1 to toggle between transparent ant not transparent.
As you can see, the upper two buttons show the Form1 background color
the lower two show the Panel1 background color.
An image control can not be a parent control so the image button cannot show it's image.
A panel control can be a parent control but doesn't have an image property.
So, as Erel told, you must put the image on Form1 ant the image buttons parent control must also be Form1.
The top right buttons transparent color is almost the same as the Form1 background color that's why there seems not be any change in toggling.