Back to Devexpress

DXImage.FromStream(Stream) Method

corelibraries-devexpress-dot-drawing-dot-dximage-dot-fromstream-x28-system-dot-io-dot-stream-x29.md

latest6.3 KB
Original Source

DXImage.FromStream(Stream) Method

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

Namespace : DevExpress.Drawing

Assembly : DevExpress.Drawing.v25.2.dll

NuGet Package : DevExpress.Drawing

Declaration

csharp
public static DXImage FromStream(
    Stream stream
)
vb
Public Shared Function FromStream(
    stream As Stream
) As DXImage

Parameters

NameTypeDescription
streamStream

A stream that contains data for the image.

|

Returns

TypeDescription
DXImage

The created image.

|

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.

winforms-chart-add-a-custom-legend-item/CS/CustomLegendItemSample/Form1.cs#L20

csharp
FileStream outfile = new FileStream("Image\\DXLogo_16x16.png", FileMode.Open);
DXImage image = DXImage.FromStream(outfile);
item.MarkerImage.DXImage = image;

winforms-chart-draw-a-custom-legend-marker-for-a-series-point/CS/CustomSeriesPointDrawingSample/Form1.cs#L105

csharp
if (!photoCache.ContainsKey(employee.FullName))
        photoCache.Add(employee.FullName, DXImage.FromStream(stream));
}

winforms-chart-draw-a-custom-legend-marker-for-a-series/CS/CustomDrawingSample/Form1.cs#L66

csharp
if (!photoCache.ContainsKey(employee.FullName))
        photoCache.Add(employee.FullName, DXImage.FromStream(stream));
}

winforms-chart-draw-a-custom-series-marker-in-the-crosshair/CS/CustomDrawCrosshairSample/Form1.cs#L59

csharp
if (!photoCache.ContainsKey(employee.FullName))
        photoCache.Add(employee.FullName, DXImage.FromStream(stream));
}

spreadsheet-document-api-execute-mail-merge-in-code/CS/EmployeeInfo/EmployeeInfo.cs#L58

csharp
if (value != null)
    Photo = DXImage.FromStream(new MemoryStream(value));
else

winforms-chart-accompany-chart-elements-by-text-or-image-annotations/VB/AnnotationsSample/Form1.vb#L28

vb
' Now, create an image annotation, and add it to the chart's collection.
chartControl1.Annotations.AddImageAnnotation("Annotation 2", DXImage.FromStream(New FileStream("...\...\image.png", FileMode.Open, FileAccess.Read, FileShare.Read)))
' Define the X and Y absolute coordinates for the annotation, in pixels.

winforms-chart-add-a-custom-legend-item/VB/CustomLegendItemSample/Form1.vb#L24

vb
Dim outfile As FileStream = New FileStream("Image\DXLogo_16x16.png", FileMode.Open)
Dim image As DXImage = DXImage.FromStream(outfile)
item.MarkerImage.DXImage = image

winforms-chart-draw-a-custom-legend-marker-for-a-series-point/VB/CustomSeriesPointDrawingSample/Form1.vb#L106

vb
Using stream As System.IO.MemoryStream = New System.IO.MemoryStream(employee.Photo)
    If Not Me.photoCache.ContainsKey(employee.FullName) Then Me.photoCache.Add(employee.FullName, DevExpress.Drawing.DXImage.FromStream(stream))
End Using

winforms-chart-draw-a-custom-legend-marker-for-a-series/VB/CustomDrawingSample/Form1.vb#L69

vb
Using stream As MemoryStream = New MemoryStream(employee.Photo)
    If Not photoCache.ContainsKey(employee.FullName) Then photoCache.Add(employee.FullName, DXImage.FromStream(stream))
End Using

winforms-chart-draw-a-custom-series-marker-in-the-crosshair/VB/CustomDrawCrosshairSample/Form1.vb#L63

vb
Using stream As MemoryStream = New MemoryStream(employee.Photo)
    If Not photoCache.ContainsKey(employee.FullName) Then photoCache.Add(employee.FullName, DXImage.FromStream(stream))
End Using

See Also

DXImage Class

DXImage Members

DevExpress.Drawing Namespace