all groups > dotnet compact framework > august 2006 >
You're in the

dotnet compact framework

group:

PNG Image


PNG Image Bryan
8/21/2006 8:11:02 AM
dotnet compact framework:
I am still having no luck with displaying a PNG file. I've now tried both
the AlphaBlend() funcation and the Imaging API that is new to CE 5.0.
Neither of these options are working. I've download a sample from the
internet and that doesn't work either. This makes me think that there is
something missing in my CE image, but I have no idea what it is. Has anyone
else had any luck with displaying a PNG file that has transparency? Here is
a link to the example I was using:

http://blogs.msdn.com/chrislorton/archive/2006/04/07/570649.aspx

[quoted text, click to view]
Re: PNG Image jonfroehlich
8/21/2006 2:27:33 PM
Hi Bryan,

I would use SDF from OpenNetCf.org--it makes alpha blending operations
and displaying PNG images much easier. Plus, it's free to use!

With SDF, you'd do something like this:
//initialization somewhere
private IImage _img;
new ImagingFactory().CreateImageFromFile(imagePath, out _img);

//DrawImage is called by OnPaint...
protected override void DrawImage(Graphics g, int xImage, int yImage){
IntPtr hDC = g.GetHdc();
RECT rc = RECT.FromXYWH(xImage, yImage, ImageWidth, ImageHeight);
_img.Draw(hDC, rc, null);
g.ReleaseHdc(hDC);
}

Good luck. For more info see:
http://csharponphone.blogspot.com/2006/05/alpha-blending.html

Cheers,

j

[quoted text, click to view]
AddThis Social Bookmark Button