﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-apple-随笔分类-编程疑问</title><link>http://www.cppblog.com/apple/category/10389.html</link><description>世上本无事，庸人自扰之！</description><language>zh-cn</language><lastBuildDate>Wed, 29 Apr 2009 20:41:53 GMT</lastBuildDate><pubDate>Wed, 29 Apr 2009 20:41:53 GMT</pubDate><ttl>60</ttl><item><title>画线疑问，请求帮助！</title><link>http://www.cppblog.com/apple/archive/2009/04/28/81378.html</link><dc:creator>明王不动</dc:creator><author>明王不动</author><pubDate>Tue, 28 Apr 2009 15:06:00 GMT</pubDate><guid>http://www.cppblog.com/apple/archive/2009/04/28/81378.html</guid><wfw:comment>http://www.cppblog.com/apple/comments/81378.html</wfw:comment><comments>http://www.cppblog.com/apple/archive/2009/04/28/81378.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/apple/comments/commentRss/81378.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/apple/services/trackbacks/81378.html</trackback:ping><description><![CDATA[
有这两个消息响应函数 <br>void CDrawlineView::OnLButtonDown(UINT nFlags, CPoint point) <br>{ <br>// TODO: Add your message handler code here and/or call default <br><br>CView::OnLButtonDown(nFlags, point); <br><br>p0=p1=point;//已定义的cpoint变量 <br>} <br><br><br>void CDrawlineView::OnMouseMove(UINT nFlags, CPoint point) <br>{ <br>// TODO: Add your message handler code here and/or call default <br>if(nFlags==MK_LBUTTON) <br>{ <br><br>CClientDC dc(this); <br>pDefPen=dc.SelectObject (pPreviewPen); <br>dc.SetROP2(R2_XORPEN);&nbsp;&nbsp;&nbsp;/*它不是设置当前画笔的颜色和屏幕色的组合运算得到的绘图模式，不是只是关于&nbsp;&nbsp; 颜色吗，当没有这句时，鼠标移动画出的线都会保留下来，为什么呢*/<br>dc.MoveTo(p0);&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;//这句和下面一句，当没有，鼠标移动画出的线都会保留下来，当有时，无论怎么 <br>dc.LineTo(p1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; //移 动都只有一条直线， 为什么，我实在是想不明白， <br>p1=point; <br>dc.MoveTo (p0); <br>dc.LineTo (p1); <br>dc.SelectObject (pDefPen); <br>} <br>}<br><br>我看到一个人有说这样的话：<span  style="WORD-SPACING: 0px; FONT: 16px Simsun; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span  style="FONT-SIZE: 14px; LINE-HEIGHT: 26px">再重画一次就擦掉了，两次异或就等于没画。，但不知是为什么。<br>实在是想不明白，向路过的朋友请教一下，不胜感激！</span></span> 
<div><font  size="4"><span  style="font-size: 14px; line-height: 26px;"><br></span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;"><br></span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;">经过我多次翻书，在一本书看到这样的一段话，估且作为暂时的答案吧.</span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;">该方法先将物体的颜色与背景的颜色进行异或运算，用得到的新颜色画物体，这样做造成了有色透明物体浮于背景之上的效果，而一旦在同一位置，用同样的运算，在该区域没有画其他图形的情况下，将同一物体再画一次，却能使背景神奇的复原。</span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;">一个神奇，就OVER啦，</span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;">可以实现自抵消的效果的运算在SETROP2()有三种，</span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;">R2_NOT</span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;">R2_NOTXORPEN</span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;">R2_XORPEN</span></font></div><div><font  size="4"><span  style="font-size: 14px; line-height: 26px;"><br></span></font></div><img src ="http://www.cppblog.com/apple/aggbug/81378.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/apple/" target="_blank">明王不动</a> 2009-04-28 23:06 <a href="http://www.cppblog.com/apple/archive/2009/04/28/81378.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>