Draw an image with custom transparency in GDI?

You just create an appropriate ColorMatrix, initialize a ImageAttributes object with it and pass that ImageAttributes object to one of the overloaded version of Graphics.DrawImage. This sample will give you 50% transparancy.

You just create an appropriate ColorMatrix, initialize a ImageAttributes object with it and pass that ImageAttributes object to one of the overloaded version of Graphics.DrawImage. This sample will give you 50% transparancy: float matrixAlpha = { new float {1, 0, 0, 0, 0}, new float {0, 1, 0, 0, 0}, new float {0, 0, 1, 0, 0}, new float {0, 0, 0, 0.5f, 0}, new float {0, 0, 0, 0, 1} }; ColorMatrix colorMatrix = new ColorMatrix( matrixAlpha ); ImageAttributes iaAlphaBlend = new ImageAttributes(); iaAlphaBlend. SetColorMatrix( colorMatrix, ColorMatrixFlag.

Default, ColorAdjustType. Bitmap ).

Thanks Danbystrom, seems to be exactly what I was looking for. – David Rutten Nov 15 '09 at 23:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions