Solved

CRichEditCtrl problem

Posted on 1998-07-24
3
227 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

820 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