Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1668
  • Last Modified:

How do I use CachedBitmap in C#

I'm fairly new to the Visual Studio .NET environment. I'm pretty much still used to Visual C++ 6.0. However, I'm trying to develop a small Windows Control Class that simply paints a bitmap on the control. My problem is using the CachedBitmap class. Whenever I instantiate a CachedBitmap variable, I get a message in my Task List saying : "The type or namespace name 'CachedBitmap' could not be found...

Obviously I need to import the appropriate libraries. in VC++ I would use the #include directive. It seems I need to use the Using directive for C#, but I don't seem to get this right.

All I want to know is what I need to do to be able to use the CachedBitmap class in my C# solution.

Kind regards
Josamoto
0
josamoto
Asked:
josamoto
  • 2
1 Solution
 
caner_elciCommented:
CachedBitmap is a GDI+ class which is not wrapped in .NET's System.Drawing.. You don't need to use it anyway, try Bitmap instead...
0
 
caner_elciCommented:
If you need information about System.Drawing.Bitmap, you can use the following constructor:

public Bitmap(
   int width,
   int height,
   PixelFormat format
);

and you can use Format32bppPArgb as PixelFormat for your needs.. Just like:

Bitmap myBitmap = new Bitmap( 800, 600, PixelFormat.Format32bppPArgb );

then you can get a Graphics for this bitmap:

Graphics g = Graphics.FromImage( myBitmap );

now, anything you draw on g will be drawn on myBitmap..
0
 
Mohammed NasmanSoftware DeveloperCommented:
Hi

Read this
=============
Fred_MS:
Q: rkp123 : CachedBitmap? Anybody?

Fred_MS:
A: We don't have a CachedBitmap. However, if you render to the Form (within OnPaint()) we will automatically render to a cached bitmap then bitblt forward.

http://msdn.microsoft.com/chats/vstudio/vstudio_090302.asp
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now