Solved

print preview doesn't work !!!

Posted on 1998-02-20
2
218 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
2 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 30 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

16 Experts available now in Live!

Get 1:1 Help Now