﻿<?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>博客园-ULike.NET</title><link>http://www.cnblogs.com/Junhot/</link><description>继续放飞</description><language>zh-cn</language><lastBuildDate>Fri, 25 Jul 2008 06:36:00 GMT</lastBuildDate><pubDate>Fri, 25 Jul 2008 06:36:00 GMT</pubDate><ttl>60</ttl><item><title>Unreal Engine2分析 —— Lineage2骨骼动画</title><link>http://www.cnblogs.com/Junhot/archive/2005/04/07/133141.html</link><dc:creator>Junhot</dc:creator><author>Junhot</author><pubDate>Thu, 07 Apr 2005 05:27:00 GMT</pubDate><guid>http://www.cnblogs.com/Junhot/archive/2005/04/07/133141.html</guid><wfw:comment>http://www.cnblogs.com/Junhot/comments/133141.html</wfw:comment><comments>http://www.cnblogs.com/Junhot/archive/2005/04/07/133141.html#Feedback</comments><slash:comments>19</slash:comments><wfw:commentRss>http://www.cnblogs.com/Junhot/comments/commentRss/133141.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/Junhot/services/trackbacks/133141.html</trackback:ping><description><![CDATA[<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">什么叫光阴似箭？一个季度没发随笔了&#8230;&#8230;为什么呢？因为没有弄出什么东西。唉！学东西难啊。本来想把骨骼动画完全搞清楚之后再发，可是依这种进度，恐怕大半年都出不来。深感游戏不是一个人干的事，要把这些技术都给弄清楚，要多长时间？人生苦短啊。</span></font> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">感慨归感慨，学还是要学的，可是虽说现在已经是信息爆炸的时代，找技术性的文章还真是难。找个四元数的应用中文的基本没有，英文的也是寥寥，大部分都是矩阵。虽说矩阵与四元数可以互换，但是终究还是不同的。</span><span lang="EN-US"><font face="Times New Roman">Unreal Engine</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">中的动画就是使用四元数记录节点的旋转信息的，花了我不少时间去琢磨该如何做，最终还是把四元数转换成了矩阵做变换。</span></font> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">&#160;&#160;&#160; 这两张就是从</span><span lang="EN-US"><font face="Times New Roman">Unreal</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的</span><span lang="EN-US"><font face="Times New Roman">ukx</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">文件中提取的</span><span lang="EN-US"><font face="Times New Roman">MeshAnimate</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的骨骼动画信息。 
<br/></span></font>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><v:shapetype id="_x0000_t75"><v:stroke></v:stroke><v:formulas><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f><v:f></v:f></v:formulas><v:path></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman"><img height="400" hspace="5" src="http://www.cnblogs.com/images/cnblogs_com/junhot/anim01.gif" width="400" align="baseline" /></font></span></span>&#160;<img height="500" hspace="5" src="http://www.cnblogs.com/images/cnblogs_com/junhot/anim02.gif" width="500" align="baseline" /> 
<br/>&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">暗精</span><span lang="EN-US"><font face="Times New Roman">MM</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的</span><span lang="EN-US"><font face="Times New Roman">MeshAnimate</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">中竟然包含多达七十多个动画组，有些光看骨头动都不知道是什么动作，感觉在游戏中没有见过，隐藏的？看下面这张，像不像在跳街舞？ 
<br/></span></font>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&#160;<img height="500" src="http://www.cnblogs.com/images/cnblogs_com/junhot/anim03.gif" width="500" /> 
<br/>&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">动画这部分真是比较难，因为没有现成的资料参考，相关资料也难找。郁闷，不知道什么时候才能把皮也动起来。</span></font> 
</p><img src ="http://www.cnblogs.com/Junhot/aggbug/133141.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41298/" target="_blank">[新闻]SourceForge可正常访问</a>]]></description></item><item><title>Unreal Engine2分析 —— Lineage2模型(二)</title><link>http://www.cnblogs.com/Junhot/archive/2004/12/31/84994.html</link><dc:creator>Junhot</dc:creator><author>Junhot</author><pubDate>Fri, 31 Dec 2004 12:54:00 GMT</pubDate><guid>http://www.cnblogs.com/Junhot/archive/2004/12/31/84994.html</guid><wfw:comment>http://www.cnblogs.com/Junhot/comments/84994.html</wfw:comment><comments>http://www.cnblogs.com/Junhot/archive/2004/12/31/84994.html#Feedback</comments><slash:comments>31</slash:comments><wfw:commentRss>http://www.cnblogs.com/Junhot/comments/commentRss/84994.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/Junhot/services/trackbacks/84994.html</trackback:ping><description><![CDATA[<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">看了一下天堂</span><span lang="EN-US"><font face="Times New Roman">2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的纹理</span><span lang="EN-US"><font face="Times New Roman">Package</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">文件，唔，都是原汁原味的</span><span lang="EN-US"><font face="Times New Roman">DDS</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">格式，稍稍处理一下就可以拿出来了。基本上是</span><span lang="EN-US"><font face="Times New Roman">DXT1</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">和</span><span lang="EN-US"><font face="Times New Roman">DXT3</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">两种。</span></font>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">发现</span><span lang="EN-US"><font face="Times New Roman">Unreal Package</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">中许多重复数据&#8230;&#8230;比如</span><span lang="EN-US"><font face="Times New Roman">IndexBuffer</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">就找到了三组数据：</span></font>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//--------</span><span style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">第一处的<span lang="EN-US">VertexIndex-----------<o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//<span style="mso-tab-count: 3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>int numberIndex = 1476;<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//<span style="mso-tab-count: 3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>int idxoff = 2534531;<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//----------------------------------<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//--------</span><span style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">第二处的<span lang="EN-US">VertexIndex-----------<o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//</span><span style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">与第一处明显不同，为什么呢？为什么要两个地方储存？绘制出来发现多了许多无用的面。<span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//<span style="mso-tab-count: 3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>int numberIndex = 2496;<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//<span style="mso-tab-count: 3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>int idxoff = 2537489;<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//----------------------------------<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//--------</span><span style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">第三处的<span lang="EN-US">VertexIndex---------------------------------------------<o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//</span><span style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">结果与第一处一样，但与前两处存储方式明显不同，排序后的？为什么呢？为什么要三个地方储存！？<span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//</span><span style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">第三处还包含有许多信息&#8230;&#8230;<span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//<span style="mso-tab-count: 3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>int numberIndex = 1476;<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//<span style="mso-tab-count: 3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>int idxoff = 2542490;<o:p></o:p></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-font-kerning: 0pt; mso-hansi-font-family: &#39;Times New Roman&#39;">//----------------------------------<o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">由于初步接触</span><span lang="EN-US"><font face="Times New Roman">3D</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">数据，不清楚是什么原因要存储如此多的重复数据，谁能说明一下？</span></font>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">进一步将天堂</span><span lang="EN-US"><font face="Times New Roman">2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的</span><span lang="EN-US"><font face="Times New Roman">StaticMesh</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">中的</span><span lang="EN-US"><font face="Times New Roman">Vertex</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">按照材质分组，并将</span><span lang="EN-US"><font face="Times New Roman">Vertex UV</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">提取出来，将纹理赋予各组顶点。</span></font>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;"><font size="3">下面是粉刷好的桥：</font></span>
</p><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">world_bridge_S.usx</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: &#39;Times New Roman&#39;">里的</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">world_bridge06</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: &#39;Times New Roman&#39;">：纹理文件：</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">world_bridge_T.utx
<br/><img height="508" src="http://www.cnblogs.com/images/cnblogs_com/junhot/World_Bridge_06_Textured.JPG" width="605" />
<br/>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p>&#160;</o:p></span>
</p><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: &#39;Times New Roman&#39;">从</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Texture</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: &#39;Times New Roman&#39;">来看，天堂</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">2</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: &#39;Times New Roman&#39;">真的做得很细致，许多都画得很精细。比如桥身上那几块突出的砖头：
<br/><img height="256" src="http://www.cnblogs.com/images/cnblogs_com/junhot/testme0.jpg" width="256" />
<br/><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: &#39;Times New Roman&#39;">哪位玩家在玩的时候能去看这些砖块？就算要去看也不一定能看清&#8230;&#8230;没话说。赞！
<br/></span></span></span><img src ="http://www.cnblogs.com/Junhot/aggbug/84994.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41295/" target="_blank">[新闻]2008年7月25日IT博客精选</a>]]></description></item><item><title>Unreal Engine2分析 —— Lineage2模型</title><link>http://www.cnblogs.com/Junhot/archive/2004/12/29/83718.html</link><dc:creator>Junhot</dc:creator><author>Junhot</author><pubDate>Wed, 29 Dec 2004 06:25:00 GMT</pubDate><guid>http://www.cnblogs.com/Junhot/archive/2004/12/29/83718.html</guid><wfw:comment>http://www.cnblogs.com/Junhot/comments/83718.html</wfw:comment><comments>http://www.cnblogs.com/Junhot/archive/2004/12/29/83718.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.cnblogs.com/Junhot/comments/commentRss/83718.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/Junhot/services/trackbacks/83718.html</trackback:ping><description><![CDATA[<font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">最近金庸群侠传</span><span lang="EN-US"><font face="Times New Roman">Online 2.0</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">开始公测了。失望啊&#8230;&#8230;</span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">同样是用</span><span lang="EN-US"><font face="Times New Roman">Unreal Engine2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">，与天堂</span><span lang="EN-US"><font face="Times New Roman">2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的差距怎么就这么大呢？</span><span lang="EN-US"><font face="Times New Roman"> </font></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">于是对中国美工素质感慨万千&#8230;&#8230;虽然程序员也有不可推卸的责任，也可能是为了照顾低端用户吧。但是我</span><span lang="EN-US"><font face="Times New Roman">MM</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">说了：金庸就是没有天堂</span><span lang="EN-US"><font face="Times New Roman">2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">好看！于是她拒绝玩金庸，也不许我玩，哪怕我是基于研究的目的&#8230;&#8230;</span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman">&#160;</font></o:p></span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">闲下心来，想研究一下天堂</span><span lang="EN-US"><font face="Times New Roman">2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">为啥这么好看，于是就打算从它的引擎</span><span lang="EN-US"><font face="Times New Roman">Unreal Engine2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">入手，顺便学习一下Direct3D。找了一堆资料，最有帮助的就是</span><span lang="EN-US"><font face="Times New Roman">UTPT</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">（</span><span lang="EN-US"><font face="Times New Roman">UT Package Tool</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">）了，作者将其分析结果及文档都公开了，有兴趣的人可以去</span><span lang="EN-US"><a href="http://www.acordero.org/"><font face="Times New Roman" color="#800080">http://www.acordero.org/</font></a></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">看看。</span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman">&#160;</font></o:p></span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">用</span><span lang="EN-US"><font face="Times New Roman">UTPT</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">和</span><span lang="EN-US"><font face="Times New Roman">UltraEdit</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">看着一堆十六进制数据，眼花啊&#8230;&#8230;</span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">都变斗鸡了&#8230;&#8230;</span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman">&#160;</font></o:p></span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">还算把一小部分的数据搞清楚了。放松一下，发两张图。 
<br/></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman">
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">用</span><span lang="EN-US">Direct3D</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">中的</span><span lang="EN-US">Mesh</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的</span><span lang="EN-US">VertexBuffer</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">存储顶点位置数据，</span><span lang="EN-US">IndexBuffer</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">存储顶点索引数据，然后用</span><span lang="EN-US">Mesh.</span><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"> </span><span lang="EN-US">DrawSubset</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">将模型显示出来。 
<br/>
<br/></span>
   </p></font></o:p></span>
