Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
CachedBitmap Class
 CachedBitmap Constructor
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
CachedBitmap Constructor

Initializes a new instance of CachedBitmap that has the specified source, bitmap create options, and bitmap cache option.

Namespace:  System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)
Visual Basic (Declaration)
Public Sub New ( _
    source As BitmapSource, _
    createOptions As BitmapCreateOptions, _
    cacheOption As BitmapCacheOption _
)
Visual Basic (Usage)
Dim source As BitmapSource
Dim createOptions As BitmapCreateOptions
Dim cacheOption As BitmapCacheOption

Dim instance As New CachedBitmap(source, _
    createOptions, cacheOption)
C#
public CachedBitmap(
    BitmapSource source,
    BitmapCreateOptions createOptions,
    BitmapCacheOption cacheOption
)
Visual C++
public:
CachedBitmap(
    BitmapSource^ source, 
    BitmapCreateOptions createOptions, 
    BitmapCacheOption cacheOption
)
JScript
public function CachedBitmap(
    source : BitmapSource, 
    createOptions : BitmapCreateOptions, 
    cacheOption : BitmapCacheOption
)
XAML
You cannot use constructors in XAML.

Parameters

source
Type: System.Windows.Media.Imaging..::.BitmapSource
The source bitmap that is being cached.
createOptions
Type: System.Windows.Media.Imaging..::.BitmapCreateOptions
Initialization options for the bitmap image.
cacheOption
Type: System.Windows.Media.Imaging..::.BitmapCacheOption
Specifies how the bitmap is cached to memory.
ExceptionCondition
ArgumentNullException

Occurs when source is nullNothingnullptra null reference (Nothing in Visual Basic).

The following code example shows how to create and use a CachedBitmap in code.

Visual Basic
Dim cachedSource As New CachedBitmap(scaledSource, BitmapCreateOptions.None, BitmapCacheOption.OnLoad)
' Create a new BitmapSource using a different format than the original one.
Dim newFormatSource As New FormatConvertedBitmap()
newFormatSource.BeginInit()
newFormatSource.Source = cachedSource
newFormatSource.DestinationFormat = PixelFormats.Gray32Float
newFormatSource.EndInit()
C#
CachedBitmap cachedSource = new CachedBitmap(
    scaledSource, 
    BitmapCreateOptions.None,
    BitmapCacheOption.OnLoad);


// Create a new BitmapSource using a different format than the original one.
FormatConvertedBitmap newFormatSource = new FormatConvertedBitmap();
newFormatSource.BeginInit();
newFormatSource.Source = cachedSource;
newFormatSource.DestinationFormat = PixelFormats.Gray32Float;
newFormatSource.EndInit();

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker