Solved

CRichEditCtrl problem

Posted on 1998-07-24
3
235 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
[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
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

623 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