Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Device context with diffrent color of pen object

Posted on 2003-02-24
Medium Priority
Last Modified: 2010-04-01
I am drawing some figures and storing these figures as bmp file. All of this drawing is
done on a window that is not shown to the user.
This is done by using


 bitmap.CreateCompatibleBitmap(&memDC, 600,400);

Now this memDC is used for drawing diffrent figures.

as memDC.Rectangle(---);

I use diffrent color of Pens  to draw figures.

It works fine in normal case but in mine case when diffrent colors of pens are selected
only black color is displayed for all figures.

Help me so that using

memDC i can create figures generated by diffrent color of pens.

I hope this has clarified you.

Question by:mkashifkkj
  • 2
LVL 49

Accepted Solution

DanRollins earned 400 total points
ID: 8011902
Memory DCs default to a monochrome bitmap.  From MSDN:

"If pDC is a memory device context, the bitmap returned has the same format as the currently selected bitmap in that device context."

The problem and the soliton are discussed here:

If that is not the problem, then the code you are using to select the brush or pen is probably wrong.  Show it.

-- Dan

Author Comment

ID: 8027014
Its actually the same problem.
Thanks Dan.

Author Comment

ID: 8027019
Thanks Dan.

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

571 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