Using VC ++ to develop the printed program obtained

zhaozj2021-02-17  49

The printing method you have obtained by using VC developed the printing process you have learned, the reader has developed its own printed print procedures, as long as the Windows font size and understand the onDraw function The work you should do in the onPrint function can make a more satisfactory program, the following is the steps of the program generated: (1) Use AppWizard to create a PRT-view. Note: 1. CLT-VIEWDOC classes in Class Document in Classes are changed to CSONGDOC classes, prtvdoc. H and PRTVDOC. CPP is changed to SongDoc. H and songdoc. CPP; depending on the VIEW of PRTVVW. H and PRTVVW. CPP is changed to SONGVW, respectively. H and songvw. CPP (the purpose of doing this is to make the program's readability better because the content we have to print is a lyrics); in addition, Songvw will be The base class of the CPP is changed to a CScrollView class with a scroll bar. 2. Select the Printing and Pre -view option in the Option selection. (2) Use ClassWizard to join the WM-CREATE message control function for the CSONGVW class.

(3) Open SongDoc. H file, join public: cstringArray m-songArray; (4) Open SongDoc. CPP file, add the following block in the on -NewDocument function: 1 Bool CsongDoc :: OnNewDocument () 2 {3 if (! cdocument :: onnewdocument ()) 4 Return False; 5 m-songArray. Setsize (13); 6 m-songArray [0] = "Tell Me How Way"; 7 m-songArray [1] = "just to be strong"; 8 m-songArray [2] = "We Talk Through the Night"; 9 m-songArray [3] = "But Never Reach the other side"; 10 m-songArray [4] = "We Fill Our Lives"; 11 m-songArray [5] = "when All this we need, 12 m-songArray [6] = "When Will We Find, Our Way Out of the Dark"; 13 m-songArray [7] = "chorus:" 14 m-songArray [8] = "We know That"; 15 m-songArray [9] = "love is the power, love is the key"; 16 m-songArray [10] = "Love is the reason, it believe"; 17 M-SongArray [11] = "Love is the answer, when wee we see"; 18 m-songArray [12] = "Love is the power, love is the power,"; 19 return true;} 20 void CsongDoc :: M-SongArray, Serialize (CARCHIVE & AR). Serialize (AR):

} (5) Open Songvw. CPP, because we use scroll windows, you must set the size of the visible window, the size of the page. Delete the contents of the ONLNIALUPDATE function.

Add 1 int CSongView :: OnCreate (LPCREATESTRUCT lpCreate Struct) 2 {if (CScrollView :: OnCreate (lpCreateStruct) == - 1) in function OnCreate 3 return -1; 4 CSize totalSize = CSize (11520,15120); 5 CSize PageSize = csize (totalsize.cx/2); 6 csize linesize = csize (Totalsize.cx/100, TOLSIZE.CY/100); 7 setscrollsizes (MM-Twips, Totalsize, Pagesize, LINSIZE); 8 return 0;} Add the following blocks in the onDraw function: 1 void csongview :: OnDraw (CDC * PDC) 2 {INT I, J, NHEIGHT; 3 CHAR TEMP [33]; 4 cfont font; 5 TextMetricTM; 6 CSONGDOC * PDOC = getDocument (); 7 PDC-> Moveto (cpoint (0, 0)); 8 PDC-> Lineto (CPOINT (11505, 0)); 9 PDC-> Lineto (CPOINT (11505, -15105)) 10 PDC-> LineTo (CPOINT (0, -15105)); 11 PDC-> LineTo (CPOINT (0, 0)); 12 // Draw External Frame of Article13 for (i = 0; i <= 8; i = I 1) {14 WSPrintf (Temp, "% 02D", I); 15 PDC-> Textout (i * 1440, 0, temp);} 16 for (i = 0; i <= 10; i )

转载请注明原文地址:https://www.9cbs.com/read-28843.html

New Post(0)