Solved

Printing contents of a CRichtEditCtrl looses part of characters

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 145
Hibernate methods 2 77
ffmpeg - "rtsp://...... Operation not permitted" 4 86
Annoying "thing" blocks my view 4 114
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

808 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