BitmapImage.BeginInit Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Geeft het begin van de BitmapImage initialisatie aan.
public:
virtual void BeginInit();
public void BeginInit();
abstract member BeginInit : unit -> unit
override this.BeginInit : unit -> unit
Public Sub BeginInit ()
Implementeringen
Uitzonderingen
Het BitmapImage wordt momenteel geïnitialiseerd. BeginInit() is al gebeld.
– of –
De BitmapImage is al geïnitialiseerd.
Voorbeelden
In het volgende voorbeeld ziet u hoe u een BitmapImage met een set eigenschappen initialiseert met behulp van de BeginInit en EndInit methoden.
// 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)
Opmerkingen
Initialisatie van eigenschappen moet worden uitgevoerd tussen BeginInit en EndInit aanroepen. Zodra de BitmapImage eigenschap is geïnitialiseerd, worden eigenschapswijzigingen genegeerd.