?
Solved

Device context with diffrent color of pen object

Posted on 2003-02-24
3
Medium Priority
?
198 Views
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

memDC.CreateCompatibleDC(NULL);

 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.

Thanks.
0
Comment
Question by:mkashifkkj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
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:
    http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B139165

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

-- Dan
0
 

Author Comment

by:mkashifkkj
ID: 8027014
Its actually the same problem.
Thanks Dan.
0
 

Author Comment

by:mkashifkkj
ID: 8027019
Thanks Dan.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

764 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