Groups | Blog | Home
all groups > dotnet drawing api > october 2003 >

dotnet drawing api : Transparent Areas in Bitmap in PictureBox


Konstantine
10/7/2003 2:09:45 AM
Hi,

I have spent several hours trying to find an answer to this and I am having
no luck. I know this has been asked before but I can not find or come up
with an answer that works

I have a VB.NET app and I want to 'overlay' a bitmap on it. The bitmap has
several areas 'cutout' using the color 255,0,255. The cutout areas are
supposed to allow you to see through the bitmap/overlay to the form and
controls below.

I have tried using the MakeTransparent method and it makes the specified
transparent color 'gray'. Actually it makes it
System.Drawing.SystemColors.Control from the specified transparent color
System.Drawing.Color.FromArgb(255, 0, 255).

I have tried setting the Color of the PictureBox to Transparent and that
still does not help.

So, is there any way to have an image overlaid over a form and have the
transparent areas show the controls underneath the PictureBox (or Button or
Label1, etc.).

Or am I going about this the wrong way altogether?

Thanks in advance,

Konstantine

Bob Powell [MVP]
10/7/2003 10:06:44 AM
Take a look at my tips and tricks page. It has an article on creating
transparent controls.

If you want to click through the transparent areas, look in the GDI+ FAQ for
an article on how to extract a region from a bitmap. You can make the
control's region conform to the bitmap's non transparent bits and then
clicks will pass through the holes.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm



[quoted text, click to view]

Konstantine
10/7/2003 10:12:32 AM
Bob,

That looks like it will do what I need.

Thanks,

Konstantine


[quoted text, click to view]

AddThis Social Bookmark Button