LateBoundBitmapDecoder.Frames 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取位图中单个帧的内容。
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)
属性值
BitmapFrame的实例。 此属性没有默认值。
示例
以下示例演示如何使用 BitmapFrame a.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)
注解
由于异步下载 a LateBoundBitmapDecoder ,因此在下载和解码内容后,基础集合 Frames 可能会更改。 下载内容时,集合始终至少返回一个项目。 下载和解码完成后,会自动 BitmapFrame 更改其基础内容。 换句话说,只有集合对象才能更改;实际帧对象保持不变。
从图像 LateBoundBitmapDecoder 下载期间获取的任何帧都将返回宽度/高度, 1,1 直到帧完成下载。
只有标记的图像文件格式(TIFF)和图形交换格式(GIF)图像支持多个帧。
此属性返回的任何 BitmapFrame 对象都已冻结。