ColorConvertedBitmap.BeginInit Method ()

 

Signals the start of the ColorConvertedBitmap initialization.

Namespace:   System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)

public void BeginInit()

Exception Condition
InvalidOperationException

The ColorConvertedBitmap is currently being initialized. BeginInit has already been called.

-or-

The ColorConvertedBitmap has already been initialized.

Property initialization must be done between BeginInit and EndInit calls. After the ColorConvertedBitmap has been initialized, property changes are ignored.

The following example demonstrates how to initialize a ColorConvertedBitmap with a set of properties by using the BeginInit and EndInit methods.

ColorConvertedBitmap myColorConvertedBitmap = new ColorConvertedBitmap();
myColorConvertedBitmap.BeginInit();
myColorConvertedBitmap.SourceColorContext = myBitmapSourceFrame2.ColorContexts[0];
myColorConvertedBitmap.Source = myBitmapSource2;
myColorConvertedBitmap.DestinationFormat = PixelFormats.Pbgra32;
myColorConvertedBitmap.DestinationColorContext = new ColorContext(PixelFormats.Bgra32);
myColorConvertedBitmap.EndInit();

.NET Framework
Available since 3.0
Return to top
Show: