BitmapCacheOption Enum

Definitie

Hiermee geeft u op hoe een bitmapafbeelding gebruikmaakt van geheugencache.

public enum class BitmapCacheOption
public enum BitmapCacheOption
type BitmapCacheOption = 
Public Enum BitmapCacheOption
Overname
BitmapCacheOption

Velden

Name Waarde Description
Default 0

Slaat de volledige afbeelding in het geheugen op. Dit is de standaardwaarde.

OnDemand 0

Hiermee maakt u alleen een geheugenopslag voor aangevraagde gegevens. De eerste aanvraag laadt de installatiekopieën rechtstreeks; volgende aanvragen worden ingevuld vanuit de cache.

OnLoad 1

Slaat de volledige installatiekopieën tijdens de laadtijd in het geheugen op. Alle aanvragen voor afbeeldingsgegevens worden ingevuld vanuit het geheugenarchief.

None 2

Maak geen geheugenopslag. Alle aanvragen voor de installatiekopieën worden rechtstreeks ingevuld door het afbeeldingsbestand.

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u een bestand BitmapImage laadt en opgeeft 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)

Van toepassing op

Zie ook