ColorConvertedBitmap.EndInit Method ()

 

Signals the end of the ColorConvertedBitmap initialization.

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

[SecurityCriticalAttribute]
public void EndInit()

Exception Condition
InvalidOperationException

The Source, SourceColorContext, or DestinationColorContext property is null.

-or-

The EndInit method is called without first calling BeginInit.

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

The following example shows how to use the EndInit method in order to change the properties of a ColorConvertedBitmap.

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: