附錄B Scribble Step5 完整原始碼
#0030 /////////////////////////////////////////////////////////////////
#0031 // CScribbleView construction/destruction
#0032
#0033 CScribbleView::CScribbleView()
#0034 {
#0035 // TODO: add construction code here
#0036
#0037 }
#0038
#0039 CScribbleView::~CScribbleView()
#0040 {
#0041 }
#0042
#0043 BOOL CScribbleView::PreCreateWindow(CREATESTRUCT& cs)
#0044 {
#0045 // TODO: Modify the Window class or styles here by modifying
#0046 // the CREATESTRUCT cs
#0047
#0048 return CView::PreCreateWindow(cs);
#0049 }
#0050
#0051 ////////////////////////////////////////////////////////////////
#0052 // CScribbleView drawing
#0053
#0054 void CScribbleView::OnDraw(CDC* pDC)
#0055 {
#0056 CScribbleDoc* pDoc = GetDocument();
#0057 ASSERT_VALID(pDoc);
#0058
#0059 // Get the invalidated rectangle of the view; or in the case
#0060 // of printing; the clipping region of the printer dc。
#0061 CRect rectClip;
#0062 CRect rectStroke;
#0063 pDC…》GetClipBox(&rectClip);
#0064 pDC…》LPtoDP(&rectClip);
#0065 rectClip。InflateRect(1; 1); // avoid rounding to nothing
#0066
#0067 // Note: CScrollView::OnPaint() will have already adjusted the
#0068 // viewport origin before calling OnDraw(); to reflect the
#0069 // currently scrolled position。
#0070
#0071 // The view delegates the drawing of individual strokes to
#0072 // CStroke::DrawStroke()。
#0073 CTypedPtrList& strokeList = pDoc…》m_strokeList;
#0074 POSITION pos = strokeList。GetHeadPosition();
#0075 while (pos != NULL)
895
…………………………………………………………Page 958……………………………………………………………
第五篇 附錄
#0076 {
#0077 CStroke* pStroke = strokeList。GetNext(pos);
#0078 rectStroke = pStroke…》GetBoundingRect();
#0079 pDC…》LPtoDP(&rectStroke);
#0080 rectStroke。InflateRect(1; 1); // avoid rounding to nothing
#0081 if (!rectStroke。IntersectRect(&rectStroke; &rectClip))
#0082 continue;
#0083 pStroke…》DrawStroke(pDC);
#0084 }
#0085 }
#0086
#0087 /////////////////////////////////////////////////////////////////
#0088 // CScribbleView printing
#0089
#0090 BOOL CScribbleView::OnPreparePrinting(CPrintInfo* pInfo)
#0091 {
#0092 pInfo…》SetMaxPage(2); // the document is two pages long:
#0093 // the first page is the title page
#0094 // the second is the drawing
#0095 BOOL bRet = DoPreparePrinting(pInfo); // default preparation
#0096 pInfo…》m_nNumPreviewPages = 2; // Preview 2 pages at a time
#0097 // Set this value after calling DoPreparePrinting to override
#0098 // value read from 。INI file
#0099 return bRet;
#0100 }
#0101
#0102 void CScribbleView::OnBeginPrinting(CDC* /*pDC*/; CPrintInfo* /*pInfo*/)
#0103 {
#0104 // TODO: add extra initialization before printing
#0105 }
#0106
#0107 void CScribbleView::OnEndPrinting(CDC* /*pDC*/; CPrintInfo* /*pInfo*/)
#0108 {
#0109 // TODO: add cleanup after printing
#0110 }
#0111
#0112 ///////////////////////////////////////////////////////////////
#0113 // CScribbleView diagnostics
#0114
#0115 #ifdef _DEBUG
#0116 void CScribbleView::AssertValid() const
#0117 {
#0118 CScrollView::AssertValid();
#0119 }
#0120
#0121 void CScribbleView::Dump(CDumpContext& dc) const
896
…………………………………………………………Page 959……………………………………………………………
附錄B Scribble Step5 完整原始碼
#0122 {
#0123 CScrollView::Dump(dc);
#0124 }
#0125
#0126 CScribbleDoc* CScribbleView::GetDocument() // non…debug version is inline
#0127 {
#0128 ASSERT(m_pDocument…》IsKindOf(RUNTIME_CLASS(CScribbleDoc)));
#0129 return (CScribbleDoc*)m_pDocument;
#0130 }
#0131 #endif //_DEBUG
#0132
#0133 /////////////////////////////////////////////////////////////////
#0134 // CScribbleView message handlers
#0135
#0136 void CScribbleView::OnLButtonDown(UINT; CPoint point)
#0137 {
#0138 // Pressing the mouse button in the view window starts a new stroke
#0139
#0140 // CScrollView changes the viewport origin and mapping mode。
#0141 // It"s necessary to convert the point from device coordinates
#0142 // to logical coordinates; such as are stored in the document。
#0143 CClientDC dc(this);
#0144 OnPrepareDC(&
小说推荐
- Java编程思想第4版[中文版](PDF格式)
- -Page 1-Page 2《Thinking In Java》中文版作者:Bruce Eckel主页:http/BruceEckel.编译:Trans Bot主页:http/memberease~transbot致谢-献给那些直到现在仍在孜孜不倦创造下一代计算机语言的人们!指导您利用万维网的语言进
- 最新章:第295章
- VB2008从入门到精通(PDF格式英文版)
- -Page 1(R)The eXperT’s Voice inBeginningVB 2008From Novice to ProfessionalChristian Gross-Page 2-Page 3-Beginning VB 2008From Novice to Professional■C
- 最新章:第214章
- oracle从入门到精通(PDF格式)
- -Page 1-Oracle 从入门到精通-Page 2-资源来自网络,仅供学习 Oracle 从入门到精通一、SQL 8
- 最新章:第37章
- C语言游戏编程从入门到精通(PDF格式)
- -Page 1-Page 2-Page 3-Page 4-Page 5-Page 6-Page 7-Page 8-Page 9-Page 10-Page 11-Page 12-Page 13-Page 14
- 最新章:第4章
- 深入浅出
- 《深入浅出》作者:白小骨晋江VIP20140610完结+1番外非V章节总点击数:67370 总书评数:209 当前被收藏数:764 文章积分:11,386,657文案:每个前男友都是女人掉过的坑,从何典阳这个坑里往外爬的梁温暖一脸血表示,何典阳他这个深坑实在太坑爹。何典阳:我是坑?梁温暖…别看我,我
- 最新章:第74章
- 深入浅出[娱乐圈]
- 文案【忠犬影帝攻X傲娇明星受,1V1轻松甜文,前期互相试探,38章在一起后甜甜甜,两人都有细微的变化和成长~这也是我用心构思攻受感情发展的文,但数据有点太惨了,没入V可以全文免费看,还是想求点收藏呀,数据好看点吧,让我开心一下(笑哭.jpg)流量偶像白漾和影帝顾瑜祁关系很僵,传言两人出道时不合而互相
- 最新章:第59章
- JMS简明教程(PDF格式)
- -Page 1-JMS1.1规范中文版卫建军2007‐11‐22-Page 2
- 最新章:第28章
- SQL语言艺术(PDF格式)
- -Page 1-SQLSSQQLL语言艺术内容介绍本书分为12章,每一章包含许多原则或准则,并通过举例的方式对原则进行解释说明。这些例子大多来自于实际案例,对九种SQL经典查询场景以及其性能影响讨论,非常便于实践,为你数据库应用维护人员阅读。资深 SQL 专家 Stéphane Faroult倾力打
- 最新章:第27章
- C语言实例教程(PDF格式)
- -Page 1-前 言Visual C+是开发运行于Windows 95和Windows NT环境下的Win32应用程序的可视化编程工具中最重要的成员之一,它为软件开发人员提供了完整的编辑、编译和调试工具和建立于Win32 API(ApplicationProgramming Interface)基
- 最新章:第143章