</p>
<p></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &#39;Times New Roman&#39;">图一：</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体">world_bridge_S.usx</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &#39;Times New Roman&#39;">里的</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体">world_bridge06 
<br/><img height="508" src="http://www.cnblogs.com/images/cnblogs_com/junhot/World_Bridge_06.JPG" width="640" /> 
<br/></span><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体"><o:p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">图二：</span><span lang="EN-US"><font face="Times New Roman">world_bridge_S.usx</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">里的</span></font><span lang="EN-US"><font face="Times New Roman"><font size="3">world_bridge07 
<br/><img height="511" src="http://www.cnblogs.com/images/cnblogs_com/junhot/World_Bridge_07.JPG" width="640" /> 
<br/></font>
       <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">还有一部分数据格式跟</span><span lang="EN-US">UTPT</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">作者文档中的不一致，头疼中&#8230;&#8230;</span></font> 
       </p></font></span>
   </p>
   <p></p></o:p></span>
</p>
<p></p></span></font><img src ="http://www.cnblogs.com/Junhot/aggbug/83718.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41292/" target="_blank">[新闻]微软称Windows 7开发很顺利 IE 8年底上市</a>]]></description></item><item><title>DirectX Sample分析：Framework图形界面中各类的作用及相互关系</title><link>http://www.cnblogs.com/Junhot/archive/2004/12/21/79991.html</link><dc:creator>Junhot</dc:creator><author>Junhot</author><pubDate>Tue, 21 Dec 2004 04:34:00 GMT</pubDate><guid>http://www.cnblogs.com/Junhot/archive/2004/12/21/79991.html</guid><wfw:comment>http://www.cnblogs.com/Junhot/comments/79991.html</wfw:comment><comments>http://www.cnblogs.com/Junhot/archive/2004/12/21/79991.html#Feedback</comments><slash:comments>11</slash:comments><wfw:commentRss>http://www.cnblogs.com/Junhot/comments/commentRss/79991.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/Junhot/services/trackbacks/79991.html</trackback:ping><description><![CDATA[<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">作者：</span><span lang="EN-US"><font face="Times New Roman">Junhot </font></span></font>
</p>
<div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 1pt; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-bottom-alt: solid windowtext .75pt">
   <p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; MARGIN: 0cm 0cm 0pt; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none; mso-border-bottom-alt: solid windowtext .75pt; mso-padding-alt: 0cm 0cm 1.0pt 0cm"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">更新时间：</span><st1:chsdate w:st="on" IsROCDate="False" IsLunarDate="False" Day="21" Month="12" Year="2004"><span lang="EN-US"><font face="Times New Roman">2004-12-21</font></span></st1:chsdate></font> 
   </p>
