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

Nome Valore Descrizione
None 0

Non viene specificato alcun BitmapCreateOptions valore. Questo è il valore predefinito.

PreservePixelFormat 1

Assicura che un PixelFormat file sia archiviato in è uguale a quello in cui viene caricato.

DelayCreation 2

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

IgnoreColorProfile 4

Fa sì che un oggetto BitmapSource ignori un profilo colore incorporato.

IgnoreImageCache 8

Carica immagini senza usare una cache di immagini esistente. Questa opzione deve essere selezionata solo quando è necessario aggiornare le immagini in una cache.

Esempio

Nell'esempio seguente viene illustrato come creare un'istanza BitmapImage di e 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'oggetto PixelFormat dell'immagine viene scelto dal sistema a seconda di ciò che il sistema determina restituirà le migliori prestazioni. L'abilitazione di questa opzione mantiene il formato del file, ma può comportare prestazioni inferiori.

Se IgnoreColorProfile è impostato, le chiamate a metodi come CopyPixels(Array, Int32, Int32) ad esempio non restituiscono bit con correzione del colore.

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

Si applica a

Vedi anche