亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产成a人亚洲精| 精品日韩欧美在线| 午夜激情综合网| 欧美日韩另类一区| 人禽交欧美网站| 久久影院午夜论| 国产69精品久久久久毛片| 亚洲色欲色欲www| 欧美日韩一区三区四区| 奇米亚洲午夜久久精品| 精品成a人在线观看| 成人97人人超碰人人99| 亚洲午夜久久久久中文字幕久| 91.com在线观看| 国产呦精品一区二区三区网站| 中文字幕在线观看不卡视频| 欧美亚洲精品一区| 久久国产精品第一页| 国产精品免费看片| 欧美午夜宅男影院| 国内精品视频666| 亚洲欧洲日韩综合一区二区| 欧美丰满嫩嫩电影| 国产经典欧美精品| 一区二区三区**美女毛片| 日韩欧美一级二级| 成人av电影在线播放| 三级亚洲高清视频| 中文字幕免费一区| 欧美精品日韩精品| 成人免费毛片片v| 亚洲国产精品自拍| 久久久www免费人成精品| 91蜜桃网址入口| 麻豆精品视频在线观看| 国产精品成人免费精品自在线观看| 欧美日韩国产综合一区二区| 高清久久久久久| 亚洲成人av福利| 日本一区二区三区四区在线视频| 欧美日韩你懂得| 床上的激情91.| 日本强好片久久久久久aaa| 国产精品免费aⅴ片在线观看| 欧美日韩成人在线| www.99精品| 久久99精品国产麻豆不卡| 亚洲精品乱码久久久久久黑人 | 亚洲欧美影音先锋| 日韩一区二区三区在线视频| 99精品久久只有精品| 蓝色福利精品导航| 一区二区三区丝袜| 国产亚洲va综合人人澡精品| 欧美日韩国产乱码电影| 99国产精品99久久久久久| 蜜桃精品视频在线| 亚洲在线免费播放| 中文字幕av一区 二区| 日韩三区在线观看| 91黄视频在线| 成人免费视频视频在线观看免费| 美女视频网站黄色亚洲| 亚洲一区二区三区四区在线| 国产精品久久午夜夜伦鲁鲁| 精品毛片乱码1区2区3区| 欧美日韩亚洲高清一区二区| 99在线精品免费| 国产精品亚洲视频| 久久精品国产精品青草| 午夜精品久久久久久久久久久 | 国产免费久久精品| 日韩一卡二卡三卡国产欧美| 欧美三级中文字幕在线观看| 99久久精品一区| 国产成人av一区二区三区在线| 老司机一区二区| 视频一区国产视频| 亚洲妇女屁股眼交7| 亚洲天堂2014| 国产精品免费av| 久久久精品免费免费| 日韩一区二区三区免费观看| 欧美色视频在线| 欧美又粗又大又爽| 一本一本大道香蕉久在线精品 | 欧美高清在线视频| 久久在线免费观看| 精品国产免费久久| 日韩免费高清电影| 日韩一区二区三区观看| 欧美精品vⅰdeose4hd| 欧美午夜电影在线播放| 在线欧美日韩国产| 91福利精品视频| 日本韩国欧美在线| 91美女福利视频| 91老师片黄在线观看| 99久久99久久综合| 93久久精品日日躁夜夜躁欧美| 粉嫩绯色av一区二区在线观看| 国产一区高清在线| 国产传媒欧美日韩成人| 国产河南妇女毛片精品久久久| 国内精品不卡在线| 国产美女一区二区三区| 国产一二精品视频| 丰满亚洲少妇av| 成人午夜电影久久影院| 成人少妇影院yyyy| 99精品1区2区| 欧洲一区二区三区在线| 欧美日韩亚洲不卡| 欧美肥胖老妇做爰| 日韩午夜激情免费电影| 精品久久99ma| 久久久精品tv| 国产精品美女一区二区在线观看| 国产精品久久三区| 亚洲精品日韩专区silk| 亚洲国产精品久久人人爱蜜臀| 天堂蜜桃一区二区三区 | 国产一区二区视频在线| 国产乱码字幕精品高清av| 国产a视频精品免费观看| 成人黄动漫网站免费app| 一道本成人在线| 欧美精品v国产精品v日韩精品| 欧美刺激午夜性久久久久久久| 久久影视一区二区| 国产精品麻豆视频| 亚洲自拍偷拍综合| 日韩电影在线观看一区| 精品一区二区在线播放| 福利电影一区二区三区| 91视频.com| 欧美精品第一页| 久久精品视频在线看| 中文字幕综合网| 午夜成人免费视频| 精品一区二区精品| av网站一区二区三区| 欧美日韩黄色影视| 久久久久久久久99精品| 亚洲欧洲日韩女同| 亚洲高清免费观看高清完整版在线观看| 日本欧美一区二区| 成人综合在线视频| 欧美日韩国产另类一区| 久久蜜桃av一区精品变态类天堂 | 欧美午夜精品免费| 日韩一区二区免费在线观看| 欧美国产国产综合| 亚洲777理论| 国产在线精品一区在线观看麻豆| av在线不卡免费看| 在线不卡a资源高清| 久久久久久久久久久久久女国产乱 | 精品欧美一区二区久久| 国产精品美女久久久久久| 亚洲成人激情综合网| 国产精品资源在线| 在线观看欧美黄色| 久久精品一二三| 亚洲欧美日韩国产另类专区| 久色婷婷小香蕉久久| 91网站最新地址| 日韩欧美不卡在线观看视频| 亚洲婷婷国产精品电影人久久| 日本不卡视频在线| 97精品久久久午夜一区二区三区| 欧美一区二区三区啪啪| 亚洲人午夜精品天堂一二香蕉| 另类小说视频一区二区| 日本丶国产丶欧美色综合| 欧美xingq一区二区| 亚洲一区二区三区四区五区黄| 国产一区二区不卡| 欧美影视一区二区三区| 国产欧美精品一区二区色综合朱莉| 亚洲国产欧美另类丝袜| 成人av午夜电影| 精品国产亚洲在线| 亚洲夂夂婷婷色拍ww47| 国产1区2区3区精品美女| 91精品国产一区二区三区香蕉| 亚洲欧美偷拍三级| 国产毛片精品一区| 欧美肥妇毛茸茸| 亚洲欧美日韩国产综合| 国产91在线观看| 欧美电影免费观看高清完整版在线| 亚洲免费av网站| 国产91精品一区二区麻豆网站| 日韩亚洲欧美高清| 亚洲国产视频a| 91在线观看污| 国产日韩精品一区二区三区| 麻豆91在线观看| 欧美日本韩国一区|