本文整理汇总了C++中CDCHandle::DPtoLP方法的典型用法代码示例。如果您正苦于以下问题:C++ CDCHandle::DPtoLP方法的具体用法?C++ CDCHandle::DPtoLP怎么用?C++ CDCHandle::DPtoLP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDCHandle
的用法示例。
在下文中一共展示了CDCHandle::DPtoLP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrepareDC
void CNCaptureView::PrepareDC(CDCHandle dc)
{
ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0);
dc.SetMapMode(MM_ANISOTROPIC);
dc.SetWindowExt(m_sizeLogAll);
dc.SetViewportExt(m_sizeAll);
dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y);
if (m_pImage)
{
CRect rcPaintAll(CPoint(0), m_sizeAll); //device unit
if (m_sizeClient.cx > m_sizeAll.cx)
{
rcPaintAll.right = m_sizeClient.cx;
}
if (m_sizeClient.cy > m_sizeAll.cy)
{
rcPaintAll.bottom = m_sizeClient.cy;
}
dc.DPtoLP((LPPOINT)(&rcPaintAll), 2); //change to logical
CRect rcImage(0, 0, m_pImage->GetWidth(), m_pImage->GetHeight());
m_rcDrawTarget = _GetPhotoRect(rcPaintAll, &(rcImage.Size()));
}
dc.SetWindowOrg(-m_rcDrawTarget.left, -m_rcDrawTarget.top);
}
示例2: DoPaint
void CNCaptureView::DoPaint(CDCHandle dc)
{
FUNCTION_BLOCK_TRACE(20);
if ( m_bIsDrawing )
{
return;
}
m_bIsDrawing = TRUE;
BOOL bRet = FALSE;
CRect rcClientLogical;
GetClientRect(rcClientLogical);
dc.DPtoLP(rcClientLogical);
rcClientLogical.InflateRect(4, 4); //fix scroll brush display error
//CRect rcClient;
//GetClientRect(&rcClient);
//CWindowDC WndDc(m_hWnd);
//WndDc.FillRect(&rcClient, m_brBackground);
{
//make sure MemDC bitblt
//CMemoryDC memDC(dc.m_hDC, rcClient);
CZoomScrollMemDC memDC (dc.m_hDC, rcClientLogical);
PrepareDC(memDC.m_hDC);
memDC.SetBrushOrg( -m_ptOffset.x , -m_ptOffset.y);
//API_VERIFY(memDC.FillRect(&rcClip, m_brBackground));
//API_VERIFY(memDC.FillRect(&rcClientLogical, m_brBackground));
memDC.FillSolidRect(&rcClientLogical, NCAPTUREVIEW_BACKGROUND_CLR);
if (m_pImage)
{
CRect rcImage(0, 0, m_pImage->GetWidth(), m_pImage->GetHeight());
if (m_canvasImage.IsCanvasChanged(rcImage) || m_bImageChanged)
{
m_canvasImage.Release();
API_VERIFY(m_canvasImage.Create(m_hWnd, rcImage.Width(), rcImage.Height()));
m_bImageChanged = FALSE;
//API_VERIFY(m_pImage->Draw(m_canvasImage, rcImage));
}
API_VERIFY(m_pImage->Draw(m_canvasImage, rcImage));
DrawObjects(m_canvasImage.GetMemoryDC());
{
//When Capture image size multiply by zoom bigger than 32767, GDI CAN NOT display the image
memDC.SetStretchBltMode(HALFTONE); //HALFTONE);
bRet = memDC.BitBlt(
0, 0, //rcClientLogical.left, rcClientLogical.top
rcImage.Width(), rcImage.Height(),// rcClientLogical.Width(), rcClientLogical.Height(),
m_canvasImage.GetMemoryDC(),
0, 0, //rcClientLogical.left, rcClientLogical.top,
SRCCOPY);
if(!bRet)
{
FTLTRACE(TEXT("%s StretchBlt Failed, LastError=%d\n"), __FILE__LINE__, ::GetLastError());
}
}
DrawTextObject(memDC.m_hDC);
{
CFMMTextDCGuard mmTextDCGuard(memDC);
if (!m_pImage && m_pDefaultImage)
{
//no image ,just draw default image
CRect rcClientDevice;
GetClientRect(&rcClientDevice);
CSize szDefaultImage(m_pDefaultImage->GetWidth(), m_pDefaultImage->GetHeight());
CRect rcDefaultImageTarget = m_pCalcRect->GetPhotoRect(rcClientDevice, &szDefaultImage, 1.0f, FALSE, FALSE);
NDGraphics::DrawGdiplusImage(memDC, m_pDefaultImage, rcDefaultImageTarget.left, rcDefaultImageTarget.top,
rcDefaultImageTarget.Width(), rcDefaultImageTarget.Height());
}
DrawObjectsTracker(memDC.m_hDC);
}
}
}
//FTLTRACE(TEXT("DoPaint, m_rcDrawTarget=[%d,%d]x[%d,%d]\n"), m_rcDrawTarget.left, m_rcDrawTarget.top,
// m_rcDrawTarget.right, m_rcDrawTarget.bottom);
//CClientDC clientDC(m_hWnd);
m_bIsDrawing = FALSE;
}