zoukankan      html  css  js  c++  java
  • CView::OnPreparePrinting

    http://technet.microsoft.com/zh-cn/subscriptions/a59dff1e(v=vs.71).aspx CView::OnPreparePrinting Called by the framework before a document is printed or previewed. virtual BOOL OnPreparePrinting( CPrintInfo* pInfo ); Parameters pInfo Points to a CPrintInfo structure that describes the current print job. Return Value Nonzero to begin printing; 0 if the print job has been canceled. Remarks The default implementation does nothing. You must override this function to enable printing and print preview. Call the DoPreparePrinting member function, passing it the pInfo parameter, and then return its return value; DoPreparePrinting displays the Print dialog box and creates a printer device context. If you want to initialize the Print dialog box with values other than the defaults, assign values to the members of pInfo. For example, if you know the length of the document, pass the value to the SetMaxPage member function of pInfo before calling DoPreparePrinting. This value is displayed in the To: box in the Range portion of the Print dialog box. DoPreparePrinting does not display the Print dialog box for a preview job. If you want to bypass the Print dialog box for a print job, check that the m_bPreview member of pInfo is FALSE and then set it to TRUE before passing it to DoPreparePrinting; reset it to FALSE afterwards. If you need to perform initializations that require access to the CDC object representing the printer device context (for example, if you need to know the page size before specifying the length of the document), override the OnBeginPrinting member function. If you want to set the value of the m_nNumPreviewPages or m_strPageDesc members of the pInfo parameter, do so after calling DoPreparePrinting. The DoPreparePrinting member function sets m_nNumPreviewPages to the value found in the application's .INI file and sets m_strPageDesc to its default value. Example Override OnPreparePrinting and call DoPreparePrinting from the override so that the framework will display a Print dialog box and create a printer DC for you. BOOL CMyView::OnPreparePrinting(CPrintInfo *pInfo) { return CEditView::DoPreparePrinting(pInfo); } If you know how many pages the document contains, set the maximum page in OnPreparePrinting before calling DoPreparePrinting. The framework will display the maximum page number in the "to" box of the Print dialog box. BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo) { //The document has 2 pages. pInfo->SetMaxPage(2); return CEditView::DoPreparePrinting(pInfo);
  • 相关阅读:
    ORACLE函数介绍
    msdn的javascript文章转载
    baidu的高级搜索命令
    周杰伦 青花瓷 蒲公英的约定 我不配 彩虹 歌词和下载
    谷歌百度相争 新浪渔翁得利
    tomcat+jsp web运行环境搭建
    C#2008与.NET 3.5 高级程序设计读书笔记(24) LINQ API编程
    C#2008与.NET 3.5 高级程序设计读书笔记(16) 类型反射、晚期绑定和基于特性的编程
    C#2008与.NET 3.5 高级程序设计读书笔记(15) .NET程序集入门
    C#2008与.NET 3.5 高级程序设计读书笔记(25) WCF
  • 原文地址:https://www.cnblogs.com/gosteps/p/3244822.html
Copyright © 2011-2022 走看看