Last post Feb 19, 2009 03:47 PM by kgolding
Dec 05, 2007 11:30 AM|gretchen|LINK
I'm trying to draw a totally transparent image - 200 pixels wide and 500 pixels high - all I get is a black image.
Dec 05, 2007 12:00 PM|robert.westerlund|LINK
Have a look at http://www.bobpowell.net/giftransparency.htm, where you'll find an explanation of how to do it.
Dec 05, 2007 12:30 PM|gretchen|LINK
Thanks for the link - I already had tried to wade through that - but there must be an easier way - All I want is a brand new totally transparent gif of a specific size. I am not trying to change an existing file. This can't be but a few lines of code. I'm
obviously new to GDI+, but why doesn't graphics.clear(color.transparent) work as expected?
Dec 05, 2007 03:50 PM|CurtWRC|LINK
I believe when you do graphics.clear() you are essentially adding a new 'layer' to the image on top of the existing layers. So by adding graphics.clear(color.transparent) its as if its adding a transparent later on top. If you replace transparent with red
i believe that will be added on top. So this is why its probably not working how you would expect.
Dec 05, 2007 04:05 PM|gretchen|LINK
Thanks Curt - that makes sense. Does this mean there is no way to 'easily' produce a transparent gif?
Feb 19, 2009 03:47 PM|kgolding|LINK
I think what you have will work fine, just make the follwing change:
Change this: Dim ChartBitMap
As Bitmap = New Bitmap(ChartWidth, ChartHeight)
TO: Dim ChartBitMap
As Bitmap = New Bitmap(ChartWidth, ChartHeight, PixelFormat.Format32bppArgb)