How to use transparent image as background on transparent winform? [duplicate]
I have a WinForm in C#, I have both BackCOlor and TransparencyKey set to color "Lime". If I compile at this point the form is transparent. Then I added an BackgroundImage with a Lime background (#00ff00), but the Lime on the image is not transparent.
How can I get the background image to have a transparent background too?
The image I used is a .bmp
I'm pretty sure the Lime color in the picture is not identical to Lime you set as TransparencyKey.
Use ColorPicker: http://www.iconico.com/download.aspx?app=ColorPic&type=free
over your picture to see what color code the lime in the picture has: e.g. #XXXXXX. Then put that number in TransparencyKey, don't just use "Lime".
Use an image format that supports transparency such as PNG.
It works for me. Are you sure that the BMP has exactly the same background color as your form, and that it has not been altered some way, perhaps by a reduction in the number of colors or something similar?
精彩评论