Solved

How do I use CachedBitmap in C#

Posted on 2004-04-13
3
1,507 Views
Last Modified: 2012-06-22
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
Comment
Question by:josamoto
  • 2
3 Comments
 
LVL 4

Expert Comment

by:caner_elci
ID: 10818608
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
 
LVL 4

Accepted Solution

by:
caner_elci earned 125 total points
ID: 10818647
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
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 10818992
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question