TransformedBitmap.BeginInit Método

Definição

Sinaliza o início da inicialização TransformedBitmap.

public:
 virtual void BeginInit();
public void BeginInit ();
abstract member BeginInit : unit -> unit
override this.BeginInit : unit -> unit
Public Sub BeginInit ()

Implementações

Exceções

O TransformedBitmap está sendo inicializado no momento. O BeginInit() já foi chamado.

- ou - O TransformedBitmap já foi inicializado.

Exemplos

O exemplo a seguir demonstra como inicializar um TransformedBitmap com um conjunto de propriedades usando os métodos e EndInit os BeginInit métodos.

// Create the new BitmapSource that will be used to scale the size of the source.
TransformedBitmap myRotatedBitmapSource = new TransformedBitmap();

// BitmapSource objects like TransformedBitmap can only have their properties
// changed within a BeginInit/EndInit block.
myRotatedBitmapSource.BeginInit();

// Use the BitmapSource object defined above as the source for this BitmapSource.
// This creates a "chain" of BitmapSource objects which essentially inherit from each other.
myRotatedBitmapSource.Source = myBitmapImage;

// Flip the source 90 degrees.
myRotatedBitmapSource.Transform = new RotateTransform(90);
myRotatedBitmapSource.EndInit();
' Create the new BitmapSource that will be used to scale the size of the source.
Dim myRotatedBitmapSource As New TransformedBitmap()

' BitmapSource objects like TransformedBitmap can only have their properties
' changed within a BeginInit/EndInit block.
myRotatedBitmapSource.BeginInit()

' Use the BitmapSource object defined above as the source for this BitmapSource.
' This creates a "chain" of BitmapSource objects which essentially inherit from each other.
myRotatedBitmapSource.Source = myBitmapImage

' Flip the source 90 degrees.
myRotatedBitmapSource.Transform = New RotateTransform(90)
myRotatedBitmapSource.EndInit()

Comentários

A inicialização da propriedade deve ser feita entre chamadas e EndInit entre BeginInit elas. Depois que a TransformedBitmap inicialização for inicializada, as alterações de propriedade serão ignoradas.

Aplica-se a

Confira também