Solved

CRichEditCtrl problem

Posted on 1998-07-24
3
224 Views
Last Modified: 2013-11-20
void CGText::DrawText(CDC *pDC)
{
      CRect rect, r;
      FORMATRANGE fr;
      rect = m_position;
      rect.NormalizeRect();
      r = rect;
      r.DeflateRect(1, 1);
      pDC->FillSolidRect(r, m_logbrush.lbColor);
      CPoint oldOrg = pDC->SetWindowOrg(rect.left, rect.top);
// 30 - the magic number
      rect.top = (rect.top + 1) * 30;
      rect.left = (rect.left + 1) * 30;
      rect.bottom = (m_position.Height() - 3) * 15 + rect.top;
      rect.right = (m_position.Width() - 3) * 15 + rect.left;

      fr.hdc = pDC->m_hDC;
      fr.hdcTarget = pDC->m_hDC;
      fr.rc = rect;
      fr.rcPage = rect;
      fr.chrg.cpMin = 0;
      fr.chrg.cpMax = -1;
      
      m_pHyper->FormatRange(&fr);
      pDC->SetWindowOrg(oldOrg);
}
 I am trying to display CRichEditCtrl in my view class.
The function above is member of class that represent the text in the document. The "magic number" 30 is realy magic, if I change it text will not move correctly on screen. Online help says that rect shoud be in TWIPS, but I can't convert it. pDC have MM_ANISOTROPIC. Please help.

Windows NT 4.0 Workstation; Visual C++ 5.0
0
Comment
Question by:cyrilbdt
  • 2
3 Comments
 
LVL 2

Author Comment

by:cyrilbdt
ID: 1319695
Edited text of question
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 400 total points
ID: 1319696
There are 1440 twips to a logical inch. You can also use CDC::DPtoLP to convert your device points in to logical points, then do a little math to convert logical points into twips.


0
 
LVL 2

Author Comment

by:cyrilbdt
ID: 1319697
m_position is in logical coordinates and DPtoLP will not work
(I tried it)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Named range not carried over 10 63
Doc'in system (example?) BA 7 109
noX challenge 17 115
Problem to event 3 94
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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 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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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