transparent gif

windows

Guest
Ok.This have been a problem for me thelongest time.

I cant seem to genrate a transparent gif and stream it to the browser.

I've studied a couple of articles/code-snippets on this with a bit of a frustating result.

one article: <!-- m --><a class="postlink" href="http://www.realworldasp.net/article.asp?article=142">http://www.realworldasp.net/article.asp?article=142</a><!-- m --> seems to work. When I link to the page that streams an image, the image actually appears to be transparent. (i checked by using diffrent background colors) the problem with this is that the code is in VB. I ofcourse, use C#

the other article: <!-- m --><a class="postlink" href="http://aspalliance.com/cookbook/ViewChapter.aspx?Chapter=22">http://aspalliance.com/cookbook/ViewCha ... Chapter=22</a><!-- m --> (link onthe bootom) have the code-sample in C# but when I use it (or link to the apsx-page that strams the image) the background does NOT appear to be transparent.

Now, the two code-samples looks very similar but yet, when i try it, it simply does not work.

Can anyone help me on this? does the second snippet of code work for anyone else?

cheers!Ok... this is what I've come up with... after LOADS of hours...

I converted the code from the realworldasp-link from VB to C#

however in order to pass the compilation I had to change the following:

win32api win32 = new win32api();
win32.CopyArrayTo(pBits, bits, Height * stride);

to

//win32api win32 = new win32api();
win32api.CopyArrayTo(pBits, bits, Height * stride);

this because I get a error message:
"Static member 'myProject.win32api.CopyArrayTo(int, byte[], int)' cannot be accessed with an instance reference; qualify it with a type name instead"

This is why I have to chanhe it. I am now wondering (except for the obvious why...) what the risks/limitations with this might be by doing it this way.

I am not good at .NET arcitecture, but it seems to me like a stupid thing to do... can anyone explain to me what I'm doing?

thanks...

by the way... the win32api declaration looks like this:

public class win32api
{
[DllImport("KERNEL32.DLL", EntryPoint="RtlMoveMemory", SetLastError=true, CharSet=CharSet.Auto, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]

public static extern void CopyArrayTo([In, MarshalAs(UnmanagedType.I4)] Int32 hpvDest, [In, Out] byte[] hpvSource, int cbCopy);

}
 
Back
Top