Editar

Compartilhar via


BitmapEncoder.Frames Property

Definition

Gets or sets the individual frames within an image.

public:
 virtual property System::Collections::Generic::IList<System::Windows::Media::Imaging::BitmapFrame ^> ^ Frames { System::Collections::Generic::IList<System::Windows::Media::Imaging::BitmapFrame ^> ^ get(); void set(System::Collections::Generic::IList<System::Windows::Media::Imaging::BitmapFrame ^> ^ value); };
public virtual System.Collections.Generic.IList<System.Windows.Media.Imaging.BitmapFrame> Frames { get; set; }
member this.Frames : System.Collections.Generic.IList<System.Windows.Media.Imaging.BitmapFrame> with get, set
Public Overridable Property Frames As IList(Of BitmapFrame)

Property Value

A collection of BitmapFrame objects within the image.

Exceptions

The BitmapFrame value that is passed to the encoder is null.

Examples

The following example shows how to add a frame to an encoder.

FileStream stream = new FileStream("empty.tif", FileMode.Create);
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
encoder.Frames.Add(BitmapFrame.Create(image));
MessageBox.Show(myPalette.Colors.Count.ToString());
encoder.Save(stream);
Dim stream As New FileStream("empty.tif", FileMode.Create)
Dim encoder As New TiffBitmapEncoder()
Dim myTextBlock As New TextBlock()
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString()
encoder.Frames.Add(BitmapFrame.Create(image))
MessageBox.Show(myPalette.Colors.Count.ToString())
encoder.Save(stream)

Remarks

Only Tagged Image File Format (TIFF), Graphics Interchange Format (GIF), and Microsoft Windows Media Photo images support more than one frame. Attempts to add additional frames to formats that do not support them will result in only the first frame being encoded.

XAML Text Usage

You cannot use this property in Extensible Application Markup Language (XAML).

Applies to

See also