i will show you an image below but before that...
if you have seen yahoo widgets or cartoony/themed windows media player skins..
i am building a titlebar less... background less... application... its looks like this
(source: deviantart.net)
the darker background you see is actually my wallpaper cuz this is a screen shot...
to attain this.. the shape of body and the lines, i use Trasparent PNG.. then i use the transparency key of the Win Form to make it transparent.. and the image is loaded in a picture box...
my problem is the white dots you see all over the body outline... this is because the pixels of that PNG in that are not completely opaque or transparent i.e translucent... so the transparency key fails to make the background of the form transparent at those pixels... and you see these white dots...
well
is there any other way make the form transparent because...
- transparency key will always behave like this because no matter what you do there will always be these translucent pixels in the image at curves...
Johannes has mentioned the main issues with your current approach.
It is possible to do form alpha blending in Windows Forms but you will need to use the Windows API call (among others): UpdateLayeredWindow.
Visual C# kicks has a helpful tutorial and source code on how to do this to create a professional looking splash screen.
The only drawback is that if your form contains child controls such as buttons, textboxes, they will not be drawn using UpdateLayeredWindow. However you could still simulate buttons etc by manually drawing them as part of the form background.
Your problems here are
- The PNG is anti-aliased
- It is composited against the normal form background (SystemColors.Control)
- If you make that transparent using the TransparencyKey property (which makes a single color transparent, but nothing else), you'll end up having opaqueness where the PNG had partial transparency
So far, so expected. Keep in mind: You're not drawing a partially-transparent PNG onto the screen; you're drawing it onto your form and you then take the end result and make a single color transparent. For all what it's worth, your PNG could have pink as the surrounding color, the result would be the same.
You may want to look at regions or don't anti-alias the PNG you're drawing.