Alberto,
That isn't a silly question, but yes I change it to work with my stuff, but
I wouldn't put it past me either (darn copy and paste bugs). Well I was
doing more searching and if there would have 1 more lines in that sample it
would have worked. Here is the code I am using now:
System.Drawing.Bitmap Img = new System.Drawing.Bitmap(background);
Color mycolor = Img.GetPixel(transparencyColorLocation.X,
transparencyColorLocation.Y);
Img.MakeTransparent(mycolor);
this.BackgroundImage = Img;
this.BackColor = mycolor;
this.TransparencyKey = mycolor;
What was needed was this.BackColor. Once I added that and it seems to work
now. This is a generic form that is used for splash screens for our
application so the initial background image is passes as a paramater to the
constructor.
Thanks for the help,
Eric
"Alberto Poblacion" <ea******************************@poblacion.orgwro te
in message news:eC**************@TK2MSFTNGP04.phx.gbl...
"Eric Renken" <Er********@newsgroup.nospamwrote in message
news:Oz**************@TK2MSFTNGP05.phx.gbl...
>The work around at
http://support.microsoft.com/default...b;en-us;822495 doesn't
work. When I do this I end up seeing the background color for the form,
and you can't set the Background Color of a form to transparent if you do
you get a nice runtime error.
I'm going to say a silly thing, but the above-mentioned workaround takes
the transparencykey color from the pixel at (10,10) in the bitmap. Have
you verified that the color that you are taking is *really* the color that
you chose as transparent?
If you are only doing this to get a non-rectangular form, there's an
alternative aproach that works at all color depths:
1. Override the OnPaint event of the form.
2. In OnPaint, create a new instance of the GraphicsPath class.
3. Use the methods of the GraphicsPath object, such as AddEllipse, to
specify the shape and size required for the form.
4. Set the Region property of the form to a new Region, passing in the
constructor the GraphicsPath object that you have just created.