I have an array of gray level bytes I want to show on screen. In order to do that I use MemoryStream and the Image class:
private void CellView_Paint(object sender, System.Windows.Forms.PaintEventArgas e)
{
MemoryStream strm = new MemoryStream();
Image img;
Graphics grfx;
Graphics grfx = e.Graphics;
// Panel was created further up in the program
// what is shown here is a small part of the whole program
grfx = panel.CreateGraphics();
strm.Position = 0; strm.Write(pByteArray,0,nSize);
Stream st = (Stream)strm;
img = Image.FromStream(st); grfx.DrawImage(img,0,0,width,height);
strm.Close;
}

But the program gives the same error message as before:

Invalid parameter used in the statement below:
img = Image.FromStream(strm);

It seems as if



Report this post to a moderator | IP: Logged
01-28-2003 10:48 AM