Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BackgroundTransparencyIssue

Status
Not open for further replies.

jake007

Programmer
Jun 19, 2003
166
0
0
US
I am using a bitmap as a background to a form. The Bitmap has areas of red that I want to be transparant. When I sent the actual form background to be red, then set the transparancy value to red, the whole form is transparent, just as it should be, but when I set the background to the bitmap image, the red areas are not transparent. Am i doing something wrong or does the transpareancy feature not work with an image background?

Jake
 
Set the image you want and then the traspencykey color to red. DO NOT set the backcolor same to the traspencykey color
 
I did turn off the background color. I did that just to test the transparency option. Background color is set to none.

Jake
 
The red places in your image must be really red. BOTH same rgb values
 
I selected RED from the transparencyvalue drop down, my image is r = 255, g = 0, b = 0, how do I know the exact RGB value of the drop down RED from the transparancykey option.

Jake
 
This is the best way to set the TransparencyKey to an exact color.

in the form load event use this command

Me.TransparencyKey.FromArgb(255, 0, 0)

good luck.

Becca

Somtimes, the easy answer is the hardest to find. :)

Still under construction ...
 
Still no luck,apparantly the transparency only works on the background, not a background image.

Jake
 
Have not tried this, but it is a thought ... Make a gif with part of it already set to transparent (the color you are going to use in the TransparencyKey would make the most sence to me.)

Becca

Somtimes, the easy answer is the hardest to find. :)

Still under construction ...
 
So anybody have any Ideas why this will not work? Posted same question on several forums but no luck. Find it hard to beleive this is not possible.

Jake
 
I tried to get it going for some time, but failed. I don't think this feature is quite ready for prime-time...
 
If you are simply trying to shape the form, then set its region instead of trying to get the transparency to work.
 
I know I can use the region, But I had a very well designed bitmap that would work perfectly for my app as was hoping the transparency function actually worked. Haven't gotten any respons from Microsoft on this one, but then again, I gues it is not a major issue either.

Jake
 
I have this cute little program I am working on, that looks like a little house. I made the bmp, then set the forms shape so it looked really neat.

Code:
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
        Dim myShape As Point() = {New Point(140, 0), New Point(280, 70), New Point(280, 80), _
            New Point(260, 80), New Point(260, 330), New Point(20, 330), New Point(20, 80), _
            New Point(0, 80), New Point(0, 70), New Point(40, 50), New Point(40, 10), _
            New Point(80, 10), New Point(80, 30), New Point(140, 0)}
        shape.AddPolygon(myShape)
        Me.Region = New System.Drawing.Region(shape)

Becca

Somtimes, the easy answer is the hardest to find. :)

Still under construction ...
 
I bet one of your monitors is running under 32 bit color, whereas the other is not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top