Beispiel #1
0
void CPreviewDC::MirrorViewportOrg()
/**********************************/
{
    if( m_hAttribDC != NULL && m_hDC != NULL ) {
        CPoint point;
        ::GetViewportOrgEx( m_hAttribDC, &point );
        PrinterDPtoScreenDP( &point );
        point += m_sizeTopLeft;
        ::SetViewportOrgEx( m_hDC, point.x, point.y, NULL );
        ::GetWindowOrgEx( m_hAttribDC, &point );
        ::SetWindowOrgEx( m_hAttribDC, point.x, point.y, NULL );
    }
}
Beispiel #2
0
void CPreviewDC::ClipToPage()
/***************************/
{
    POINT point;
    point.x = ::GetDeviceCaps( m_hAttribDC, HORZRES );
    point.y = ::GetDeviceCaps( m_hAttribDC, VERTRES );
    PrinterDPtoScreenDP( &point );
    ::SetMapMode( m_hDC, MM_TEXT );
    ::SetViewportOrgEx( m_hDC, m_sizeTopLeft.cx, m_sizeTopLeft.cy, NULL );
    ::SetWindowOrgEx( m_hDC, 0, 0, NULL );
    ::IntersectClipRect( m_hDC, 1, 1, point.x - 2, point.y - 2 );
    MirrorMappingMode( FALSE );
}
Beispiel #3
0
void CPreviewDC::MirrorViewportOrg()
{
	if (m_hAttribDC == NULL || m_hDC == NULL)
		return;

	CPoint ptVpOrg;
	VERIFY(::GetViewportOrgEx(m_hAttribDC, &ptVpOrg));
	PrinterDPtoScreenDP(&ptVpOrg);
	ptVpOrg += m_sizeTopLeft;
	::SetViewportOrgEx(m_hDC, ptVpOrg.x, ptVpOrg.y, NULL);

	CPoint ptWinOrg;
	VERIFY(::GetWindowOrgEx(m_hAttribDC, &ptWinOrg));
	::SetWindowOrgEx(m_hDC, ptWinOrg.x, ptWinOrg.y, NULL);
}
Beispiel #4
0
void CPreviewDC::ClipToPage()
{
	ASSERT(m_hAttribDC != NULL);
	ASSERT(m_hDC != NULL);
	// Create a rect in Screen Device coordinates that is one pixel larger
	// on all sides than the actual page.  This is to hide the fact that
	// the printer to screen mapping mode is approximate and may result
	// in rounding error.

	CPoint pt(::GetDeviceCaps(m_hAttribDC, HORZRES),
				::GetDeviceCaps(m_hAttribDC, VERTRES));
	PrinterDPtoScreenDP(&pt);

	// Set the screen dc to MM_TEXT and no WindowOrg for the interesection

	::SetMapMode(m_hDC, MM_TEXT);
	::SetWindowOrgEx(m_hDC, 0, 0, NULL);
	::SetViewportOrgEx(m_hDC, m_sizeTopLeft.cx, m_sizeTopLeft.cy, NULL);
	::IntersectClipRect(m_hDC, -1, -1, pt.x + 2, pt.y + 2);

	// Resynchronize the mapping mode
	MirrorMappingMode(FALSE);
}