</div>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体"><o:p>
<br/>
<br/><img height="436" src="http://www.cnblogs.com/images/cnblogs_com/junhot/guiclass.JPG" width="601" /> 
<br/>
<br/>
<br/>
   <table class="MsoTableGrid" cellSpacing="0" cellPadding="0" border="1" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext">
       <tbody>
           <tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #99cc00; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt">
                  <p class="MsoNormal" align="center" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">类</span><span lang="EN-US"><o:p></o:p></span></font> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #99cc00; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt">
                  <p class="MsoNormal" align="center" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">用途</span><span lang="EN-US"><o:p></o:p></span></font> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 1">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">BlendColor</span><span lang="EN-US"><o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">用以管理控件颜色</span><span lang="EN-US" style="FONT-SIZE: 10pt"><o:p></o:p></span> 
                  </p>
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">将控件状态与颜色绑定</span><span lang="EN-US" style="FONT-SIZE: 10pt"><o:p></o:p></span> 
                  </p>
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">例如鼠标移出时的淡出效果</span><span lang="EN-US" style="FONT-SIZE: 10pt"><o:p></o:p></span> 
                  </p>
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">将当前颜色与目标颜色做线性差值，每次颜色的增量根据流逝时间生成</span><span lang="EN-US" style="FONT-SIZE: 10pt"><o:p></o:p></span> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 2">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Control<o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-SIZE: 10pt"><font face="宋体">控件的抽象基类<span lang="EN-US"><o:p></o:p></span></font></span> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 3">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Dialog<o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-SIZE: 10pt"><font face="宋体">界面主体，用以管理界面的各种控件（元素）<span lang="EN-US"><o:p></o:p></span></font></span> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 4">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">DialogResourceManager</span><span lang="EN-US"><o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Dialogs</span><span style="FONT-SIZE: 10pt"><font face="宋体">共享资源管理<span lang="EN-US"><o:p></o:p></span></font></span> 
                  </p>
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">如贴图、字体、</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">device</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">等</span><span lang="EN-US"><o:p></o:p></span> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 5">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Element<o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-SIZE: 10pt"><font face="宋体">控件的组成元素<span lang="EN-US"><o:p></o:p></span></font></span> 
                  </p>
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-SIZE: 10pt"><font face="宋体">如<span lang="EN-US">StaticText</span>只有一个</font></span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Element</span><span lang="EN-US" style="FONT-SIZE: 10pt"><o:p></o:p></span> 
                  </p>
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Button</span><span style="FONT-SIZE: 10pt"><font face="宋体">有两个：鼠标移入前、移入后<span lang="EN-US"><o:p></o:p></span></font></span> 
                  </p>
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">CheckBox</span><span style="FONT-SIZE: 10pt"><font face="宋体">有两个：</font></span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Box</span><span style="FONT-SIZE: 10pt"><font face="宋体">和</font></span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Check</span><span lang="EN-US" style="FONT-SIZE: 10pt"><o:p></o:p></span> 
                  </p>
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-SIZE: 10pt"><font face="宋体">从上篇文章中的控件贴图可以很明显地看出来<span lang="EN-US"><o:p></o:p></span></font></span> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 6">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">ElementHolder<o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-SIZE: 10pt"><font face="宋体">用以管理各类型控件的组成元素</font></span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Element</span><span lang="EN-US" style="FONT-SIZE: 10pt"><o:p></o:p></span> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 7">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">FontNode</span><span lang="EN-US"><o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">用以保存</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Dialog</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">所用的字体</span><span lang="EN-US"><o:p></o:p></span> 
                  </p>
              </td>
           </tr>
           <tr style="mso-yfti-irow: 8; mso-yfti-lastrow: yes">
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">TextureNode</span><span lang="EN-US"><o:p></o:p></span> 
                  </p>
              </td>
              <td vAlign="top" width="284" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 0cm; BORDER-LEFT: #e0dfe3; WIDTH: 213.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">用以保存</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Dialog</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">所用的贴图</span><span lang="EN-US"><o:p></o:p></span> 
                  </p>
              </td>
           </tr>
       </tbody>
   </table>
