?
Solved

print preview doesn't work !!!

Posted on 1998-02-20
2
Medium Priority
?
227 Views
Last Modified: 2013-11-20
I have implemented a print preview in my mdi-application. When the print preview is called the following OnDraw-function will be executed:

void CMyView::OnDraw(CDC* pDC)
{
  CString text=_T("This is a test");
  pDC->SetTextColor(RGB(255,0,0)); // or any other color
  pDC->SetBkColor(::GetSysColor(COLOR_WINDOW));
  GetClientRect(rect);
  pDC->DrawText(text,-1,rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}

There is now a problem:
In print preview the text color will not be displayed !!!
The text string will always painted in black !!!

How can I change the color to that I want to have in print preview ?
I can debug the above code and the text color is the one I wanted to have but the screen shows always a black text !!!

Any ideas about that ?
0
Comment
Question by:atari
[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 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 120 total points
ID: 1316451
When you display your document in print preview you are dealing with two device contexts. First is printer device context the secont is window DC. two members m_hDC and m_hAttribDC in MFC CDC class define these DCs. In spite of the fact you actually draw on preview window DC it has the same properties as printer DC. Since you are likely to be printing on b/w printer print preview window DC also uses only black and white.
0
 
LVL 1

Author Comment

by:atari
ID: 1316452
Thank you, I will try it with a color printer and then I hope that the print preview shows my text in color.

Cannot try it at once, so I will graduade you before.

Bye,
atari
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

719 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