Solved

Printing contents of a CRichtEditCtrl looses part of characters

Posted on 2003-11-24
5
202 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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: 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…
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

24 Experts available now in Live!

Get 1:1 Help Now