<br/><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体">Dialog</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &#39;Times New Roman&#39;">、</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体">Control</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &#39;Times New Roman&#39;">、</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体">Element</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &#39;Times New Roman&#39;">与</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体">ElementHolder</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &#39;Times New Roman&#39;">之间的关系</span> 
<br/><img height="369" src="http://www.cnblogs.com/images/cnblogs_com/junhot/dialogelement关系.JPG" width="467" /></o:p></span> 
</p><img src ="http://www.cnblogs.com/Junhot/aggbug/79991.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41291/" target="_blank">[新闻]中国SNS捱过严冬 未来十八个月决定SNS生死</a>]]></description></item><item><title>DirectX Sample分析：Framework中的控件的显示步骤</title><link>http://www.cnblogs.com/Junhot/archive/2004/12/19/79068.html</link><dc:creator>Junhot</dc:creator><author>Junhot</author><pubDate>Sun, 19 Dec 2004 04:17:00 GMT</pubDate><guid>http://www.cnblogs.com/Junhot/archive/2004/12/19/79068.html</guid><wfw:comment>http://www.cnblogs.com/Junhot/comments/79068.html</wfw:comment><comments>http://www.cnblogs.com/Junhot/archive/2004/12/19/79068.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/Junhot/comments/commentRss/79068.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/Junhot/services/trackbacks/79068.html</trackback:ping><description><![CDATA[摘要: 作者：Junhot 更新时间：2004-12-19 &#160; Dialog是Control的容器，所有的Control都必须指定自己的parentDialog。因为Dialog用以控制Control的输入及渲染。 &#160; Control的显示步骤如下： 1、&#160;&#160; Dialog读取dds贴图文件； 2、&#160;&#160; Dialog为每个Element指定贴图的&nbsp;&nbsp;<a href='http://www.cnblogs.com/Junhot/archive/2004/12/19/79068.html'>阅读全文</a><img src ="http://www.cnblogs.com/Junhot/aggbug/79068.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41290/" target="_blank">[新闻]微软追求雅虎告一段落 与Facebook展开搜索合作</a>]]></description></item><item><title>event与delegate的关系</title><link>http://www.cnblogs.com/Junhot/archive/2004/12/17/78492.html</link><dc:creator>Junhot</dc:creator><author>Junhot</author><pubDate>Fri, 17 Dec 2004 09:40:00 GMT</pubDate><guid>http://www.cnblogs.com/Junhot/archive/2004/12/17/78492.html</guid><wfw:comment>http://www.cnblogs.com/Junhot/comments/78492.html</wfw:comment><comments>http://www.cnblogs.com/Junhot/archive/2004/12/17/78492.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/Junhot/comments/commentRss/78492.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/Junhot/services/trackbacks/78492.html</trackback:ping><description><![CDATA[<p>作者：Junhot 
<br/>更新时间：2004-12-17 
<br/><font face="宋体" size="3">------------------------------------------------------------------------------- </font><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue"><font face="Times New Roman">
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
<br/>event<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">与</span><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue"><font face="Times New Roman">delegate</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">是</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">C#</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">中的两个关键字，在微软的例程中常见它们一起出现，那么他们之间有什么关系呢？</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
   </p></font></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">想看专业的解释就看：</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p><font face="Times New Roman">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">.NET Famework SDK</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">文档</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">-</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">〉参考</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">-</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">〉编译器和语言参考</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">-</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">〉</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">C#-</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">〉</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">C#</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">语言规范</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">-</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">〉</span><st1:chsdate w:st="on" IsROCDate="False" IsLunarDate="False" Day="30" Month="12" Year="1899"><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">10.7.1</font></span></st1:chsdate><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">类似字段的事件</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p><font face="Times New Roman">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">里面有详细的解释。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p><font face="Times New Roman">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">这里我想就编译时发生的事情做一下描述。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p><font face="Times New Roman">&#160;</font></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">上面的参考中有一句：</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">&#8220;</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">引发一个事件</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">&#8221;</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">与</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">&#8220;</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">调用一个由该事件表示的委托</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">&#8221;</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">完全等效。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">什么意思呢？</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">我觉得可以这样表述：事件的引发是通过调用委托实现的，而委托不仅仅可以用来实现事件的引发。
