Share via


LateBoundBitmapDecoder.Frames 屬性

定義

取得點陣圖內個別畫面格的內容。

public:
 virtual property System::Collections::ObjectModel::ReadOnlyCollection<System::Windows::Media::Imaging::BitmapFrame ^> ^ Frames { System::Collections::ObjectModel::ReadOnlyCollection<System::Windows::Media::Imaging::BitmapFrame ^> ^ get(); };
public override System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Media.Imaging.BitmapFrame> Frames { get; }
member this.Frames : System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Media.Imaging.BitmapFrame>
Public Overrides ReadOnly Property Frames As ReadOnlyCollection(Of BitmapFrame)

屬性值

ReadOnlyCollection<BitmapFrame>

BitmapFrame 的執行個體。 此屬性沒有預設值。

範例

下列範例示範如何使用 BitmapFrame 做為 BitmapSource


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

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

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

備註

LateBoundBitmapDecoder因為 會以非同步方式下載 ,所以在下載和解碼內容之後,基礎集合 Frames 可能會變更。 下載內容時,集合一律會傳回至少一個專案。 下載和解碼完成時,會自動 BitmapFrame 變更其基礎內容。 換句話說,只有集合物件可以變更;實際的框架物件保持不變。

從 下載影像時取得 LateBoundBitmapDecoder 的任何框架都會傳回寬度/高度 1,1 ,直到畫面完成下載為止。

只有標記的影像檔案格式 (TIFF) 和圖形交換格式 (GIF) 影像支援多個畫面。

此屬性傳回的任何 BitmapFrame 物件都是凍結的。

適用於

另請參閱