请教关于CPrintDialog或CPrintDialogEx 对话框中设置打印当前页的问题

rczpf 2009-02-13 08:20:20
各位大虾好:
最近在做打印,客户要求在打印对话框中有选择“打印当前页”的功能。
我查了下CPrintDialog中没有该设置
CPrintDialogEx中有PD_CURRENTPAGE,可是设置了没效果
"打印当前页"还是置灰的

不知道有没有人进行了这方面的研究~~
谢谢~~
...全文
251 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
rczpf 2009-02-16
  • 打赏
  • 举报
回复
这是MSDN的代码:

// TODO: Add your command handler code here
CPrintDialog dlg(FALSE, PD_PAGENUMS | PD_USEDEVMODECOPIES);
dlg.m_pd.nMinPage = dlg.m_pd.nFromPage = 1;
dlg.m_pd.nMaxPage = dlg.m_pd.nToPage = 10;
if (dlg.DoModal() == IDOK)
{
// Determine the starting and ending page numbers for the range
// of pages to be printed.

int from_page = -1, to_page = -1;
if (dlg.PrintAll()) // print all pages in the document
{
from_page = dlg.m_pd.nMinPage;
to_page = dlg.m_pd.nMaxPage;
}
else if (dlg.PrintRange()) // print only a range of pages
{ // in the document
from_page = dlg.GetFromPage();
to_page = dlg.GetToPage();
}
else if (dlg.PrintSelection()) // print only the currently selected
// items
{
from_page = to_page = -1; // -1 to denote unknown yet
}

TRACE(_T("Print from %d to %d\n"), from_page, to_page);
}

出不了选择当前页面的radio。。请指教~~
rczpf 2009-02-16
  • 打赏
  • 举报
回复
这是MSDN的代码:

// TODO: Add your command handler code here
CPrintDialog dlg(FALSE, PD_PAGENUMS | PD_USEDEVMODECOPIES);
dlg.m_pd.nMinPage = dlg.m_pd.nFromPage = 1;
dlg.m_pd.nMaxPage = dlg.m_pd.nToPage = 10;
if (dlg.DoModal() == IDOK)
{
// Determine the starting and ending page numbers for the range
// of pages to be printed.

int from_page = -1, to_page = -1;
if (dlg.PrintAll()) // print all pages in the document
{
from_page = dlg.m_pd.nMinPage;
to_page = dlg.m_pd.nMaxPage;
}
else if (dlg.PrintRange()) // print only a range of pages
{ // in the document
from_page = dlg.GetFromPage();
to_page = dlg.GetToPage();
}
else if (dlg.PrintSelection()) // print only the currently selected
// items
{
from_page = to_page = -1; // -1 to denote unknown yet
}

TRACE(_T("Print from %d to %d\n"), from_page, to_page);
}

出不了选择当前页面的radio。。请指教~~
bitwwzhang130 2009-02-13
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 cnzdgs 的回复:]
不要加PD_NOCURRENTPAGE标志。
[/Quote]
恩,去掉这个
cnzdgs 2009-02-13
  • 打赏
  • 举报
回复
不要加PD_NOCURRENTPAGE标志。

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