<br/></span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">
<br/>我写了下面一段测试代码，我们可以看看编译器到底对</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">event</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">做了些什么。
<br/>
   <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
       <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;Class1
<br/><img id="Codehighlighter1_22_311_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_22_311_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_22_311_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_22_311_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_22_311_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_22_311_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_22_311_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_22_311_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_22_311_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_22_311_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">delegate</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;abc();
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">event</span><span style="COLOR: #000000">&#160;abc&#160;thisevent;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;Class1()
<br/><img id="Codehighlighter1_104_267_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_104_267_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_104_267_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_104_267_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_104_267_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_104_267_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_104_267_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_104_267_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_104_267_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_104_267_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;thisevent&#160;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;abc(d);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;thisevent&#160;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;abc(e);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;thisevent&#160;</span><span style="COLOR: #000000">-=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;abc(d);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;thisevent&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;thisevent&#160;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;abc(e);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />
<br/><img id="Codehighlighter1_287_288_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_287_288_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_287_288_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_287_288_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_287_288_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_287_288_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_287_288_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_287_288_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;d()</span><span id="Codehighlighter1_287_288_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_287_288_Open_Text"><span style="COLOR: #000000">{}</span></span><span style="COLOR: #000000">
<br/><img id="Codehighlighter1_307_308_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_307_308_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_307_308_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_307_308_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_307_308_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_307_308_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_307_308_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_307_308_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;e()</span><span id="Codehighlighter1_307_308_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_307_308_Open_Text"><span style="COLOR: #000000">{}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
       </div>
   </div>
<br/></span>
</p><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">我们用</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">ildasm</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">工具打开生成的</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">IL</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">代码：
<br/><img height="408" src="http://www.cnblogs.com/images/cnblogs_com/junhot/test4event1.jpg" width="640" />
<br/></span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">可以看到</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">delegate abc</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">实际上是从</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">MulticastDelegate</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">继承而来的一个类。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">而在我们自己声明的</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">thisevent</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">事件、</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">d()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">、</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">e()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">方法之外，多出了一个</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">thisevent</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">字段和两个方法</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">add_thisevent()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">、</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">remove_thisevent()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">正如上面提到的那篇参考内描述的那样，一个事件的声明是可以转化为一个代理字段的声明加上添加、删除两种方法的事件操作。
<br/></span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">
<br/>我们查看</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">thisevent</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">事件的</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">IL</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">代码：</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"></p>
   <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
       <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">.</span><span style="COLOR: #0000ff">event</span><span style="COLOR: #000000">&#160;test4eventil.Class1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">abc&#160;thisevent
