Re: Windows forms with Transparent Backgrounds



"Eric Renken" <EricRenken@xxxxxxxxxxxxxxxx> wrote in message news:Oz3P92qhHHA.5044@xxxxxxxxxxxxxxxxxxxxxxx
The work around at http://support.microsoft.com/default.aspx?scid=kb;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.


.



Relevant Pages

  • Re: Windows forms with Transparent Backgrounds
    ... That isn't a silly question, but yes I change it to work with my stuff, but ... 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 ... Use the methods of the GraphicsPath object, such as AddEllipse, to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Color Bug?
    ... If you set the background color of a component, be sure the color has no ... public void adjustColor(int r, int g, int b, int a) { ... a transparent color rendering effect. ...
    (comp.lang.java.programmer)
  • Re: Bitmap to Icon
    ... What I'm doing is reading an .ico file then converting it to a bitmap which I ... I make the background color transparent then convert it back to ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Shape background
    ... This is nowhere near as easy as it seems because computers are very bad at ... is completely transparent fill the same as background ... should we compare slide background color and shape background color? ...
    (microsoft.public.powerpoint)
  • Re: Format DataList
    ... I tried setting the background color of the table to transparent like ... <HeaderTemplate> ... rendered rather than that of the template. ...
    (microsoft.public.dotnet.framework.aspnet)