#0130 }
#0131
#0132 CStroke::CStroke(UINT nPenWidth)
#0133 {
#0134 m_nPenWidth = nPenWidth;
#0135 m_rectBounding。SetRectEmpty();
#0136 }
#0137
#0138 void CStroke::Serialize(CArchive& ar)
#0139 {
#0140 if (ar。IsStoring())
#0141 {
#0142 ar m_rectBounding;
#0149 WORD w;
#0150 ar 》》 w;
#0151 m_nPenWidth = w;
#0152 m_pointArray。Serialize(ar);
#0153 }
#0154 }
#0155
#0156 BOOL CStroke::DrawStroke(CDC* pDC)
#0157 {
#0158 CPen penStroke;
#0159 if (!penStroke。CreatePen(PS_SOLID; m_nPenWidth; RGB(0;0;0)))
#0160 return FALSE;
#0161 CPen* pOldPen = pDC…》SelectObject(&penStroke);
#0162 pDC…》MoveTo(m_pointArray'0');
#0163 for (int i=1; i 《 m_pointArray。GetSize(); i++)
#0164 {
#0165 pDC…》LineTo(m_pointArray'i');
#0166 }
#0167
#0168 pDC…》SelectObject(pOldPen);
#0169 return TRUE;
#0170 }
890
…………………………………………………………Page 953……………………………………………………………
附錄B Scribble Step5 完整原始碼
#0171 void CScribbleDoc::OnEditClearAll()
#0172 {
#0173 DeleteContents();
#0174 SetModifiedFlag(); // Mark the document as having been modified; for
#0175 // purposes of confirming File Close。
#0176 UpdateAllViews(NULL);
#0177 }
#0178
#0179 void CScribbleDoc::OnPenThickOrThin()
#0180 {
#0181 // Toggle the state of the pen between thin or thick。
#0182 m_bThickPen = !m_bThickPen;
#0183
#0184 // Change the current pen to reflect the new user…specified width。
#0185 ReplacePen();
#0186 }
#0187
#0188 void CScribbleDoc::ReplacePen()
#0189 {
#0190 m_nPenWidth = m_bThickPen? m_nThickWidth : m_nThinWidth;
#0191
#0192 // Change the current pen to reflect the new user…specified width。
#0193 m_penCur。DeleteObject();
#0194 m_penCur。CreatePen(PS_SOLID; m_nPenWidth; RGB(0;0;0)); // solid black
#0195 }
#0196
#0197 void CScribbleDoc::OnUpdateEditClearAll(CCmdUI* pCmdUI)
#0198 {
#0199 // Enable the mand user interface object (menu item or tool bar
#0200 // button) if the document is non…empty; i。e。; has at least one stroke。
#0201 pCmdUI…》Enable(!m_strokeList。IsEmpty());
#0202 }
#0203
#0204 void CScribbleDoc::OnUpdatePenThickOrThin(CCmdUI* pCmdUI)
#0205 {
#0206 // Add check mark to Draw Thick Line menu item; if the current
#0207 // pen width is 〃thick〃。
#0208 pCmdUI…》SetCheck(m_bThickPen);
#0209 }
#0210
#0211 void CScribbleDoc::OnPenWidths()
#0212 {
#0213 CPenWidthsDlg dlg;
#0214 // Initialize dialog data
#0215 dlg。m_nThinWidth = m_nThinWidth;
#0216 dlg。m_nThickWidth = m_nThickWidth;
891
…………………………………………………………Page 954……………………………………………………………
第五篇 附錄
#0217
#0218 // Invoke the dialog box
#0219 if (dlg。DoModal() == IDOK)
#0220 {
#0221 // retrieve the dialog data
#0222 m_nThinWidth = dlg。m_nThinWidth;
#0223 m_nThickWidth = dlg。m_nThickWidth;
#0224
#0225 // Update the pen that is used by views when drawing new strokes;
#0226 // to reflect the new pen width definitions for 〃thick〃 and 〃thin〃。
#0227 ReplacePen();
#0228 }
#0229 }
#0230
#0231 void CStroke::FinishStroke()
#0232 {
#0233 // Calculate the bounding rectangle。 It"s needed for smart
#0234 // repainting。
#0235
#0236 if (m_pointArray。GetSize()==0)
#0237 {
#0238 m_rectBounding。SetRectEmpty();
#0239 return;
#0240 }
#0241 CPoint pt = m_pointArray'0';
#0242 m_rectBounding = CRect(pt。x; pt。y; pt。x; pt。y);
#0243
#0244 for (int i=1; i 《 m_pointArray。GetSize(); i++)
#0245 {
#0246 // If
小说推荐
- 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章