运行VC6的应用程序在VS2005中打印太多页面 [英] Working VC6 app prints too many pages in VS2005

查看:99
本文介绍了运行VC6的应用程序在VS2005中打印太多页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个可打印多达四页的C ++应用程序.在VC ++ 6下,您可以在打印"对话框中指定从"和到"页面,但是在VS2005中,即使您指定了"From = 1"和"To = 1",它也始终打印所有页面.

我尝试通过添加
来修补OnPrint()函数

Hi all,

I''ve got a C++ app which prints up to four pages. Under VC++6 you could specify From and To pages in the print dialog, but in VS2005, it always prints all of the pages even if you specify From=1 and To=1.

I''ve tried patching the OnPrint() function by adding

if ( pInfo->m_nCurPage == pInfo->GetToPage() )
{
    pInfo->m_bContinuePrinting = false;
}


在底部,但仍会打印所有页面.

谷歌搜索表明这是VS2005中的错误,如果我将pInfo->m_bContinuePrinting设置为false时仍无法停止打印,则如何在正确的页面数后停止显示的任何想法?


at the bottom but it still prints all the pages.

Googling suggests that it''s a bug in VS2005, any ideas how to stop after the correct number of pages if it doesn''t stop printing when I set pInfo->m_bContinuePrinting to false?

推荐答案

修复此问题,它需要进入CView :: OnPrepareDC(),并且如果我们经过了到"页面,则停止打印输出:
Fixed it, it needs to go in CView::OnPrepareDC(), and stop the printout if we have gone past the To page:
void CMyView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{
    CView::OnPrepareDC(pDC, pInfo);
	
    if ( pInfo )
    {
        if ( pInfo->m_nCurPage > pInfo->GetToPage() )
            pInfo->m_bContinuePrinting = FALSE;
    }
}


这篇关于运行VC6的应用程序在VS2005中打印太多页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