Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

print preview doesn't work !!!

Posted on 1998-02-20
2
Medium Priority
?
229 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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

926 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