Solved

Printing contents of a CRichtEditCtrl looses part of characters

Posted on 2003-11-24
5
205 Views
Last Modified: 2013-11-20
I have a CRichEditCtrl which contents I like to print. I am using PrintClient on a printer dc. However, sometimes characters are printed only partly (the right part is cut off). The characters cut off are or on the end of a line (but not on all lines) or after a tab character (also not after every tab).
What is causing this strange behaviour?
0
Comment
Question by:ble
[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
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 250 total points
ID: 9809508
Use FormatRange

eg:
                                FORMATRANGE fr;
            fr.hdc = dc;
            fr.hdcTarget = dc;
            fr.rc = CRect((rect.Width( ) / 2), (_border / 2) ,m_size.cx*15, m_size.cy*15);
            fr.rcPage = CRect(0,0,0,0);
            fr.chrg.cpMin = 0;
            fr.chrg.cpMax = -1;
            
            _richCtrl->FormatRange( &fr );


And print the content of fr.hdc

Good Luck
0
 

Author Comment

by:ble
ID: 9809520
Is it a problem with the FormatRange? Can this cause some part of a character after a tab to be lost?
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9809564
PrintClient is the member function of CWnd, so It may not gave the correct format. Format range is implemented in RICHEDT itself, so this will work.
0
 

Author Comment

by:ble
ID: 9809714
In your example you are using rect, _border and m_size. What are these variables?
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9809729
Just use the GetClientRect of RichEdit. Thatz just a sample code from the MSDN
Rosh :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 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