<br/><img id="Codehighlighter1_41_227_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_41_227_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_41_227_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_41_227_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_41_227_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_41_227_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_41_227_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_41_227_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_41_227_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_41_227_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;.addon&#160;instance&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;test4eventil.Class1::add_thisevent(</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;test4eventil.Class1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">abc)
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;.removeon&#160;instance&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;test4eventil.Class1::remove_thisevent(</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;test4eventil.Class1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">abc)
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&#160;end&#160;of&#160;event&#160;Class1::thisevent
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
       </div>
   </div>
<br/>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">可以看到，实际上</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">add_thisevent()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">与</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">remove_thisevent()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">是包含在</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">thisevent</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">事件中的两个方法。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p><font face="Times New Roman">&#160;</font></o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">那么，这两个方法与</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">delegate</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">有什么关系呢？</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">我们看看</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">add_thisevent()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">IL</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">代码：
<br/>
       <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
           <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">.method&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;hidebysig&#160;specialname&#160;instance&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;add_thisevent(</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;test4eventil.Class1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">abc&#160;</span><span style="COLOR: #000000">&#39;</span><span style="COLOR: #000000">value</span><span style="COLOR: #000000">&#39;</span><span style="COLOR: #000000">)&#160;cil&#160;managed&#160;synchronized
<br/><img id="Codehighlighter1_138_627_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_138_627_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_138_627_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_138_627_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_138_627_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_138_627_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_138_627_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_138_627_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_138_627_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_138_627_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&#160;代码大小&#160;&#160;&#160;&#160;&#160;&#160;&#160;24&#160;(0x18)</span><span style="COLOR: #008000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #000000">&#160;&#160;.maxstack&#160;&#160;</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_0000:&#160;&#160;ldarg.</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_0001:&#160;&#160;ldarg.</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_0002:&#160;&#160;ldfld&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;test4eventil.Class1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">abc&#160;test4eventil.Class1::thisevent
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_0007:&#160;&#160;ldarg.</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_0008:&#160;call&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;[mscorlib]System.Delegate&#160;[mscorlib]System.Delegate::Combine(</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;[mscorlib]System.Delegate,&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;[mscorlib]System.Delegate)
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_000d:&#160;&#160;castclass&#160;&#160;test4eventil.Class1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">abc
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_0012:&#160;&#160;stfld&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;test4eventil.Class1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">abc&#160;test4eventil.Class1::thisevent
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;IL_0017:&#160;&#160;ret
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&#160;end&#160;of&#160;method&#160;Class1::add_thisevent
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
           </div>
       </div>
       <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">反编译后如下：
<br/>
           <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
              <div><img id="Codehighlighter1_37_104_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_37_104_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_37_104_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_37_104_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_37_104_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_37_104_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_37_104_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_37_104_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;add_thisevent(abc&#160;value)&#160;</span><span id="Codehighlighter1_37_104_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_37_104_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.thisevent&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;(abc)&#160;Delegate.Combine(</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.thisevent,&#160;value);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
              </div>
           </div><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">而</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">remove_thisevent()</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">则是：</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
           </p>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"></p>
           <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
              <div><img id="Codehighlighter1_40_106_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_40_106_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_40_106_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_40_106_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_40_106_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_40_106_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_40_106_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_40_106_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;remove_thisevent(abc&#160;value)&#160;</span><span id="Codehighlighter1_40_106_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_40_106_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.thisevent&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;(abc)&#160;Delegate.Remove(</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.thisevent,&#160;value);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
              </div>
           </div>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
<br/>也就是说，实际上，添加一个事件的绑定，实际上就是向该事件表示的委托列表中添加一项委托。而取消一个事件的绑定，就是<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 1.0pt; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">从委托列表中删除一项委托。
<br/>
<br/>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">所以，对</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">event</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的绑定都是通过在</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">delegate</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">列表中添加、删除项来实现的。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">另外，需要注意的一点是：除了在</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">event</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">对象声明的类内部，</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">event</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">对象只能用在</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">+=</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">和</span><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">-=</font></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">的左边。</span><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span>
              </p></span>
           </p></span></span>
       </p></span>
   </p><span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span></o:p></span>
