PNG Image

G

Guest

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
 
J

jonfroehlich

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top