transparent PNG on picturebox
I've been googling this issue for hours now. Found a lot of examples, but they are all not workable for me.
I have a windows forms app, with a picturebox, and I want a transparent PNG on it with Alpha blending.
Seen a lot of exmples, but most of them are on transparent main forms. I just need to add the PNG to the picture box, without the ugly white/black edges.
Thnx!
Re: transparent PNG on picturebox
Quote:
and I want a transparent PNG on it with Alpha blending.
Well it might help if you made yourself clear as to what exactly you want. Alpha blending kinda needs something to blend with so what exactly are you trying to achieve? You say that examples are not workable for you so tell us why. And here's a crazy idea! If you want us to see what you want and what you don't want from an image how about you actually provide us with some screenshots? After 200+ posts you really ought to know that vague questions get vague answers (if they get answers at all!)
Re: transparent PNG on picturebox
The only time I've ever worked with Alpha Blending in vb.net is with XNA, which does have sort of a steep learning curve.
1 Attachment(s)
Re: transparent PNG on picturebox
Basicly, I want this to look pretty; (see picture attachment)
It looks good on a white background, but not a on black background.
(I've extended my form transparency with: DwmExtendFrameIntoClientArea)
Re: transparent PNG on picturebox
Those light-coloured pixels are part of your icon image. They usually result from anti-aliasing.
If you have the icon as an image you can erase the unwanted pixels to transparent in a program like Paint.Net. If necessary, capture the icon image on a plain background, and erase all the background. Then save the cleaned-up image as a new icon for example with MS-Paint.
BB
1 Attachment(s)
Re: transparent PNG on picturebox
Attachment 102113
They not from anti-aliasing, it's the 'transparent' part of the PNG. Which needs to blend with the background...
Re: transparent PNG on picturebox
If you put a "transparent" Image in a PictureBox with Backcolor=Transparent, partly transparent pixels of the image will alpha-blend with the parent control's client area. Here the parent control is the Form. But the black area isn't the client area! You used ExtendFrameIntoClientArea, so it's the frame. The frame uses different painting code to the client area, and there is no way to force it to do alpha blending for you.
So instead of trying to get alpha blending, make an opaque icon. That isn't hard to do because your background (the extended border) is a solid, unchanging colour. Get the icon image, strip off any unwanted pixels and blend into into a black background. You could do the last step in code, but I think you could get better results in a Paint program with layers and a Feather filter such as Paint.Net.
BB
edit: You may want to try making the background colour of the icon image transparent black (0,0,0,0) instead of Color.Black. That way, the icon background will be black over the frame and transparent over the client area.
Re: transparent PNG on picturebox