BitmapImage.EndInit 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 la fin de l’initialisation BitmapImage .
public:
virtual void EndInit();
public void EndInit();
abstract member EndInit : unit -> unit
override this.EndInit : unit -> unit
Public Sub EndInit ()
Implémente
Exceptions
Les UriSource propriétés ou StreamSource les propriétés sont null.
- ou -
La EndInit() méthode est appelée sans appel d’abord BeginInit().
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.