BitmapImage.BeginInit Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Signale le début de l’initialisation BitmapImage .
public:
virtual void BeginInit();
public void BeginInit();
abstract member BeginInit : unit -> unit
override this.BeginInit : unit -> unit
Public Sub BeginInit ()
Implémente
Exceptions
Il BitmapImage est actuellement initialisé. BeginInit() a déjà été appelé.
- ou -
L’initialisation BitmapImage a déjà été effectuée.
Exemples
L’exemple suivant montre comment initialiser un BitmapImage ensemble de propriétés à l’aide des méthodes et BeginInit des EndInit méthodes.
// 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)
Remarques
L’initialisation des propriétés doit être effectuée entre BeginInit et EndInit appels. Une fois l’initialisation BitmapImage effectuée, les modifications de propriété sont ignorées.