|
-
Jul 10th, 2013, 09:09 AM
#1
Thread Starter
Addicted Member
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!
-
Jul 10th, 2013, 09:18 AM
#2
Re: transparent PNG on picturebox
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!)
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Jul 10th, 2013, 09:24 AM
#3
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.
-
Jul 11th, 2013, 12:53 AM
#4
Thread Starter
Addicted Member
-
Jul 11th, 2013, 06:26 AM
#5
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
-
Jul 11th, 2013, 07:18 AM
#6
Thread Starter
Addicted Member
Re: transparent PNG on picturebox
They not from anti-aliasing, it's the 'transparent' part of the PNG. Which needs to blend with the background...
-
Jul 11th, 2013, 07:53 AM
#7
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.
Last edited by boops boops; Jul 11th, 2013 at 08:04 AM.
-
Jul 12th, 2013, 06:31 AM
#8
Thread Starter
Addicted Member
Re: transparent PNG on picturebox
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|