</p></o:p></span><img src ="http://www.cnblogs.com/Junhot/aggbug/78492.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41289/" target="_blank">[新闻]百度C2C项目年底上线</a>]]></description></item><item><title>DirectX Sample分析：Framework中的控件事件绑定（二）</title><link>http://www.cnblogs.com/Junhot/archive/2004/12/17/78278.html</link><dc:creator>Junhot</dc:creator><author>Junhot</author><pubDate>Fri, 17 Dec 2004 02:55:00 GMT</pubDate><guid>http://www.cnblogs.com/Junhot/archive/2004/12/17/78278.html</guid><wfw:comment>http://www.cnblogs.com/Junhot/comments/78278.html</wfw:comment><comments>http://www.cnblogs.com/Junhot/archive/2004/12/17/78278.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnblogs.com/Junhot/comments/commentRss/78278.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/Junhot/services/trackbacks/78278.html</trackback:ping><description><![CDATA[作者：Junhot
<br/>更新时间：2004-12-17
<br/><font face="宋体" size="3">------------------------------------------------------------------------------- </font>
<br/>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&#160;&#160;&#160;&#160; </span></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">上篇文章说明了控件事件是如何被<span lang="EN-US">Dialog</span>触发的，那么我们如何在实际使用中利用这些控件事件呢？我们需要将事件绑定到我们自己的方法。这样，一旦控件事件被触发，我们的程序就会自动调用我们自己的方法来处理该事件。
<br/>
<br/><span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&#160;&#160;&#160;&#160; </span></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">这样做的好处是显而易见的。试想我们要实现如下的功能：点一个按钮，清除游戏中所有的物体。一般情况下我们是怎么做的？在点按钮的时候再去判断游戏中有多少物体，然后用一个循环销毁它们？这太无聊了，让他们收到命令就自己了断多好（真是听话&#8230;&#8230;）。
<br/>
<br/><span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&#160;&#160;&#160;&#160; </span></span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">所以我们可以在物体创建时，就将按钮的<span lang="EN-US">Click</span>事件与该物体的销毁方法绑定，这就是事件驱动的好处啦。<span lang="EN-US">DirectX Sample</span>也给我们演示了如何利用事件驱动。比如点击<span lang="EN-US">Toggle full screen</span>按钮时触发全屏方法：
<br/><span lang="EN-US"><o:p>
   <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 31px">
       <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&#160;Hook&#160;the&#160;button&#160;events&#160;for&#160;when&#160;these&#160;items&#160;are&#160;clicked</span><span style="COLOR: #008000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;fullScreen.Click&#160;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;EventHandler(OnFullscreenClicked);</span>
       </div>
   </div></o:p></span></span>
</p>
<br/>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">疑问：为什么这里的绑定是绑定到<span lang="EN-US">EventHandler</span>类型呢？<span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">回答：因为<span lang="EN-US">Button</span>的<span lang="EN-US">Click</span>事件是<span lang="EN-US">EventHandler</span>类型的啊。<span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">疑问：为什么<span lang="EN-US">Button</span>的<span lang="EN-US">Click</span>事件是<span lang="EN-US">EventHandler</span>类型的呢？为什么不能用其他类型？<span lang="EN-US"><o:p></o:p></span></span>
</p>
<p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">回答：&#8230;&#8230;这不是在编写《十万个为什么》！！
<br/>
<br/>
   <p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">我们看看上次我们列出来的<span lang="EN-US">Button</span>中的代码：<span lang="EN-US" style="COLOR: blue"><o:p></o:p></span></span>
   </p><span lang="EN-US"><o:p>
   <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
       <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">event</span><span style="COLOR: #000000">&#160;EventHandler&#160;Click;
