<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kernel2Heart &#187; .net</title>
	<atom:link href="http://www.kernel2heart.com/labels/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kernel2heart.com</link>
	<description>一个人的内心里,究竟隐藏了什么呢?</description>
	<lastBuildDate>Fri, 20 May 2011 05:10:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>C#中實現窗體的淡入淡出</title>
		<link>http://www.kernel2heart.com/2009/09/csharp-winform-effect/</link>
		<comments>http://www.kernel2heart.com/2009/09/csharp-winform-effect/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 09:42:11 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/09/csharp-winform-effect/</guid>
		<description><![CDATA[之前一直在想如何在C#中實現窗體的淡入淡出效果。但是看到網上很多教程說的是利用計時器或者線程功能實現淡入淡出效果。代碼看起來有點小長。沒辦法呀，我這個人是比較懶的嘛。繼續查了查，還有一種利用一個很有問題的API實現的淡入淡出，效果也很一般。回過頭去看看MFC程序，想到了AnimateWindow函數。 The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade. 1 2 3 4 5 BOOL AnimateWindow&#40; HWND hwnd, DWORD dwTime, &#8230; <a href="http://www.kernel2heart.com/2009/09/csharp-winform-effect/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>之前一直在想如何在C#中實現窗體的淡入淡出效果。但是看到網上很多教程說的是利用計時器或者線程功能實現淡入淡出效果。代碼看起來有點小長。沒辦法呀，我這個人是比較懶的嘛。繼續查了查，還有一種利用一個很有問題的API實現的淡入淡出，效果也很一般。回過頭去看看MFC程序，想到了AnimateWindow函數。 </p>
<p> <span id="more-219"></span>
</p>
<blockquote><p>The <strong>AnimateWindow</strong> function enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;">BOOL AnimateWindow<span style="color: #008000;">&#40;</span>
	HWND hwnd,
	DWORD dwTime,
	DWORD dwFlags
	<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></td></tr></table></div>

</blockquote>
<p>其實查閱一下MSDN就知道了，我們這裡使用這個主要是設定一下時間和Flags就可以了。具體的參數可以參見<a href="http://msdn.microsoft.com/zh-cn/developercenters/ms632669(en-us,VS.85).aspx">MSDN</a>。</p>
<p>什麽？在C#沒有定義這些Flags？沒關係，我們手工定義一下就可以了。像我就自己寫了一個類：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> FormEffects
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_HOR_POSITIVE <span style="color: #008000;">=</span> 0x00000001<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_HOR_NEGATIVE <span style="color: #008000;">=</span> 0x00000002<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_VER_POSITIVE <span style="color: #008000;">=</span> 0x00000004<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_VER_NEGATIVE <span style="color: #008000;">=</span> 0x00000008<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_CENTER <span style="color: #008000;">=</span> 0x00000010<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_HIDE <span style="color: #008000;">=</span> 0x00010000<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_ACTIVATE <span style="color: #008000;">=</span> 0x00020000<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_SLIDE <span style="color: #008000;">=</span> 0x00040000<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_BLEND <span style="color: #008000;">=</span> 0x00080000<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#91;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Runtime</span><span style="color: #008000;">.</span><span style="color: #0000FF;">InteropServices</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">DllImport</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;user32.dll&quot;</span>, CharSet <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Runtime</span><span style="color: #008000;">.</span><span style="color: #0000FF;">InteropServices</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">CharSet</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Auto</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> <span style="color: #6666cc; font-weight: bold;">bool</span> AnimateWindow<span style="color: #008000;">&#40;</span>
        IntPtr hwnd,   <span style="color: #008080; font-style: italic;">//   handle   to   window    </span>
        <span style="color: #6666cc; font-weight: bold;">int</span> dwTime,   <span style="color: #008080; font-style: italic;">//   duration   of   animation    </span>
        <span style="color: #6666cc; font-weight: bold;">int</span> dwFlags   <span style="color: #008080; font-style: italic;">//   animation   type    </span>
        <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>因為寫的代碼問題，根本不用使用什麽using。如果你想簡化一下也簡單：using System.Runtime.InteropServices即可。唔，我的工作是VAX代勞的，所以無所謂啦。</p>
<p>使用的時候這樣就可以了：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">	<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> WelcomeForm_Load<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AnimateWindow</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Handle</span>, <span style="color: #FF0000;">500</span>, FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_BLEND</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> WelcomeForm_FormClosing<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, FormClosingEventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AnimateWindow</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Handle</span>, <span style="color: #FF0000;">500</span>, FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_HOR_NEGATIVE</span> <span style="color: #008000;">|</span> FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_HIDE</span> <span style="color: #008000;">|</span> FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_BLEND</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>其實C#這種高級語言，很多時候如果調用API的話，參見VC的代碼都成啊。= =|||</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/09/csharp-winform-effect/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>新的相册下载工具酝酿中</title>
		<link>http://www.kernel2heart.com/2009/08/new-album-download-tool/</link>
		<comments>http://www.kernel2heart.com/2009/08/new-album-download-tool/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 14:38:09 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[心路历程]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[相册下载]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/08/%e6%96%b0%e7%9a%84%e7%9b%b8%e5%86%8c%e4%b8%8b%e8%bd%bd%e5%b7%a5%e5%85%b7%e9%85%9d%e9%85%bf%e4%b8%ad/</guid>
		<description><![CDATA[更换电脑源码丢失，项目终止！ 其实最初我对这个方向觊觎了好久，不过T娘一直更新的AlbumCon比较勤快，框架也更完善一些。不过最近T娘不打算开发新的框架支持了，我就顺便出来抢一下市场吧。(好邪恶… &#62;. &#60;) 程序名：待定 支持相册：暂时只有xkoo和百度空间 语言&#38;平台：C#  .net2.0 目前这两个相册的下载器也是完成状态了，下面就是整合成一个完整的程序了。下载功能上支持的是程序自带多线程下载和迅雷调用下载。至于快车嘛…暂时没有什么打算。至于代理服务器什么的，暂时不会添加这个功能啦，反正迅雷可以加代理的嘛。其他的很多细节都是直接抄袭了AlbumCon的功能，毕竟那个功能更加全面一些，也更加人性化的。=___,= 其他的一些功能上，支持导出.lst列表文件，支持在线浏览模式，其他的好像也没什么了…有的话，希望你可以提出来。其实AlbumCon是支持百度空间的图片下载的…… 明年这个东西顺便就作毕业设计了。=___,=]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">更换电脑源码丢失，项目终止！</span></p>
<p><span style="text-decoration: line-through;">其实最初我对这个方向觊觎了好久，不过</span><a href="http://www.tortinita.org" target="_blank"><span style="text-decoration: line-through;">T娘</span></a><span style="text-decoration: line-through;">一直更新的</span><a href="http://sitelog.tortinita.org/2006/10/albumcon.html" target="_blank"><span style="text-decoration: line-through;">AlbumCon</span></a><span style="text-decoration: line-through;">比较勤快，框架也更完善一些。不过最近T娘不打算开发新的框架支持了，我就顺便出来抢一下市场吧。(好邪恶… &gt;. &lt;)</span></p>
<p><span id="more-117"></span></p>
<blockquote><p><span style="text-decoration: line-through;">程序名：待定</span></p>
<p><span style="text-decoration: line-through;">支持相册：暂时只有xkoo和百度空间</span></p>
<p><span style="text-decoration: line-through;">语言&amp;平台：C#  .net2.0</span></p></blockquote>
<p><span style="text-decoration: line-through;">目前这两个相册的下载器也是完成状态了，下面就是整合成一个完整的程序了。下载功能上支持的是程序自带多线程下载和迅雷调用下载。至于快车嘛…暂时没有什么打算。至于代理服务器什么的，暂时不会添加这个功能啦，反正迅雷可以加代理的嘛。其他的很多细节都是直接抄袭了AlbumCon的功能，毕竟那个功能更加全面一些，也更加人性化的。=___,=</span></p>
<p><span style="text-decoration: line-through;">其他的一些功能上，支持导出.lst列表文件，支持在线浏览模式，其他的好像也没什么了…有的话，希望你可以提出来。其实AlbumCon是支持百度空间的图片下载的……</span></p>
<p><span style="text-decoration: line-through;">明年这个东西顺便就作毕业设计了。=___,=</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/08/new-album-download-tool/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

