Search code examples
winformswindows-7.net-4.0aeroaero-glass

Display only an Image with Transparency in a Windows Form?


I'm trying to get a form in my Windows Forms program to be borderless, invisible, and have a PictureBox control in it. The PictureBox image is set to a PNG with an alpha channel to give it a transparent background.

What I want is for the form to be completely invisible but I want the PNG with correct transparency to be visible still.

This is only going to be for Windows 7 with Aero theme on so any shortcuts Areo can afford me I can use.

I tried using a transparency key for the form like so:

this.TransparencyKey = Color.Turquoise;
this.BackColor = Color.Turquoise;

This ALMOST works except the parts of the PNG that aren't 100% transparent pick up the turquoise and gives the PNG an ugly turquoise halo around it.

EDIT: I found this article which sounds like it might be what I'm looking for but it doesn't go into specifics on implementation. Would this work for me? How do I do it?


Solution

  • I found a solution in this source code here:

    http://www.codeproject.com/Articles/29184/A-lovely-goldfish-desktop-pet-using-alpha-PNG-and