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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? apc.htm

?? VisualC21天自學(xué)教程.rar 英文經(jīng)典教程
?? HTM
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
<P>As I mentioned earlier, the code in Listing C.4 works fine, but there is a betterway to allocate the resources needed. Currently every time a page is printed, OnPrint()is called to draw the page, and all the resources are created from scratch. Thatprobably won't slow things down too much for this simple output, but in a large,complex report you might want to set up a number of resources and other calculationsjust once at the start of the report. Then you can print a number of pages and cleanup the resources at the end of the report.</P><P>The OnBeginPrinting()virtual function is an ideal place to do this initialization,and its sister function, OnEndPrinting(), is the place to clean up these resources.OnBeginPrinting() is called after OnPreparePrinting() and is the first place wherea printer device context is passed in. This device context is the one that is usedduring the printing process, so you can set up all the GDI objects and printer pagecoordinates at this point. The default code supplied automatically by the ClassWizardjust gives you an empty function:</P><P><PRE>void CPrintItView::OnBeginPrinting(CDC* /*pDC*/, &Acirc; CPrintInfo* /*pInfo*/){    // TODO: add extra initialization before printing}</PRE><P>Take a close look at that function definition. Notice the parameters are actuallycommented out to the compiler, throwing warning messages about unused parameterswhen you compile. You'll have to remember to uncomment these parameters before youstart using them.</P><P>You can now add the GDI object creation calls to this function to avoid doingit on every page:</P><P><PRE>m_fnTimes.CreatePointFont(720,&quot;Times New Roman&quot;,pDC);m_brHatch.CreateHatchBrush(HS_CROSS,RGB(64,64,64));</PRE><P>Notice that the fnTimes and brHatch objects have been prefixed by an m_; thisis a naming convention to indicate that the objects have class scope (are embeddedin the class) rather than local scope (are embedded in the function). Because you'llneed to access these GDI objects in OnPrint(), you can add them to the class declaration.You can do this by adding the font and brush objects to the class declaration likethis:</P><P><PRE>protected:    CFont     m_fnTimes;    CBrush    m_brHatch;</PRE><P>You can add these either by double-clicking the CPrintItView class in the ClassViewand adding them directly or by using the Add Member Variable dialog box.</P><P>Also notice that the hatched brush is created with the CreateHatchBrush() functionrather than with the constructor. This is because the brush will exist as long asthe view does, but you must call DeleteObject() in the OnBeginPrinting() functionso that the underlying GDI resource is freed between prints. You can add the codeto delete both the font and brush GDI objects in OnEndPrinting(), as shown in theselines:</P><P><PRE>m_fnTimes.DeleteObject();m_brHatch.DeleteObject();</PRE><P>All that remains is to remove the local GDI objects from the OnPrint() functionitself and replace their references with the member variable versions. You can dothis by replacing the CFont fnTimes and CBrush brHatch local variables and theircreation functions and just selecting the precreated font and brush:</P><P><PRE>CFont* pOldFont = (CFont*)pDC-&gt;SelectObject(&amp;m_fnTimes);CBrush* pOldBrush = (CBrush*)pDC-&gt;SelectObject(&amp;m_brHatch);</PRE><P>If you were to build and run the application after making these changes, you'dprobably notice no difference. Functionally it's the same, but the print and previewshould be a little faster. If you had a large, complex 100-page report using lotsof GDI resources, you'd definitely find this technique useful in speeding up theprinting.</P><BLOCKQUOTE>	<P><HR><B>USING COORDINATES FROM </B>OnBeginPrinting()</P>	<P>You might be tempted to also store the coordinates from OnBeginPrinting(). This	won't work because CPrintInfo's m_rectDraw member hasn't been initialized by that	stage and random coordinates will be used.<HR></BLOCKQUOTE><H3><A NAME="Heading12"></A>Customizing Device Context Preparation</H3><P>Before both OnDraw() and OnPrint() are called, the OnPrepareDC() virtual functionis called and can be overridden in your view class to perform any device contextmodifications that might be common to both OnDraw() and OnPrint(). You might wantto set mapping modes or set certain common draw modes to the device context for bothonscreen and printing modes. The override isn't supplied by the AppWizard, but caneasily be added from the Add Virtual Function dialog box. One thing common to bothOnDraw() and OnPrint() in the example is the SetTextAlign() device context function.You could add this to an OnPrepareDC() function like this:</P><P><PRE>void CPrintItView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo){    pDC-&gt;SetTextAlign(TA_CENTER+TA_BASELINE);}</PRE><P>There might be times, especially when preparing WYSIWYG printouts, that it isadvantageous to set mapping modes and window extents in a common function beforethe draw or print function is called. OnPrepareDC() is the place to put any devicecontext-specific initialization code.</P><P><H3><A NAME="Heading13"></A>Aborting the Print Job</H3><P>Another use of OnPrepareDC() is to call printer escapes or other print document-specificfunctions. If you had a particularly long report, you might want to give the userthe option of terminating the printing process and aborting the print. The AbortDoc()device context function aborts the printing document for a printer device context.You can try this by adding the following lines to OnPrepareDC() and aborting thedocument after three pages:</P><P><PRE>if (pDC-&gt;IsPrinting())    if (pInfo-&gt;m_nCurPage==3) pDC-&gt;AbortDoc();</PRE><H2><A NAME="Heading14"></A>Direct Printing Without the Framework</H2><P>So far in this chapter, I've shown you the SDI and MDI framework support for printing.This support melds nicely into the Document/View architecture, but there are timeswhen you just want quick and easy access to a printer or don't have the frameworkavailable--in a dialog-based application, for example.</P><P>The framework support hides lower-level printing support that is the bedrock forall the printing operations. This section explains how this support works and showsit in use in a dialog box-based application example.</P><P><H3><A NAME="Heading15"></A>Invoking the Print Dialog Box Directly</H3><P>You saw in the earlier section &quot;Using the Print Dialog Box&quot; how theCPrintDialog class provides a wrapper for the common PRINTDLG dialog and how thiswas called from CView::DoPreparePrinting().</P><P>The same dialog box and class can be used directly to set up the destination printerand its default settings just like you'd use a normal modal dialog box. You can usethe same access functions to set the page numbers and copy defaults as you used frominside the framework's DoPreparePrinting() function.</P><P>Listing C.7 shows this dialog box being used directly to configure the printerfor dialog box-based printing and then prints a small document from the defaultsset by the dialog box.</P><P>The direct printing mechanism works via the StartDoc() and EndDoc() functionsshown in this listing and is explained in the next section.</P><P>You can use the AppWizard to create a dialog box-based application named DlgPrintand create an OnOK() handler with the ClassWizard to implement the printing code,as shown in Listing C.7.</P><P><H4>LISITNG C.7.&nbsp;&nbsp;LST23_7.CPP--IMPLEMENTING A DIRECT DOCUMENT PRINT INOnOK OF A DIALOG BOX-BASED APPLICATION.</H4><PRE>1:  void CDlgPrintDlg::OnOK()2:  {3:      // TODO: Add extra validation here4:5:      // ** Construct a CPrintDialog object6:      CPrintDialog dlgPrint(FALSE,PD_ALLPAGES,this);7:8:      if (dlgPrint.DoModal()==IDOK)9:      {10:          // ** Attach the printer DC from the dialog11:          // ** to a CDC object12:          CDC dcPrint;13:          dcPrint.Attach(dlgPrint.GetPrinterDC());14:15:          // ** Create and fill a DOCINFO structure16:          DOCINFO myPrintJob;17:          myPrintJob.cbSize = sizeof(myPrintJob);18:          myPrintJob.lpszDocName = &quot;MyPrintJob&quot;;19:          myPrintJob.lpszOutput = NULL;20:          myPrintJob.lpszDatatype = NULL;21:          myPrintJob.fwType = NULL;22:23:          // ** Start the printing document24:          if (dcPrint.StartDoc(&amp;myPrintJob)&gt;=0)25:          {26:              // ** Start a page27:              dcPrint.StartPage();28:29:              // ** Start drawing30:              dcPrint.TextOut(0,0,&quot;My Small Print Job&quot;);31:32:              // ** Throw the page33:              dcPrint.EndPage();34:35:              // ** Close the document36:              dcPrint.EndDoc();37:          }38:39:          // ** Delete the printer device context40:          dcPrint.DeleteDC();41:      }42:43:      // ** Carry on with the standard OnOK44:      CDialog::OnOK();45:  }</PRE><P>Listing C.7 declares a CPrintDialog object dlgPrint at line 6 that takes threeparameters in its constructor. The first parameter is a flag that can be set as TRUEto display the Print Setup dialog box, or FALSE to display the Print dialog box.The second parameter is a set of combinable flags that customize the settings ofthe dialog box (too numerous to cover here). The third parameter is a pointer tothe parent window; in this case the C++ this pointer indicates that the dialog boxis the parent.</P><P>On line 8, dlgPrint.DoModal()is called to display this dialog box. If the userclicks OK, the print begins; otherwise, the block is skipped.</P><P>When the user has clicked OK in the Print dialog box, a device context for theprinter is created and attached to a CDC object in line 13 to make it easier to use.You must remember to delete the device context itself, as shown in line 40.</P><P>You can add the listing lines and handler, build and run it, and click OK of thedialog box application to run the new code.</P><P><H3><A NAME="Heading16"></A>Using StartDoc() and EndDoc()</H3><P>The CDC device context has many printer-specific functions. To start a new print,Windows must create a spool document to store the print job and submit it to theprinter when it is complete. The StartDoc() function tells Windows to start spooling,and the EndDoc() function tells it that the document is complete and can be sentto the printer. You saw the AbortDoc() function earlier that will abort the printand cancel the print job rather than send to the printer.</P><P>Listing C.7 calls the StartDoc() member of the printer device context object dcPrintat line 24, passing a pointer to a DOCINFO structure. This structure holds the detailsof the print job. The only detail you must specify is a name for the spool document,which is assigned at line 18. Notice that it has an unusual cbSize member that holdsthe size of the structure. This is assigned the value from sizeof(myPrintJob) atline 17. You see this sort of strange action going on a lot at the Win32 API levelbecause DOCINFO is an old C-style structure; the cbSize is used because there area few different forms of DOCINFO and the only way to tell them apart is the size.</P><P>When StartDoc() is called, it will try to start the print job and return a positivevalue if it succeeds. There are many reasons why it might fail, such as low diskspace or memory, or a corrupt printer driver, so it's a good idea to carry on withthe print only after checking the return code.</P><P>After the document is printed, you should call EndDoc() as shown on line 36 tostart printing the document.</P><BLOCKQUOTE>	<P><HR><B>WATCHING THE WINDOWS SPOOLER</B></P>	<P>You can watch the print document as it builds up by placing a breakpoint in the	OnPrint() function or after a StartDoc() function and opening your printer status	icon from the Printers group available from the main Windows Start menu under the	Settings option.<HR></BLOCKQUOTE><H3><A NAME="Heading17"></A>Using StartPage() and EndPage()</H3><P>Another pair of printer device context functions are StartPage() and EndPage().The StartPage() function is used to initialize the device context ready for printinga new page. This will reset some of the device context settings such as the currentgraphics cursor position and set the document spooling information for starting anew page.</P><P>Typically, you'd call StartPage(), do some drawing in the device context for thedetails to be printed on that page, and call EndPage() to write the page away tothe spool file to add it to the print document.</P><P>In Listing C.7, StartPage() is called on line 27, followed by a solitary TextOut()function to draw something on the printer page, followed by a call to EndPage() online 33.</P><P>When EndPage() is called, the special printer codes for throwing a Form Feed aresent to the spooler and the spool document registers another print page. You canrepeat this StartPage() and EndPage() sequence for all the document pages beforecalling EndDoc() to complete the printing process. You can use the printer devicecontext for drawing in just the same way as the OnPrint() was used in the SDI applicationin between the StartPage() and EndPage() calls. The same functions were called inthe SDI framework, but the framework hides it from you, only calling your OnPrint()between start and end page calls.</P><H1></H1><CENTER><P><HR><A HREF="../apb/apb.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../apd/apd.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> <BR><BR></P><P>&copy; <A HREF="../copy.htm">Copyright</A>, Macmillan Computer Publishing. Allrights reserved.</CENTER></BODY></HTML>

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99最新地址| 成人av先锋影音| 亚洲婷婷国产精品电影人久久| 欧美日韩高清一区二区三区| 国产91在线观看| 免费看日韩a级影片| 亚洲精品亚洲人成人网| 久久久久久久电影| 欧美群妇大交群的观看方式| 91日韩在线专区| 国产伦精一区二区三区| 日韩高清不卡在线| 亚洲久草在线视频| 国产欧美精品在线观看| 欧美大片日本大片免费观看| 欧美日韩专区在线| 91在线观看高清| 成人激情视频网站| 国产精品一区在线观看乱码| 裸体一区二区三区| 天天综合网 天天综合色| 亚洲欧美激情插| 国产精品视频观看| 久久久五月婷婷| 欧美大片免费久久精品三p| 在线播放中文一区| 欧美日韩小视频| 欧美在线观看视频一区二区三区| 91在线高清观看| 99精品偷自拍| 不卡欧美aaaaa| 成人av网站在线观看| 国产精品12区| 国产激情91久久精品导航 | 欧美日韩久久久一区| 99精品欧美一区二区三区小说| 国产成人精品影院| 国产精品一区不卡| 国内不卡的二区三区中文字幕 | 91精品国产综合久久久久久久久久 | 肉丝袜脚交视频一区二区| 一区二区三区精品视频| 依依成人综合视频| 亚洲五月六月丁香激情| 亚洲成人免费影院| 三级成人在线视频| 美女一区二区久久| 狠狠久久亚洲欧美| 国产乱对白刺激视频不卡 | 在线精品亚洲一区二区不卡| 日本韩国一区二区| 欧美亚洲高清一区| 7777精品伊人久久久大香线蕉经典版下载 | 日韩经典一区二区| 久久99国产精品久久99果冻传媒| 久久99日本精品| 国产成人夜色高潮福利影视| 懂色av噜噜一区二区三区av| 99在线精品免费| 欧美午夜精品免费| 日韩欧美在线网站| 久久综合久色欧美综合狠狠| 国产精品色呦呦| 一区二区免费在线播放| 视频一区在线视频| 国产福利一区二区三区视频 | 国产真实乱子伦精品视频| 成人激情综合网站| 欧美性猛交xxxxxx富婆| 欧美一区二区三区白人| 国产色产综合产在线视频| 中文字幕中文字幕一区| 午夜欧美视频在线观看| 国产乱人伦偷精品视频不卡 | 粉嫩aⅴ一区二区三区四区| 91麻豆国产福利精品| 这里是久久伊人| 久久蜜桃香蕉精品一区二区三区| 色先锋aa成人| 欧美不卡一区二区三区| 综合网在线视频| 亚洲超丰满肉感bbw| 蜜桃视频第一区免费观看| 波多野结衣亚洲| 91精品国产高清一区二区三区蜜臀 | 99这里都是精品| 欧美一二三区在线观看| 亚洲丝袜制服诱惑| 久草中文综合在线| 91精彩视频在线观看| 日韩欧美一卡二卡| 亚洲人亚洲人成电影网站色| 久久精品国产一区二区三| 99精品国产热久久91蜜凸| 欧美成人免费网站| 亚洲老司机在线| 国产成人av在线影院| 欧美情侣在线播放| 亚洲欧美综合另类在线卡通| 久久国产福利国产秒拍| 91豆麻精品91久久久久久| 久久久.com| 日本成人中文字幕| 色狠狠av一区二区三区| 国产亚洲1区2区3区| 天堂久久久久va久久久久| av成人免费在线观看| 精品理论电影在线观看| 亚洲国产日韩a在线播放性色| 风间由美一区二区三区在线观看| 日韩欧美亚洲国产另类| 亚洲成精国产精品女| 99精品黄色片免费大全| 国产亚洲精品aa| 蜜臀av在线播放一区二区三区| 91成人在线精品| 中文字幕字幕中文在线中不卡视频| 国产毛片精品国产一区二区三区| 欧美精品亚洲二区| 午夜精品久久久久影视| 色网站国产精品| 亚洲欧美另类图片小说| 成人国产精品免费观看动漫| 国产亚洲精品资源在线26u| 蜜桃av噜噜一区| 69堂国产成人免费视频| 亚洲国产wwwccc36天堂| 日本乱人伦一区| 亚洲精品五月天| 一本色道久久综合亚洲aⅴ蜜桃| 中文字幕一区在线观看视频| 成人一区二区三区中文字幕| 久久精品一级爱片| 国产成人在线视频免费播放| 久久精品亚洲乱码伦伦中文| 国产露脸91国语对白| 久久一区二区三区国产精品| 国产一区二区在线电影| 久久午夜电影网| 福利一区福利二区| 欧美国产精品一区| 91在线观看成人| 一区二区三区**美女毛片| 在线观看国产91| 视频在线在亚洲| 91精品国产综合久久福利软件 | 一区二区三区中文在线| 欧美午夜在线观看| 天天影视色香欲综合网老头| 日韩欧美一区二区三区在线| 久久99精品久久久久久久久久久久| 精品国产91乱码一区二区三区 | 99久久综合国产精品| 亚洲精选免费视频| 欧美日韩成人在线一区| 久久成人麻豆午夜电影| 久久久精品中文字幕麻豆发布| 成人免费视频国产在线观看| 亚洲日本韩国一区| 欧美精品三级日韩久久| 激情综合色播五月| 国产精品视频免费| 欧美色视频在线观看| 精品影视av免费| 亚洲欧洲国产日本综合| 欧美性极品少妇| 国产制服丝袜一区| 亚洲女人的天堂| 日韩视频中午一区| 成人国产亚洲欧美成人综合网| 亚洲永久精品大片| 久久影院午夜论| 一本大道久久a久久精品综合| 日韩中文字幕91| 国产精品夫妻自拍| 欧美日韩国产首页在线观看| 国产一区二区三区四区五区入口| 国产精品国产三级国产aⅴ中文 | 欧美一区二区三区白人| 成人免费视频一区| 亚洲aaa精品| 欧美激情一区二区三区四区| 在线一区二区三区做爰视频网站| 蜜臀久久久99精品久久久久久| 欧美国产成人精品| 777a∨成人精品桃花网| jvid福利写真一区二区三区| 奇米精品一区二区三区在线观看| 国产精品国产自产拍高清av| 91精品国产综合久久精品图片 | 国产91色综合久久免费分享| 亚洲二区在线视频| 日本一区免费视频| 日韩欧美在线影院| 欧美性受xxxx| 成人激情综合网站| 精品一区二区三区免费| 偷拍与自拍一区| 亚洲精品大片www| 国产日韩v精品一区二区|