IconBitmapDecoder Konstruktoren

Definition

Initialisiert eine neue Instanz der IconBitmapDecoder-Klasse.

Überlädt

Name Beschreibung
IconBitmapDecoder(Stream, BitmapCreateOptions, BitmapCacheOption)

Initialisiert eine neue Instanz der IconBitmapDecoder Klasse aus dem angegebenen Dateidatenstrom mit dem angegebenen createOptions und cacheOption.

IconBitmapDecoder(Uri, BitmapCreateOptions, BitmapCacheOption)

Initialisiert eine neue Instanz der IconBitmapDecoder Klasse aus dem angegebenen , mit dem angegebenen UricreateOptions und cacheOption.

IconBitmapDecoder(Stream, BitmapCreateOptions, BitmapCacheOption)

Initialisiert eine neue Instanz der IconBitmapDecoder Klasse aus dem angegebenen Dateidatenstrom mit dem angegebenen createOptions und cacheOption.

public:
 IconBitmapDecoder(System::IO::Stream ^ bitmapStream, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
[System.Security.SecurityCritical]
public IconBitmapDecoder(System.IO.Stream bitmapStream, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
public IconBitmapDecoder(System.IO.Stream bitmapStream, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
[<System.Security.SecurityCritical>]
new System.Windows.Media.Imaging.IconBitmapDecoder : System.IO.Stream * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.IconBitmapDecoder
new System.Windows.Media.Imaging.IconBitmapDecoder : System.IO.Stream * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.IconBitmapDecoder
Public Sub New (bitmapStream As Stream, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption)

Parameter

bitmapStream
Stream

Der Bitmapdatenstrom, der decodiert werden soll.

createOptions
BitmapCreateOptions

Initialisierungsoptionen für das Bitmapbild.

cacheOption
BitmapCacheOption

Die Cachemethode, die für das Bitmapbild verwendet werden soll.

Attribute

Ausnahmen

Der wert bitmapStream ist null.

Dies bitmapStream ist kein symbolcodiertes Bild.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie sie eine Instanz eines Dateidatenstroms erstellen und verwenden GifBitmapDecoder .


// Open a Stream and decode a GIF image
Stream^ imageStreamSource = gcnew FileStream("tulipfarm.gif", FileMode::Open, FileAccess::Read, FileShare::Read);
GifBitmapDecoder^ decoder = gcnew GifBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapSource^ bitmapSource = decoder->Frames[0];

// Draw the Image
Image^ myImage = gcnew Image();
myImage->Source = bitmapSource;
myImage->Stretch = Stretch::None;
myImage->Margin = System::Windows::Thickness(20);

// Open a Stream and decode a GIF image
Stream imageStreamSource = new FileStream("tulipfarm.gif", FileMode.Open, FileAccess.Read, FileShare.Read);
GifBitmapDecoder decoder = new GifBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource = decoder.Frames[0];

// Draw the Image
Image myImage = new Image();
myImage.Source = bitmapSource;
myImage.Stretch = Stretch.None;
myImage.Margin = new Thickness(20);
' Open a Stream and decode a GIF image
Dim imageStreamSource As New FileStream("tulipfarm.gif", FileMode.Open, FileAccess.Read, FileShare.Read)
Dim decoder As New GifBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim bitmapSource As BitmapSource = decoder.Frames(0)

' Draw the Image
Dim myImage As New Image()
myImage.Source = bitmapSource
myImage.Stretch = Stretch.None
myImage.Margin = New Thickness(20)

Hinweise

Verwenden Sie die OnLoad Cacheoption, wenn Sie die bitmapStream Bitmap schließen möchten, nachdem die Bitmap erstellt wurde. Die Standardcacheoption OnDemand behält den Zugriff auf den Datenstrom bei, bis die Bitmap benötigt wird, und die Bereinigung wird vom Garbage Collector behandelt.

Gilt für:

IconBitmapDecoder(Uri, BitmapCreateOptions, BitmapCacheOption)

Initialisiert eine neue Instanz der IconBitmapDecoder Klasse aus dem angegebenen , mit dem angegebenen UricreateOptions und cacheOption.

public:
 IconBitmapDecoder(Uri ^ bitmapUri, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
[System.Security.SecurityCritical]
public IconBitmapDecoder(Uri bitmapUri, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
public IconBitmapDecoder(Uri bitmapUri, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
[<System.Security.SecurityCritical>]
new System.Windows.Media.Imaging.IconBitmapDecoder : Uri * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.IconBitmapDecoder
new System.Windows.Media.Imaging.IconBitmapDecoder : Uri * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.IconBitmapDecoder
Public Sub New (bitmapUri As Uri, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption)

Parameter

bitmapUri
Uri

Die Uri Bitmap, die decodiert werden soll.

createOptions
BitmapCreateOptions

Initialisierungsoptionen für das Bitmapbild.

cacheOption
BitmapCacheOption

Die Cachemethode, die für das Bitmapbild verwendet werden soll.

Attribute

Ausnahmen

Der wert bitmapUri ist null.

Dies bitmapUri ist kein symbolcodiertes Bild.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie sie eine Instanz von einer Instanz erstellen und eine GifBitmapDecoder aus einer .Uri


// Open a Uri and decode a GIF image
System::Uri^ myUri = gcnew System::Uri("tulipfarm.gif", UriKind::RelativeOrAbsolute);
GifBitmapDecoder^ decoder2 = gcnew GifBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapSource^ bitmapSource2 = decoder2->Frames[0];

// Draw the Image
Image^ myImage2 = gcnew Image();
myImage2->Source = bitmapSource2;
myImage2->Stretch = Stretch::None;
myImage2->Margin = System::Windows::Thickness(20);

// Open a Uri and decode a GIF image
Uri myUri = new Uri("tulipfarm.gif", UriKind.RelativeOrAbsolute);
GifBitmapDecoder decoder2 = new GifBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource2 = decoder2.Frames[0];

// Draw the Image
Image myImage2 = new Image();
myImage2.Source = bitmapSource2;
myImage2.Stretch = Stretch.None;
myImage2.Margin = new Thickness(20);
' Open a Uri and decode a GIF image
Dim myUri As New Uri("tulipfarm.gif", UriKind.RelativeOrAbsolute)
Dim decoder2 As New GifBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim bitmapSource2 As BitmapSource = decoder2.Frames(0)

' Draw the Image
Dim myImage2 As New Image()
myImage2.Source = bitmapSource2
myImage2.Stretch = Stretch.None
myImage2.Margin = New Thickness(20)

Gilt für: