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

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

?? apc.htm

?? VisualC21天自學教程.rar 英文經(jīng)典教程
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
</PRE><P>The first thing you'll notice that's different from OnDraw() is the second parameter,the pointer to a CPrintInfo object pInfo. This is where you'll find the details aboutthe current print, specifically the rectangle coordinates for the printer devicecontext you require. There are lots of useful CPrintInfo member variables. Some ofthese are shown in Table C.1.</P><P><H4>TABLE C.1.&nbsp;&nbsp;CPrintInfo MEMBER VARIABLES SPECIFIC TO PRINT INFORMATION.</H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT"><I>Variable Name</I></TD>		<TD ALIGN="LEFT"><I>Description of Contents</I></TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_nCurPage		</TD>		<TD ALIGN="LEFT">The current page number for multipage prints		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_nNumPreviewPages		</TD>		<TD ALIGN="LEFT">Either 1 or 2, depending on the preview pages shown		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_rectDraw		</TD>		<TD ALIGN="LEFT">The coordinates of the print page rectangle		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_pPD		</TD>		<TD ALIGN="LEFT">Pointer to a CPrintDialog class if the Print dialog box is used		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_bDirect		</TD>		<TD ALIGN="LEFT">TRUE if the Print dialog box has been bypassed		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_bPreview		</TD>		<TD ALIGN="LEFT">TRUE if currently in print preview		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_strPageDesc		</TD>		<TD ALIGN="LEFT">A format string to help generate the page number		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">m_lpUserData		</TD>		<TD ALIGN="LEFT">A pointer that can be used to hold user data		</TD>	</TR></TABLE></P><P>Some other member variables in CPrintInfo are covered later in this chapter, butfirst you'll need to find the printing rectangle coordinates rather than the window'srectangle. The m_rectDraw member holds the coordinate rectangle of the current printpage. You can use these coordinates with the printer device context in the OnDraw()function. There is a problem though, in that this structure isn't passed to the OnDraw(),but you can copy the coordinates into a member variable held in your CPrintItViewclass.</P><P>Add the following lines to store the rectangle after the // TODO comment, butbefore the CView::OnPrint() call:</P><P><PRE>// ** copy the print rectangle from the pInfo    if (pInfo) m_rcPrintRect = pInfo-&gt;m_rectDraw;</PRE><P>This will store the printing rectangle in the m_rcPrintRect member of the CPrintItViewclass. You must therefore declare this member variable, which is easily done by right-clickingthe CPrintItView class in the ClassView pane of the Project Workspace view and choosingthe Add Member Variable<B> </B>option. The Variable Type<B> </B>is a CRect, and thedeclaration is obviously m_rcPrintRect. Access should be private because you don'tneed or want any other classes to know about this internal rectangle.</P><P><H3><A NAME="Heading5"></A>Using the Printer Device Context</H3><P>The device context passed to OnPrint() differs slightly from the display contextin that it may have fewer colors and is probably larger that your display. Otherthan these attributes, you can use it to draw in exactly the same way as the screendevice context. This is how you can use the same OnDraw() to print as well as viewin a window. The base class call CView::OnPrint() implements code that does exactlythis.</P><P>The device context holds a flag that you can interrogate via the IsPrinting()function to determine whether you are drawing to a screen-based device context ora printer-based device context. You might use this difference to change the printedoutput from the screen output, or more subtly to adjust the coordinates used to producethe printed output.</P><P>For the sample program it only remains to use the m_rcPrintRect coordinates whenprinting in the OnDraw() function. The code necessary to use the IsPrinting() functionto determine whether the window's client rectangle or the printer's rectangle shouldbe used is shown in Listing C.2. The output produced is shown by the print previewin Figure C.2.</P><P><H4>LISTING C.2.&nbsp;LST23_2.CPP--ADDING PRINTING RECTANGLE SUPPORT TO THE STANDARDOnDraw() IMPLEMENTATION.</H4><PRE>1:  // Declare a client rectangle2:  CRect rcClient;3:4:  // ** Check the device context for printing mode5:  if (pDC-&gt;IsPrinting())6:  {7:      // ** Printing, so use the print rectangle8:      rcClient = m_rcPrintRect;9:  }10:  else11:  {12:      // ** Not printing, so client rect will do13:      GetClientRect(&amp;rcClient);14:  }15:16:  // Convert to logical units17:  pDC-&gt;DPtoLP(&amp;rcClient);</PRE><P>Notice in Listing C.2 that an if statement is used in line 5 to call the devicecontext's IsPrinting() function. This function returns TRUE if this is a printerdevice context (or preview) and FALSE for any other device contexts. In the printingcase, you can assign the stored print page rectangle to rcClient, as shown in line8. In the normal screen window case you can just use the standard GetClientRect()to find the window's rectangle, as shown in line 13.</P><P>Because you've used a mapping mode, you must convert both printing and displayrectangle coordinates from device units to logical units. This is done by the DPtoLP()function in line 17. If you change and add lines 4-14 to your existing OnDraw() functionand then build and run the application, you should be able to run the print previewas before, with better results (see Figure C.2).</P><P><A HREF="javascript:popUp('23fig02.gif')"><B>FIGURE C.2.</B></A><B> </B><I>Printpreview using the full print page rectangle coordinates.</I></P><P><I></I><H3><A NAME="Heading6"></A>Maintaining the Aspect Ratio</H3><P>As you can see from Figure C.2, because the paper is much longer and thinner thanthe window, the printed output becomes stretched. The relationship between the widthand the height is the aspect ratio<I>.</I> To stop the image from stretching oneway or another, you must keep the same aspect ratio as the image in the window. Thecode in Listing C.2 doesn't try to maintain aspect ratios, which isn't very satisfactoryin most cases, so you would need to add some code to maintain the aspect ratio ofthe printed output.</P><P>The best tactic to use in this case is to find out whether setting either thewidth or the height to the full width or height of the paper will give maximum coverageand then shorten the other dimension to maintain the aspect ratio.</P><P>To do this, you need some information about the paper dimensions and its own aspectratio. There is a device context function that retrieves these details (and manymore) named GetDeviceCaps(). By passing the ASPECTX or ASPECTY flags to GetDeviceCaps(),you can find the relationship between the width of a pixel and its height. If therelationship is 1:1 the pixel is square; otherwise, it is oblong and might differfrom the screen's own aspect ratio. If it differs, you can decide which axis willgive you the largest image, while maintaining the same aspect ratio as the screen.That way you can avoid a stretched looking image.</P><P>Code that does just that in the OnDraw() function is demonstrated in Listing C.3.</P><BLOCKQUOTE>	<P><HR><B>DEVICE ASPECT RATIOS</B><BR>	</P>	<P>For most printers, you'll probably find that the aspect ratio is 1:1. But if you	look closely at thermal printer output like those in fax machines, you can see a	very distinctive aspect ratio difference in their pixels.<HR></BLOCKQUOTE><H4>LISTING C.3.&nbsp;&nbsp;LST23_3.CPP--MAINTAINING THE ASPECT RATIO WHILE PRODUCINGTHE LARGEST PRINTED REPRESENTATION.</H4><PRE>1:  //** Declare a client rectangle and get the client rect2:  CRect rcClient;3:  GetClientRect(&amp;rcClient);4:5:  // ** Check the device context for printing mode6:  if (pDC-&gt;IsPrinting())7:  {8:    // ** Find the Print width : Window width ratio9:    double dWidthRatio=(double)m_rcPrintRect.Width()/10:                            (double)rcClient.Width();11:12:    // ** Find the Print height : Window height ratio13:    double dHeightRatio=(double)m_rcPrintRect.Height()/14:                            (double)rcClient.Height();15:16:    // ** Calculate the device's aspect ratio17:    double dAspect=(double)pDC-&gt;GetDeviceCaps(ASPECTX)/18:                   (double)pDC-&gt;GetDeviceCaps(ASPECTY);19:20:    // ** Find the new relative height21:    int nHeight=(int)(rcClient.Height() *22:                     dWidthRatio * dAspect );23:24:    // ** Find the new relative width25:    int nWidth=(int)(rcClient.Width() *26:                     dHeightRatio * (1.0 / dAspect) );27:28:    // ** Set the whole rectangle29:    rcClient=m_rcPrintRect;30:31:    // ** Determine the best fit across or down the page32:    if (nHeight &gt; nWidth)33:    {34:        // ** Down is best, so adjust the width35:        rcClient.BottomRight().x=36:            m_rcPrintRect.TopLeft().x + nWidth;37:    }38:    else39:    {40:        // ** Across is best, so adjust the height41:        rcClient.BottomRight().y=42:            m_rcPrintRect.TopLeft().y + nHeight;43:    }44:  }45:46:  // Convert to logical units47:  pDC-&gt;DPtoLP(&amp;rcClient);</PRE><P>Notice that both the screen window and printed case use the window coordinatesthat are found from the GetClientRect() in line 3. In the onscreen window case, nothingelse is done and the code continues as normal.</P><P>However, a lot now happens when printing, if the IsPrinting() test in line 6 returnsTRUE. First, you must find the ratios of the window width to the paper width andthe window height to the paper height. You can find these ratios as shown in lines9 and 13 by dividing the paper dimensions by the window dimensions.</P><P>The next thing you must calculate is the device's own aspect ratio peculiarities.You can use the GetDeviceCaps() function in line 17 to find the ratio of width toheight in the device itself and store the result in dAspect.</P><P>Using these values, you can now calculate the device's comparative width and heightcoordinates in terms of the opposing window dimension, as shown in lines 21 and 25.This calculation, which includes the device aspect ratio for each dimension, willyield the adjusted height for the full page width or vice versa. Now you must decidewhether you can best fit the full width or height of a page and adjust the otherdimension. The condition on line 32 makes this decision based on the bigger widthor height. This means that if you have a tall, thin window, it is better to use thefull height of the paper and adjust the width; conversely, if you have a short, widewindow, it is better to use the full width and adjust the height. Depending on whatis better, the adjustment is made on line 35 or 42 by setting the bottom-right point'sx- or y-coordinate to the adjusted width or height.</P><P>Notice that all the other dimensions are set to rcClient from the paper in theassignment on line 29, so the adjustment is the only change required. After thissection, the program continues and will use the adjusted rectangle to do its drawing.</P><P>If you build and run the application after adding the lines in Listing C.3 tothe OnDraw() function, you should see that printing or previewing the window willnow maintain the same aspect ratio as the onscreen window. If you stretch the windowto make it higher than it is wide, the printed output will use the full height ofthe page rather than the full width, but still maintain the correct aspect ratios.</P><P><H2><A NAME="Heading7"></A>Pagination and Orientation</H2><P>Printing a single page to represent the view in a window is a common requirement,but largely the printing process is concerned with printing large and complex multipagedocuments from the user's sophisticated data. The framework comes to the rescue againand simplifies this process by providing a common Print Setup dialog box and a pageenumeration system to print and preview the specified range of pages.</P><P><H3><A NAME="Heading8"></A>Setting the Start and End Pages</H3><P>The first considerations for a multipage document are the start and end pages,which also indicate how many pages you are going to print. A framework virtual functionin the view class is called first when printing begins. This function is OnPreparePrinting()and it supplies one parameter, the CPrintInfo object pInfo. This is the first timeyou'll see the CPrintInfo, and this is where you can first change it to customizethe print to your requirements. The OnPreparePrinting() function is supplied automaticallyfrom the AppWizard when you create the SDI, so you don't have to add it yourself.You can see the default implementation by double-clicking the OnPreparePrinting()member of the CPrintItView class in the ClassView pane.</P><P>It should look like this:</P><P><PRE>BOOL CPrintItView::OnPreparePrinting(CPrintInfo* pInfo){    // default preparation    return DoPreparePrinting(pInfo);}</PRE><P>By default, the DoPreparePrinting() function is called and passed the pInfo pointerto the CPrintInfo object for the print. DoPreparePrinting() sets up the requireddevice context and calls the standard Print dialog box if you are printing (not previewing).This dialog box is covered in more detail in the next section, but first you canset up a range of pages to print by modifying the CPrintInfo object before the DoPreparePrinting().</P><P>To do this, add the following lines before the // default preparation comment:</P><P><PRE>pInfo-&gt;SetMinPage(2);    pInfo-&gt;SetMaxPage(8);</PRE><P>These two member functions of the CPrintInfo class will modify the CPrintInfoobject pointed at by pInfo to set the starting page at page 2 via SetMinPage() andthe ending page at page 8 via SetMaxPage().</P><P>Now when the document is printed, the OnPrint() function will be called six times.The only difference between each of these calls will be the pInfo-&gt;m_nCurPagemember variable that will hold the current page as it iterates between 2 and 8.</P><P>Depending on the kind of application you write, the technique you'll use to determinethe number of pages will vary. If you are selling music compact discs and want toprint a brochure of your product range, you would probably fit the cover pictureand review of each CD on one printed page, so if you sell 120 different CDs, you

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美电影免费观看高清完整版在 | 精品视频1区2区| 日韩av电影免费观看高清完整版 | 亚洲欧美日韩小说| 日韩精品中文字幕一区二区三区 | 欧美日韩中文另类| 国产高清不卡一区二区| 日韩精品亚洲一区二区三区免费| 中文字幕一区二区三区av| 精品国产欧美一区二区| 欧美日韩在线精品一区二区三区激情| 国产福利精品一区| 日本vs亚洲vs韩国一区三区二区 | 精品精品国产高清a毛片牛牛| 欧美日韩国产不卡| 99国产精品视频免费观看| 极品美女销魂一区二区三区| 亚洲h精品动漫在线观看| 国产精品不卡在线| 久久久综合九色合综国产精品| 欧美日韩不卡一区| 色妞www精品视频| 成人精品鲁一区一区二区| 精品一区二区三区免费视频| 午夜精品免费在线| 亚洲一区二区黄色| 亚洲欧美国产三级| 亚洲欧美综合色| 国产精品欧美一级免费| 国产午夜精品美女毛片视频| 精品处破学生在线二十三| 日韩一区二区三区精品视频| 欧美日韩亚洲综合一区| 在线亚洲精品福利网址导航| 9人人澡人人爽人人精品| 国产v综合v亚洲欧| 国产69精品久久99不卡| 国产一区二区成人久久免费影院 | 欧美日韩免费观看一区三区| 91福利区一区二区三区| 色哟哟精品一区| 一本久久a久久精品亚洲| 色天天综合色天天久久| 91官网在线免费观看| 在线观看91精品国产入口| 在线观看www91| 5858s免费视频成人| 欧美一区二区免费视频| 欧美一个色资源| 久久久亚洲精品一区二区三区 | 欧美激情在线一区二区| 国产色婷婷亚洲99精品小说| 国产欧美一区二区精品性| 日本一区二区三区久久久久久久久不| 久久精品夜色噜噜亚洲a∨| 欧美国产禁国产网站cc| 亚洲欧美中日韩| 亚洲国产wwwccc36天堂| 日本系列欧美系列| 国产激情视频一区二区在线观看 | 成人小视频免费在线观看| jlzzjlzz国产精品久久| 欧美亚洲一区三区| 日韩女优电影在线观看| 国产区在线观看成人精品| 椎名由奈av一区二区三区| 亚洲一区二区3| 国内成人免费视频| 日韩欧美中文字幕制服| 精品99一区二区三区| 中文字幕亚洲电影| 午夜视频一区二区三区| 久久国产精品99久久人人澡| 国产成人av一区| 在线观看成人小视频| 日韩欧美一区二区视频| 日本一区二区三级电影在线观看 | 99久久伊人精品| 欧美日韩一区二区三区高清| 欧美成人精品福利| 中文字幕一区二区三| 日精品一区二区| 国产成人精品亚洲777人妖 | 欧美日韩mp4| 国产天堂亚洲国产碰碰| 亚洲成av人**亚洲成av**| 国产裸体歌舞团一区二区| 99re热这里只有精品视频| 欧美一区二区三区啪啪| 中文字幕在线观看一区二区| 日韩—二三区免费观看av| av在线不卡观看免费观看| 欧美一区二区三区白人| 亚洲另类在线视频| 国产夫妻精品视频| 日韩欧美国产麻豆| 一区二区三区在线观看国产| 国产乱人伦精品一区二区在线观看| 91高清在线观看| 国产欧美日韩亚州综合| 人人爽香蕉精品| 日本韩国欧美三级| 国产精品免费aⅴ片在线观看| 秋霞影院一区二区| 欧美日韩中文精品| 亚洲人成电影网站色mp4| 国产成a人无v码亚洲福利| 日韩欧美的一区二区| 亚洲一区精品在线| jiyouzz国产精品久久| 久久久99精品免费观看不卡| 日韩成人免费在线| 欧美三级视频在线| 亚洲黄色小视频| 99在线视频精品| 日本一区二区三区免费乱视频 | 一区二区三区久久| 成人在线一区二区三区| 久久一区二区三区四区| 日本不卡不码高清免费观看| 欧美视频三区在线播放| 一区二区日韩av| 91浏览器打开| 亚洲日本在线天堂| 91老师片黄在线观看| 国产精品麻豆欧美日韩ww| 国产91高潮流白浆在线麻豆| 久久久久成人黄色影片| 国产酒店精品激情| 2欧美一区二区三区在线观看视频| 日韩综合一区二区| 91精品在线观看入口| 视频一区欧美精品| 欧美高清激情brazzers| 亚洲成a人v欧美综合天堂 | 欧美三级乱人伦电影| 亚洲一区二区三区小说| 欧美午夜一区二区三区免费大片| 亚洲三级理论片| 欧美色网一区二区| 图片区小说区国产精品视频| 91精品国产色综合久久| 蜜臀av性久久久久蜜臀aⅴ流畅 | 成人欧美一区二区三区黑人麻豆| 成人av网站在线| 日韩理论片中文av| 在线视频一区二区三区| 性感美女久久精品| 日韩欧美三级在线| 国产剧情一区在线| 一区精品在线播放| 91论坛在线播放| 日韩精品乱码免费| 久久美女高清视频| 91亚洲国产成人精品一区二区三 | 欧美国产亚洲另类动漫| 91小视频在线| 图片区日韩欧美亚洲| 欧美zozozo| 91香蕉视频黄| 日本美女视频一区二区| 久久综合狠狠综合久久综合88| 床上的激情91.| 亚洲成人在线免费| 精品福利av导航| 色哟哟精品一区| 另类专区欧美蜜桃臀第一页| 国产婷婷一区二区| 欧美日韩在线播| 精品在线视频一区| 樱花影视一区二区| 欧美精品一区二区在线播放| 97精品电影院| 久久精品999| 亚洲欧洲日韩一区二区三区| 欧美丰满嫩嫩电影| 成人av网站在线观看| 视频一区二区三区中文字幕| 国产欧美久久久精品影院| 欧美日韩一卡二卡| 成人蜜臀av电影| 午夜电影网亚洲视频| 国产午夜精品一区二区三区嫩草| 欧美少妇一区二区| 国产成人免费高清| 日韩精品免费专区| 最新国产成人在线观看| 欧美va在线播放| 欧美综合天天夜夜久久| 国产精品自拍毛片| 日韩电影在线一区二区三区| 中文字幕在线不卡视频| 日韩女优av电影| 欧美色综合网站| 99在线精品免费| 精品一区二区三区蜜桃| 亚洲影视资源网| 亚洲视频一区在线| 欧美国产日韩精品免费观看| 欧美一区二区高清|