Share via


BitmapCreateOptions Enumerazione

Definizione

Specifica le opzioni di inizializzazione per le immagini bitmap.

Questa enumerazione supporta una combinazione bit per bit dei rispettivi valori dei membri.

public enum class BitmapCreateOptions
[System.Flags]
public enum BitmapCreateOptions
[<System.Flags>]
type BitmapCreateOptions = 
Public Enum BitmapCreateOptions
Ereditarietà
BitmapCreateOptions
Attributi

Campi

DelayCreation 2

Fa sì che un oggetto BitmapSource ritardi l'inizializzazione fino a quando è necessario. Ciò è utile quando si gestiscono raccolte di immagini.

IgnoreColorProfile 4

Fa sì che una classe BitmapSource ignori un profilo colori incorporato.

IgnoreImageCache 8

Carica le immagini senza usare una cache di immagini esistente. Questa opzione deve essere selezionata solo quando le immagini in una cache devono essere aggiornate.

None 0

Non viene specificato alcun oggetto BitmapCreateOptions. Rappresenta il valore predefinito.

PreservePixelFormat 1

Assicura che la struttura PixelFormat in cui un file è archiviato corrisponda a quella in cui viene caricato.

Esempio

Nell'esempio seguente viene illustrato come creare un'istanza di e BitmapImage specificare un BitmapCreateOptions valore di enumerazione.

// Define a BitmapImage.
Image myImage = new Image();
BitmapImage bi = new BitmapImage();

// Begin initialization.
bi.BeginInit();

// Set properties.
bi.CacheOption = BitmapCacheOption.OnDemand;
bi.CreateOptions = BitmapCreateOptions.DelayCreation;
bi.DecodePixelHeight = 125;
bi.DecodePixelWidth = 125;
bi.Rotation = Rotation.Rotate90;
MessageBox.Show(bi.IsDownloading.ToString());
bi.UriSource = new Uri("smiley.png", UriKind.Relative);

// End initialization.
bi.EndInit();
myImage.Source = bi;
myImage.Stretch = Stretch.None;
myImage.Margin = new Thickness(5);
' Define a BitmapImage.
Dim myImage As New Image()
Dim bi As New BitmapImage()

' Begin initialization.
bi.BeginInit()

' Set properties.
bi.CacheOption = BitmapCacheOption.OnDemand
bi.CreateOptions = BitmapCreateOptions.DelayCreation
bi.DecodePixelHeight = 125
bi.DecodePixelWidth = 125
bi.Rotation = Rotation.Rotate90
MessageBox.Show(bi.IsDownloading.ToString())
bi.UriSource = New Uri("smiley.png", UriKind.Relative)

' End initialization.
bi.EndInit()
myImage.Source = bi
myImage.Stretch = Stretch.None
myImage.Margin = New Thickness(5)

Commenti

Se PreservePixelFormat non è impostato, l'immagine PixelFormat viene scelta dal sistema a seconda di ciò che il sistema determina restituirà le migliori prestazioni. L'abilitazione di questa opzione mantiene il formato di file, ma può comportare prestazioni inferiori.

Se IgnoreColorProfile è impostato, le chiamate a metodi come CopyPixels(Array, Int32, Int32) non restituiranno bit corretti dal colore.

Se IgnoreImageCache è impostato, le voci esistenti nella cache delle immagini vengono sostituite anche se condividono lo stesso Urioggetto .

Si applica a

Vedi anche