亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch21.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<META NAME="GENERATOR" Content="Symantec Visual Page Mac 1.1">	<TITLE>Teach Yourself Visual C++&#174; 5 in 24 Hours -- Hour 21 -- Printing</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><H1 ALIGN="CENTER"><IMG SRC="../button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM"BORDER="0"><BR><FONT COLOR="#000077">Teach Yourself Visual C++&#174; 5 in 24 Hours</FONT></H1><CENTER><P><A HREF="../ch20/ch20.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch22/ch22.htm"><IMGSRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><H1 ALIGN="CENTER"><FONT COLOR="#000077">- Hour 21 -<BR>Printing</FONT></H1><P>There are two primary output devices in Windows: the screen and the printer. Printingusing the MFC class library is much simpler than printing in a straight SDK and Cenvironment.</P><P>In this hour, you will learn<UL>	<LI>The support provided for printing using the Document/View architecture<BR>	<BR>		<LI>The differences between printer and screen display output<BR>	<BR>		<LI>How to manage GDI resources used for printing</UL><P>You also will create a sample program to demonstrate how printing is done fora Document/View application.<H2><FONT COLOR="#000077"><B>What Is Printing in a Windows Program?</B></FONT></H2><P>Programs written for Windows should be hardware independent. This extends to theprinter, where all output is performed through device contexts, much as displaysto the screen are done.</P><P>Many programs written for Windows need no hard copy output. However, many programscan benefit by providing reports or other information in a printout. The Document/Viewarchitecture and MFC class library provide standard printing functionality to allSDI and MDI applications.</P><P>Historically, printing in a program written for Windows has been a nightmare.Using the traditional SDK approach, seemingly dozens of function calls and structuresmust be used to send output to a printer. Because Windows supports literally hundredsof printers, en-suring that printed output is printed correctly can be difficult.</P><P>The Document/View architecture and the MFC class library help make creating hard-copyprintouts in a Windows program much easier. You can use the Common Print dialog boxand reuse view functions that are used to display information on the screen.</P><P>Printing in an MFC program is almost effortless. If your program uses the Document/Viewarchitecture and does all of its drawing in the <TT>OnDraw</TT> function, you mightnot need to do anything to get basic printing to work. The source code provided inListing 21.1 is an example of a simple <TT>OnDraw</TT> function that can be usedfor screen and printer output.<H4><FONT COLOR="#000077">TYPE: Listing 21.1. A simple OnDraw function that worksfor the screen and the printer.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CPrintView::OnDraw(CDC* pDC)</TT><TT>{</TT><TT>    CString szMsg = &quot;Hello printer and view example.&quot;;</TT><TT>    pDC-&gt;TextOut( 0, 50, szMsg );</TT></FONT></PRE><P><TT>}</TT> Using the view's <TT>OnDraw</TT> member function is an easy way totake advantage of the hardware independence offered by Windows. If your code is portableenough to run on a variety of screen displays, you probably will get an acceptableprintout using most printers available for Windows.</P><P>On the other hand, there are many cases in which you might want to get more involvedin the printing. For example, if your view is not WYSIWYG, the printed output mightnot be suitable. If your view is a form view, for example, you might want to printyour document's data in another form, such as a list of items in the entire documentor detailed information about an item in the current form.</P><P>When you customize the view functions that are responsible for printing, you canalso offer nice user interface elements such as headers, footers, page numbers, orspecial fonts.<H3><FONT COLOR="#000077"><B>Understanding the MFC Printing Routines</B></FONT></H3><P>The following lists the <TT>CView</TT> routines used to print a view:<UL>	<LI><TT>OnPreparePrinting</TT>, called before the Common Print dialog box is displayed<BR>	<BR>		<LI><TT>OnBeginPrinting</TT>, where GDI resources specific to using the printer should	be allocated<BR>	<BR>		<LI><TT>OnPrepareDC</TT>, called once per page, just before the printout begins<BR>	<BR>		<LI><TT>OnPrint</TT>, called to actually draw to the printer's DC<BR>	<BR>		<LI><TT>OnEndPrinting</TT>, called once after all pages have been printed or after	the job is canceled; this is where GDI resources specific to using the printer are	released</UL><P>These member functions are called by the MFC framework as the print routine progresses.The relationship between these routines is shown in Figure 21.1.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 21.1.</B></A> <BR><I><TT>CView</TT> member functions called while printing a document.</I></P><P>As shown in Figure 21.1, only the <TT>OnPrepareDC</TT> and <TT>OnPrint</TT> memberfunctions are called for every page sent to the printer. The other functions areused to initiate variables in preparation of the printout or to clean up and freeresources after the printout has been completed.</P><P>When AppWizard creates a view class for your program, the <TT>OnPreparePrinting</TT>,<TT>OnBeginPrinting</TT>, and <TT>OnEndPrinting</TT> functions are automaticallyprovided for you. You can add the other member functions with ClassWizard if youmust override the basic functionality.<H3><FONT COLOR="#000077"><B>Creating an MFC Printing Example</B></FONT></H3><P>As an example of the MFC print functions, create a small program that displaysinformation to the screen and the printer. To begin, create an SDI or MDI projectnamed MFCPrint using ClassWizard.</P><P>With ClassWizard, add two message-handling functions for the <TT>CMFCPrintView</TT>class: <TT>OnPrepareDC</TT> and <TT>OnPrint</TT>. You'll find out more about <TT>OnPrepareDC</TT>and <TT>OnPrint</TT> in the next few sections. The other printing functions havealready been included in the <TT>CMFCPrintView</TT> class by AppWizard.</P><P>Add five new member variables and two new functions to the implementation sectionof the <TT>CMFCPrintView</TT> class, as shown in Listing 21.2.<H4><FONT COLOR="#000077">TYPE: Listing 21.2. New CPrintView member variables.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>protected:</TT><TT>    int     m_nCurrentPrintedPage;</TT><TT>    CFont*  m_pFntBold;</TT><TT>    CFont*  m_pFntBanner;</TT><TT>    CFont*  m_pFntHighlight;</TT><TT>    CPen    m_penBlack;</TT><TT>    void PrintHeader(CDC* pDC);</TT></FONT></PRE><P><TT>void PrintFooter(CDC* pDC);</TT> These new member variables and functionsare used during the printout.<H3><FONT COLOR="#000077"><B>Exploring the <TT>CPrintInfo</TT> Class</B></FONT></H3><P>The <TT>CPrintInfo</TT> class is used to store information about the current stateof a printout. A pointer to a <TT>CPrintInfo</TT> object is passed as a parameterto functions involved in the printout. You can access attributes of the <TT>CPrintInfo</TT>object for information about the printout, or in some cases you can change the attributesto customize the printout. Here are the most commonly used <TT>CPrintInfo</TT> members:<UL>	<LI><TT>m_bPreview</TT> is a flag that is set to <TT>TRUE</TT> if the document is	being previewed.<BR>	<BR>		<LI><TT>m_bContinuePrinting</TT> is a flag that is set to <TT>FALSE</TT> to stop	the print loop.<BR>	<BR>		<LI><TT>m_nCurPage</TT> contains the currently printing page number.<BR>	<BR>		<LI><TT>m_rectDraw</TT> contains the current printout rectangle.<BR>	<BR>		<LI><TT>SetMinPage</TT> sets the document's first page number.<BR>	<BR>		<LI><TT>SetMaxPage</TT> sets the document's last page number.<BR>	<BR>		<LI><TT>GetMinPage</TT> returns the value previously set as the document's first	page number.<BR>	<BR>		<LI><TT>GetMaxPage</TT> returns the value previously set as the document's last page	number.<BR>	<BR>		<LI><TT>GetFromPage</TT> returns the number of the first page being printed.<BR>	<BR>		<LI><TT>GetToPage</TT> returns the number of the first page being printed.</UL><P>Some of these members are used in a particular function. As you learn about eachfunction in the next few sections, commonly used <TT>CPrintInfo</TT> members willbe discussed.<H3><FONT COLOR="#000077"><B>Using the <TT>OnPreparePrinting</TT> Function</B></FONT></H3><P>AppWizard generates the <TT>OnPreparePrinting</TT> function for a project's initialview class. This function is called before the Common Print dialog box is displayed,and it gives you an opportunity to change the values displayed in the Print dialogbox.</P><P>If your document has more than one page, you should calculate the number of pages,if possible. This allows the maximum number of pages to be displayed in the Printdialog box. You can set the number of pages by calling the <TT>CPrintInfo::SetMaxPages</TT>function:</P><PRE><FONT COLOR="#0066FF"><TT>pInfo-&gt;SetMaxPages( 2 );</TT></FONT></PRE><BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>CAUTION:</B></FONT><B> </B>You should not allocate	resources in the <TT>CPrintInfo::SetMaxPages</TT> func-tion because you are not notified	if the user cancels the Print dialog box. <HR></BLOCKQUOTE><H3><FONT COLOR="#000077"><B>Using the <TT>OnBeginPrinting</TT> Function</B></FONT></H3><P>The <TT>OnBeginPrinting</TT> function is called after the user has pressed OKin the Print dialog box in order to start the printout. This function is the properplace to allocate resources such as fonts, brushes, and pens that might be neededfor the printout. In the example you work with later, this function is used to create<TT>CFont</TT> objects.</P><P>This function is called only once for each printout. If this function is called,the <TT>OnEndPrinting</TT> function is called after the printout is finished in orderto give you a chance to free resources allocated in the <TT>OnBeginPrinting</TT>function.<H3><FONT COLOR="#000077"><B>Using the <TT>OnPrepareDC</TT> Function</B></FONT></H3><P>The <TT>OnPrepareDC</TT> function is called just before a page is printed or displayedin the view. If <TT>OnPrepareDC</TT> is called with the <TT>CPrintInfo</TT> pointerset to <TT>NULL</TT>, the document is not being printed.</P><P>This function often is overridden for multiple-page documents in order to continuethe printout over multiple pages. To print another page, set the <TT>CPrintInfo::m_bContinue</TT>member variable to <TT>TRUE</TT>:</P><PRE><FONT COLOR="#0066FF"><TT>pInfo-&gt;m_bContinuePrinting = TRUE;</TT></FONT></PRE>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久蜜臀| 91香蕉视频污| 亚洲午夜一区二区三区| 亚洲免费观看高清在线观看| 国产日韩欧美综合在线| 国产精品色噜噜| 中文字幕成人在线观看| 国产精品成人网| 亚洲欧洲99久久| 亚洲靠逼com| 亚洲成人免费av| 免费在线视频一区| 国产中文字幕一区| 国产98色在线|日韩| 91在线视频在线| 欧美日韩不卡一区二区| 日韩欧美一区二区不卡| 久久精品视频免费| 亚洲天堂2014| 天堂一区二区在线| 国产在线视频一区二区| 成人网在线免费视频| 日本高清不卡视频| 日韩一区二区三区视频在线| 久久久久97国产精华液好用吗| 久久久久国产成人精品亚洲午夜| 国产精品国产馆在线真实露脸| 亚洲男人的天堂av| 美腿丝袜在线亚洲一区| 成人免费三级在线| 6080亚洲精品一区二区| 国产视频一区二区在线| 亚洲成人免费电影| 国产精品一区二区在线观看不卡 | 久久精品一区四区| **性色生活片久久毛片| 日韩福利电影在线观看| 成人一二三区视频| 91 com成人网| 亚洲另类一区二区| 国产伦精一区二区三区| 欧美色网站导航| 国产欧美一区在线| 理论电影国产精品| 日本道色综合久久| 国产亚洲精品bt天堂精选| 亚洲第一成人在线| 91伊人久久大香线蕉| 亚洲精品一区二区三区影院| 亚洲国产一区在线观看| 成人美女视频在线看| 精品久久久久久久人人人人传媒| 亚洲精品视频观看| 成人免费av资源| 久久亚洲捆绑美女| 日韩av成人高清| 欧美性色欧美a在线播放| 国产精品久久久久影视| 国产一区二区三区蝌蚪| 欧美一区二视频| 亚洲电影你懂得| 在线免费观看日本欧美| 亚洲精品伦理在线| 在线视频欧美精品| 亚洲欧美经典视频| 91成人国产精品| 亚洲午夜私人影院| 91黄色小视频| 亚洲成人午夜电影| 欧美日高清视频| 日本在线不卡一区| 日韩一区二区免费在线电影| 爽好久久久欧美精品| 欧美高清视频一二三区| 午夜私人影院久久久久| 欧美精品少妇一区二区三区| 日日噜噜夜夜狠狠视频欧美人| 欧美色精品天天在线观看视频| 一区二区三区小说| 欧美日韩在线播放三区| 日韩精品一级二级| 日韩欧美国产一区二区在线播放 | 337p日本欧洲亚洲大胆色噜噜| 激情成人综合网| 欧美国产精品中文字幕| av激情综合网| 亚洲国产欧美在线人成| 欧美高清视频一二三区 | 精品视频1区2区| 日韩va亚洲va欧美va久久| 日韩一级二级三级精品视频| 久久福利资源站| 日本一区二区成人| 91黄色在线观看| 秋霞电影一区二区| 中文无字幕一区二区三区| av在线一区二区| 亚洲成人激情自拍| 国产亚洲欧洲997久久综合 | 在线91免费看| 国产一级精品在线| 一区二区三区在线观看网站| 欧美高清精品3d| 国产精品影视天天线| 亚洲三级久久久| 欧美www视频| 91女厕偷拍女厕偷拍高清| 丝袜国产日韩另类美女| 国产精品丝袜久久久久久app| 在线观看日韩精品| 国产一区日韩二区欧美三区| 亚洲欧美偷拍卡通变态| 欧美成人国产一区二区| 91免费小视频| 精品一区免费av| 一区二区三区小说| 国产欧美日韩不卡| 日韩一级完整毛片| 在线欧美小视频| 丁香啪啪综合成人亚洲小说| 人妖欧美一区二区| 亚洲激情中文1区| 国产亚洲欧美日韩在线一区| 欧美另类久久久品| 91亚洲精品久久久蜜桃| 国产美女精品一区二区三区| 午夜av区久久| 亚洲激情五月婷婷| 国产精品美女一区二区在线观看| 91精品国产色综合久久不卡蜜臀| 色综合天天综合网国产成人综合天 | 毛片av中文字幕一区二区| 亚洲精品第一国产综合野| www精品美女久久久tv| 欧美一二区视频| 欧美日韩一区二区欧美激情 | 日本乱码高清不卡字幕| 成人免费视频一区| 国产老肥熟一区二区三区| 青草av.久久免费一区| 日韩国产欧美三级| 亚洲一区二区三区四区五区中文| 中文字幕在线不卡| 中文字幕五月欧美| 中文字幕一区二区三区不卡| 国产午夜久久久久| 久久精品夜色噜噜亚洲aⅴ| 日韩精品中文字幕一区| 日韩免费在线观看| 日韩精品综合一本久道在线视频| 欧美福利视频一区| 91精品在线免费观看| 欧美蜜桃一区二区三区| 717成人午夜免费福利电影| 欧美美女激情18p| 91精品久久久久久久99蜜桃| 91精品国产91久久综合桃花 | 国内久久精品视频| 国产精品99久久久久久有的能看| 国产精品综合视频| 成人黄色免费短视频| 91论坛在线播放| 欧美三级电影精品| 欧美日韩国产免费| 欧美一区二区三区电影| 欧美tk—视频vk| 国产欧美va欧美不卡在线| 国产精品久久一卡二卡| 一级精品视频在线观看宜春院 | 91亚洲永久精品| eeuss影院一区二区三区| 99re这里只有精品首页| 欧美性猛交xxxx乱大交退制版 | 日本女人一区二区三区| 久久99久久久久| 成人精品gif动图一区| 99re亚洲国产精品| 欧美一区二区三区四区在线观看| 欧美顶级少妇做爰| 日韩欧美专区在线| 国产精品青草久久| 亚洲成a人v欧美综合天堂 | 色诱视频网站一区| 91精品婷婷国产综合久久性色| 精品理论电影在线观看| 国产精品久久三| 亚洲国产精品一区二区www在线| 蜜臀a∨国产成人精品| 不卡一区二区三区四区| 欧美日韩精品一区二区三区| 国产欧美日韩综合精品一区二区| 亚洲国产美女搞黄色| 国产91在线观看丝袜| 717成人午夜免费福利电影| 国产精品久久久久国产精品日日| 日韩不卡一区二区| 色婷婷av一区二区三区软件| 久久网站热最新地址| 日韩精品每日更新| 欧美性xxxxxxxx|