Skip to main content
All docs
V26.1
  • DXImage.FromStream(Stream) Method

    Creates an image from the specified stream that contains the image data.

    Namespace: DevExpress.Drawing

    Assembly: DevExpress.Drawing.v26.1.dll

    NuGet Package: DevExpress.Drawing

    Declaration

    public static DXImage FromStream(
        Stream stream
    )

    Parameters

    Name Type Description
    stream Stream

    A stream that contains data for the image.

    Returns

    Type Description
    DXImage

    The created image.

    Remarks

    The following code examples create an image object from source:

    • To use an image locally:

      using (FileStream source = new FileStream(sourceFile, FileMode.Open))
      {
          using (DXImage image = DXImage.FromStream(source))
          {
              // USE AN IMAGE HERE
          }
      }
      
    • To use the image globally, you do not have to dispose of either the stream or the image:

      DXImage image = DXImage.FromStream(new FileStream(sourceFile, FileMode.Open));
      

      Important

      Do not confuse the DXImage class with the DXImage component.

    See Also