CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    36

    Image class and Stream class

    I have an array of gray level bytes I want to show on screen. In order to do that I use Stream and Image classes like the following:

    Stream strm;
    Image img;
    Graphics grfx;
    strm.Write(pByteArray,0,nSize);
    img = Image.FromStream(strm);
    grfx.DrawImage(0,0,width,height);

    But I get an error saying:

    Use of unassigned local variable strm in the statement
    img = Image.FromStream(strm);

    What have I done wrong?

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    make use of MemoryStream instead and make an instance of it first and then use it.

    since Stream is an abstract class you can't make instance i.e. you can't do new of it.

    Paresh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured