Solved

Printing contents of a CRichtEditCtrl looses part of characters

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 124
Question regarding Copy/Paste 16 96
fix34  challenge 9 120
how to split multiple lines delimiter : 8 99
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

777 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