本文整理汇总了C++中CDC::DPtoHIMETRIC方法的典型用法代码示例。如果您正苦于以下问题:C++ CDC::DPtoHIMETRIC方法的具体用法?C++ CDC::DPtoHIMETRIC怎么用?C++ CDC::DPtoHIMETRIC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDC
的用法示例。
在下文中一共展示了CDC::DPtoHIMETRIC方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEditCopy
void CGelView::OnEditCopy()
{
if ( !OpenClipboard() ) {
AfxMessageBox("Cannot Open Clipboard", MB_OK | MB_ICONEXCLAMATION);
return;
}
if ( !EmptyClipboard() ) {
AfxMessageBox("Cannot Empty Clipboard", MB_OK | MB_ICONEXCLAMATION);
return;
}
CGenedocDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CMetaFileDC dcMeta;
dcMeta.Create();
CDC* pDC = GetDC();
double ypi = pDC->GetDeviceCaps(LOGPIXELSY);
double xpi = pDC->GetDeviceCaps(LOGPIXELSX);
int x = (int)((double)GetGelSize().cx/100.0 * xpi);
int y = (int)((double)GetGelSize().cy/100.0 * ypi);
CSize tSize(x,y);
pDC->DPtoHIMETRIC(&tSize);
dcMeta.SetAttribDC( pDC->m_hAttribDC );
OnPrepareDC( &dcMeta );
DrawGel( &dcMeta, CRect( 0, 0, tSize.cx, tSize.cy ) );
HGLOBAL hMF = GlobalAlloc( GMEM_DDESHARE | GMEM_ZEROINIT | GMEM_MOVEABLE , sizeof(METAFILEPICT) );
METAFILEPICT *pMFP = (METAFILEPICT *)GlobalLock( hMF );
pMFP->mm = MM_ANISOTROPIC;
pMFP->xExt = tSize.cx;
pMFP->yExt = tSize.cy;
HMETAFILE hMeta = dcMeta.Close();
pMFP->hMF = hMeta;
GlobalUnlock( hMF );
if ( SetClipboardData(CF_METAFILEPICT, hMF) == NULL ) {
AfxMessageBox( "Select Failed in SetClipBoardData", MB_OK | MB_ICONEXCLAMATION );
}
// CBitmap
//
if ( !CloseClipboard() ) {
AfxMessageBox( "CloseClipboard Failed", MB_OK | MB_ICONEXCLAMATION );
}
ReleaseDC( pDC ); // Moved this down here, needs testing.
return;
}