Solved

How do I use CachedBitmap in C#

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Connecting database in Xamarin? 6 54
This code tracks birthdays 3 61
Connection String 16 43
use of unassigned local variable 'id' 6 32
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

30 Experts available now in Live!

Get 1:1 Help Now