BitmapCacheOption Enumerazione

Definizione

Specifica il modo in cui un'immagine bitmap sfrutta la memorizzazione nella cache della memoria.

public enum class BitmapCacheOption
public enum BitmapCacheOption
type BitmapCacheOption = 
Public Enum BitmapCacheOption
Ereditarietà
BitmapCacheOption

Campi

Nome Valore Descrizione
Default 0

Memorizza l'intera immagine nella memoria. Questo è il valore predefinito.

OnDemand 0

Crea un archivio di memoria solo per i dati richiesti. La prima richiesta carica direttamente l'immagine; le richieste successive vengono riempite dalla cache.

OnLoad 1

Memorizza l'intera immagine nella memoria in fase di caricamento. Tutte le richieste di dati di immagine vengono riempite dall'archivio di memoria.

None 2

Non creare un archivio memoria. Tutte le richieste per l'immagine vengono compilate direttamente dal file di immagine.

Esempio

Nell'esempio di codice seguente viene illustrato come caricare un BitmapImage oggetto e specificare .BitmapCacheOption

// 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)

Si applica a

Vedi anche