Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LPtoDP function is not working 1

Status
Not open for further replies.

nohairleft

Programmer
Feb 2, 2005
3
US
I am running Visual C++ 6.0 MFC Document/View. MyCView class's OnDraw(pDC) function calls a myCDocument function pDoc->DisplayMyStuff(pDC) which defines a CRect called WaferRect and calls a function called DisplayMapSetup(pDC, WaferRect). The code snippet is shown below.

void CWaferMapDoc::DisplayMapSetup(CDC* pDC, CRect WaferRect)
{
pDC->LPtoDP(&WaferRect);

int height = WaferRect.Height();

I have also tried this as pDC->LPtoDP(WaferRect) and with various mapping modes, but all I ever get are the logical units when I want the pixels. It's as though the LPtoDP() function is just a NULL function. Can anyone see what I am missing to get the LPtoDP() function to work properly and convert my units from logical to pixals.

 
Did you set your map mode?

For example:

Code:
  pDC->SetMapMode(MM_LOENGLISH);
  // Then do the conversion
  pDC->LPtoDP(WaferRect);

I believe LptoDP() takes a RECT argument and not a RECT*.

HyperEngineer
If it ain't broke, it probably needs improvement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top