📄 book_text10.htm
字号:
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">}<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">这其中</SPAN><SPAN
lang=EN-US>pInfo_>SetMaxPage((Recnumber+4)/5)</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">用来设置打印的最大页数。</SPAN><SPAN
lang=EN-US>Recnumber </SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">是我们通过访问数据库计算出来的记录条数。我们前面说过,每五条记录分一页,(</SPAN><SPAN
lang=EN-US>Recnumber+4</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">)</SPAN><SPAN
lang=EN-US>/5</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">就可以得到页数。</SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US style="mso-spacerun: yes">
</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">下面是</SPAN><SPAN
lang=EN-US>OnBeginPrinting</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">中的代码</SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">m_bPrintEnd=false;<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">StuRecSet_>MoveFirst();<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">if
(StuRecSet_>IsEOF())<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 20pt; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">m_bPrintEnd=true;<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 20pt; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US>m_bPrintEnd</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">是我们往</SPAN><SPAN
lang=EN-US>CPrintView </SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">类中添加的一个用来指示是否该结束打印的成员。</SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">void
CPrintView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
<O:P></O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">{<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black"><SPAN
style="mso-tab-count: 1">
</SPAN>CScrollView::OnPrepareDC(pDC, pInfo);<O:P> </O:P></SPAN></P>
<P class=MsoNormal style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black"><SPAN
style="mso-tab-count: 1"> </SPAN>// TODO: Add your
specialized code here and/or call the base class<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black"><SPAN
style="mso-tab-count: 1"> </SPAN>if
(pInfo!=NULL)<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN
style="mso-spacerun: yes">
</SPAN>pInfo_>m_bContinuePrinting=!m_bPrintEnd;<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">}<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 20pt; mso-line-height-alt: 1.3pt"><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">上面是虚函数</SPAN><SPAN
lang=EN-US>OnPrepareDC</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">中的代码,注意</SPAN><SPAN
lang=EN-US>if<SPAN style="mso-spacerun: yes">
</SPAN>(pInfo!=NULL) </SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">的判断,我们要识别是否是为打印做准备。</SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 20pt; mso-line-height-alt: 1.3pt"><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">下面是最重要的</SPAN><SPAN
lang=EN-US>OnPrint</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">中的代码:</SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">void
CPrintView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
<O:P></O:P></SPAN></P>
<P class=MsoNormalIndent
style="TEXT-INDENT: 0cm; mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">{<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">//
TODO: Add your specialized code here and/or <O:P></O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">//call
the base class<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">int
Curpage=pInfo_>m_nCurPage;<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">StuRecSet_>SetAbsolutePosition((Curpage_1)*5);<O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black"> <O:P>
</O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">//Assume
to print 5 records every page<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black"><SPAN
style="mso-spacerun: yes"> </SPAN>TEXTMETRIC
tm;<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">int
nColumnWidth[4];<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black">int
i,j;<O:P> </O:P></SPAN></P>
<P class=MsoNormalIndent style="mso-line-height-alt: 1.3pt"><SPAN
lang=EN-US
style="BACKGROUND: #d9d9d9; FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-shading: white; mso-pattern: gray-15 black"><SPAN
style="mso-tab-count: 1">
</SPAN>pDC_>SetMapMode(MM_TWIPS);<O:P> </O:P></SPAN></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -