Solved

How do I use CachedBitmap in C#

Posted on 2004-04-13
3
1,482 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:mnasman
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now