469,631 Members | 1,099 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Making image colors transparent

Hi,

I have a bmp that is set in a panel, i want to make the white color in the
bmp image transparent so i can see the color of the panel below. How is
this done?

thanks
tony
Mar 8 '06 #1
5 2346
You wouldn't. This can't be done with a Bitmap, but only with an icon or a
cursor.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

"Tony Clark" <To**@here.com> wrote in message
news:OG**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a bmp that is set in a panel, i want to make the white color in the
bmp image transparent so i can see the color of the panel below. How is
this done?

thanks
tony

Mar 8 '06 #2
I don't know if this is what you are after, but I would take the bitmap,
erase the white color, and give it a transparent background (PhotoShop works
nicely for this). Then you can import the new gif into the editor.

Rob K

"Tony Clark" wrote:
Hi,

I have a bmp that is set in a panel, i want to make the white color in the
bmp image transparent so i can see the color of the panel below. How is
this done?

thanks
tony

Mar 8 '06 #3
Hey Tony, if you don't mind getting your hands a little dirty with
graphics, try Paint .NET . I've been using it for a couple of weeks now
and I'm pretty happy with it. Took a little while to learn since I had
never used an imaging program before. Now that I know how to do it
though, I'm able to do a fair amount of tweaking of images without
having to send them back to the graphic arts guys I work with.

If you're trying to programmatically add in the transparency, then that
cannot be done. Good luck ~ Justin

Mar 8 '06 #4
It doesn't matter, Justin. The image is in a panel. It cannot be rendered
transparent. What he *could* do is override the Paint event that paints the
image, and draw all the white pixels the same color as the BackColor of the
Panel.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

"JustinC" <ju***********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Hey Tony, if you don't mind getting your hands a little dirty with
graphics, try Paint .NET . I've been using it for a couple of weeks now
and I'm pretty happy with it. Took a little while to learn since I had
never used an imaging program before. Now that I know how to do it
though, I'm able to do a fair amount of tweaking of images without
having to send them back to the graphic arts guys I work with.

If you're trying to programmatically add in the transparency, then that
cannot be done. Good luck ~ Justin

Mar 9 '06 #5

Tony Clark wrote:
Hi,

I have a bmp that is set in a panel, i want to make the white color in the
bmp image transparent so i can see the color of the panel below. How is
this done?

thanks
tony

This is a bit roundabout but it works for me in .NET 2.0:

1 Add an ImageList to your form.
2 Put your bmp image into your ImageList.
3 Set the image size and transparent colour (white) in your ImageList.
4 Switch to the code view and add the line below to the end of your
form's constructor:

panel1.BackgroundImage = imageList1.Images[0];

(0 is the index of your image in your ImageList)
I had to load the image in code because I could not see a way to point
the
panel background image to the ImageList in the Properties window.

The same method works for a PictureBox as well:
pictureBox1.Image = imageList1.Images[0];

In both cases the colour assigned as transparent in the ImageList was
indeed transparent.

rossum

Mar 9 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mr. x | last post: by
1 post views Thread by Spike | last post: by
5 posts views Thread by Headless | last post: by
3 posts views Thread by MediaDesign | last post: by
4 posts views Thread by MC D | last post: by
35 posts views Thread by Stan Sainte-Rose | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.