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.

    The following code snippets (auto-collected from DevExpress Examples) contain references to the FromStream(Stream) method.

    Note

    The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

    See Also