<br/><img id="Codehighlighter1_33_82_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_33_82_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_33_82_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_33_82_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_33_82_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_33_82_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_33_82_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_33_82_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_33_82_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id="Codehighlighter1_33_82_Open_Text"><span style="COLOR: #808080">///</span><span style="COLOR: #008000">&#160;</span><span style="COLOR: #808080">&lt;summary&gt;</span><span style="COLOR: #008000">Create&#160;new&#160;button&#160;instance</span><span style="COLOR: #808080">&lt;/summary&gt;</span><span style="COLOR: #808080"></span></span>
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;RaiseClickEvent(Button&#160;sender,&#160;</span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&#160;wasTriggeredByUser)
<br/><img id="Codehighlighter1_154_366_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_154_366_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_154_366_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_154_366_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_154_366_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_154_366_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_154_366_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_154_366_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_154_366_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_154_366_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&#160;Discard&#160;events&#160;triggered&#160;programatically&#160;if&#160;these&#160;types&#160;of&#160;events&#160;haven&#39;t&#160;been
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&#160;enabled</span><span style="COLOR: #008000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&#160;(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">Parent.IsUsingNonUserEvents&#160;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">wasTriggeredByUser)
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&#160;(Click&#160;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />Click(sender,&#160;EventArgs.Empty);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
       </div>
   </div>
<br/>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">实际上这个<span lang="EN-US">EventHandler</span>是一个<span lang="EN-US">delegate</span>（委托）方法。<span lang="EN-US"><o:p></o:p></span></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">什么叫委托方法呢？<span lang="EN-US"><o:p></o:p></span></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">委托方法说白了就是方法本身什么事都不干，你调用的时候才用一个真正干活的方法去实现这个委托。<span lang="EN-US"><o:p></o:p></span></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">还是一头雾水&#8230;&#8230;这东西说不白了&#8230;&#8230;<span lang="EN-US"><o:p></o:p></span></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><o:p>&#160;</o:p></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">我们还是用上面的代码来说明：<span lang="EN-US"><o:p></o:p></span></span>
   </p>
   <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">首先给出<span lang="EN-US">EventHandler</span>的定义，这个方法是在<span lang="EN-US">System</span>命名空间下的，吃白饭的方法：
<br/>
       <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
           <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">delegate</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;EventHandler(Object&#160;sender,&#160;EventArgs&#160;e);</span>
           </div>
       </div>
<br/>
       <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">然后我们知道<span lang="EN-US">Button</span>中有这样一行：
<br/>
           <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
              <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">event</span><span style="COLOR: #000000">&#160;EventHandler&#160;Click;</span>
              </div>
           </div>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">
<br/>这个时候发生了什么事呢？<span lang="EN-US">Click</span>就变成了这个委托的一个实现。也就是说调用<span lang="EN-US">Click</span>的时候应该是有两个参数的，所以：
<br/><span lang="EN-US"><o:p></o:p></span></span>
           </p><span lang="EN-US"><o:p>
           <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
              <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&#160;(Click&#160;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" />Click(sender,&#160;EventArgs.Empty);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
              </div>
           </div>
<br/>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">这里传了两个参数给<span lang="EN-US">Click</span>事件，这两个参数实际上是<span lang="EN-US">EventHandler</span>定义的。<span lang="EN-US"><o:p></o:p></span></span>
           </p>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">到这里都没问题。就像声明了一个类的实例然后调用这个类一样。<span lang="EN-US"><o:p></o:p></span></span>
           </p>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><o:p>&#160;</o:p></span>
           </p>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">可是<span lang="EN-US">Click</span>还是什么事都没有干啊？<span lang="EN-US"><o:p></o:p></span></span>
           </p>
           <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">那当然，<span lang="EN-US">Click</span>只是个事件而已，真正干活的在下面：
<br/>
              <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
                  <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;fullScreen.Click&#160;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;EventHandler(OnFullscreenClicked);</span>
                  </div>
              </div>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
<br/>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">这就是绑定的代码。<span lang="EN-US">OnFullscreenClicked</span>我们用惯了<span lang="EN-US">VB</span>或者<span lang="EN-US">C#</span>应该都知道，它里面是些什么内容，肯定就是实现全屏的具体代码，要不也是调用实现全屏方法的代码。<span lang="EN-US"><o:p></o:p></span></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><o:p>&#160;</o:p></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">那么这个<span lang="EN-US">+=</span>是什么意思？<span lang="EN-US"><o:p></o:p></span></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">Delegate</span><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">委托方法是可以用<span lang="EN-US">+</span>、<span lang="EN-US">-</span>操作来实现多重委托的，就是说吃白饭的头头只有一个，而干活的苦力可以有很多个。这里实际上就是将<span lang="EN-US">fullScreen</span>这个按钮的<span lang="EN-US">Click</span>委托实现又绑上了一个具体实现：<span lang="EN-US">OnFullscreenClicked</span>。想想我们最开始举的例子，我们可以把多个物体的销毁都绑定到一个按钮上，利用的就是这一点。<span lang="EN-US"><o:p></o:p></span></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><o:p>&#160;</o:p></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">也就是说一个头头（<span lang="EN-US">EventHandler</span>）给下面的小头头（<span lang="EN-US">Click</span>）传达任务，小头头（<span lang="EN-US">Click</span>）给苦力（<span lang="EN-US">OnFullscreenClicked</span>）传达任务，苦力（<span lang="EN-US">OnFullscreenClicked</span>）去做任务&#8230;&#8230;<span lang="EN-US"><o:p></o:p></span></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">这就是委托的流程，委托最后一定要绑定到一个具体的实现方法，光有任务没人去做是不行的。<span lang="EN-US"><o:p></o:p></span></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><o:p>&#160;</o:p></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">明白这个流程后，我们知道<span lang="EN-US">EventHandler</span>实际上什么事都没有做，我们完全可以一脚踹开它，自己定义一个委托方法，在Button类的代码前面加上一行：<span lang="EN-US"><o:p></o:p></span></span>
              </p>
              <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p>
                  <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
                      <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">delegate</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;MyEventHandler(Object&#160;sender,&#160;EventArgs&#160;e);</span>
                      </div>
                  </div>
<br/>
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">唔&#8230;&#8230;多了两个字母&#8230;&#8230;<span lang="EN-US"><o:p></o:p></span></span>
                  </p>
                  <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">然后在<span lang="EN-US">Button</span>中：
<br/>
                      <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
                            <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">event</span><span style="COLOR: #000000">&#160;MyEventHandler&#160;Click;</span>
                            </div>
                      </div>
                      <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
<br/>
                      </p>
                      <p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">这样<span lang="EN-US">Click</span>接受的就是<span lang="EN-US">MyEventHandler</span>的委托了。<span lang="EN-US"><o:p></o:p></span></span>
                      </p>
                      <p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">最后再绑定：<span lang="EN-US"><o:p></o:p></span></span>
                      </p>
                      <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"></p>
                      <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
                            <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;fullScreen.Click&#160;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;MyEventHandler(OnFullscreenClicked);</span>
                            </div>
                      </div>
                      <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
<br/>
                      </p>
                      <p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">小头头（<span lang="EN-US">Click</span>）告诉苦力（<span lang="EN-US">OnFullscreenClicked</span>）：这个任务是新的头头（<span lang="EN-US">MyEventHandler</span>）下达的，一定要做好！<span lang="EN-US"><o:p></o:p></span></span>
                      </p>
                      <p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt"><o:p>&#160;</o:p></span>
                      </p>
                      <p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-font-kerning: 0pt">疑问：<span lang="EN-US">EventHandler</span>和<