mdhr
mdhr

Reputation: 25

How can I set a transparent image to my form's background in c#?

I made a transparent background image in photoshop but when I use it as my form's background image,it doesn't use form's back color(blue),so that I cannot use this code to make a transparent form.

this.BackColor = Color.blue;
this.TransparencyKey = Color.blue;

If I use white color instead,my other tools fore color face problem.I'm trying to make windows form app.I don't know if there are easier & better alternatives to make a transparent form.

What should I do?

Upvotes: 0

Views: 985

Answers (1)

deepee1
deepee1

Reputation: 13226

Referencing a post from here and my own experience with having trouble on form transparency with types of images I expect it's because it's the fact it's JPG and not PNG or some other transparent friendly image format. I had the same problem and when I changed to PNG format it worked for me.

Reading results from a couple of random google searches it seems JPEG doesn't support transparency do to file format limitations.

Why am I getting a black background around my images when resizing even when Bitmap is set to Graphics.Clear(Color.Transparent)

Upvotes: 1

Related Questions