語言

TransformedBitmap.BeginInit 方法

定義

表示初始化開始 TransformedBitmap 。

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

實作

例外狀況

TransformedBitmap目前正在初始化中。 BeginInit() 已經被叫去了。

-或-

該系統 TransformedBitmap 已經初始化。

範例

以下範例示範如何利用 TransformedBitmap and BeginInit 方法初始EndInit化一組屬性。

// 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()

備註

屬性初始化必須在 和 BeginInit 呼叫之間EndInit進行。 一旦 TransformedBitmap 初始化,屬性變更就會被忽略。

適用於

另請參閱