Hello,
Im using the same DB used in northwindoledb example, i need a similar app but in C#, not C++, so i use this DB and make a form for Pocket PC 2003 SE Emulator in Vista (device application) with visual studio 2005, i use a function to recover the image and display in a PictureBox but when this image create a BitMap give me an error "Value does not fall within the expected range.", i seek a lot in internet and don't find a solution, the function is:
public static Image Bytes2Image(byte[] bytes)
{
if (bytes == null) return null;
MemoryStream ms = new MemoryStream(bytes,0,bytes.Length );
Bitmap bm = null;
ms.Read(bytes, 0, bytes.Length);
bm = new Bitmap(ms);
return bm;
}
If someone can help me i will appreciatte
How about:
Code Snippet
public System.Drawing.Image BytesToImage(byte[] bytes)
{
if (bytes == null) return null;
System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);
return System.Drawing.Image.FromStream(ms);
}
|||Erik,
System.Drawing.Image.FromStream(ms);
Don't exist in Compact Framework, all post suggest the use of new Bitmap(ms) instead, but this code give the error... Other user have similar error but cannot find the solution, the C++ version of the program work ok in the emulator, but in C# don't work (i'm using different aproach, i don't understand C++), some have a similar program in C# than manipulate images from SQL 2005 CE for Pocket PC?
No comments:
Post a Comment