<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.1-alpha" -->
<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/"
>

<channel>
	<title>lifan</title>
	<link>http://lifan.blogsome.com</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Tue, 24 Feb 2009 06:33:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1-alpha</generator>
	<language>en</language>

		<item>
		<title>Repeated MouseHover events in C#</title>
		<link>http://lifan.blogsome.com/2009/02/24/repeated-mousehover-events-in-c/</link>
		<comments>http://lifan.blogsome.com/2009/02/24/repeated-mousehover-events-in-c/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 06:24:09 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Uncategorized</category>
		<guid>http://lifan.blogsome.com/2009/02/24/repeated-mousehover-events-in-c/</guid>
		<description><![CDATA[	Due to a quirk in the way Windows handles events, once a mouse hover event has been triggered on a windows form control, another event cannot be triggered until the mouse leaves and re-enters the control. Sometimes you might need to process more than one MouseHover event, for example if you have a user control [...]]]></description>
			<content:encoded><![CDATA[	<p><font>Due to a quirk </font><font color="#0000ff">in</font><font> the way Windows handles events, once a mouse hover </font><font color="#0000ff">event</font><font> has been triggered on a windows form control, another </font><font color="#0000ff">event</font><font> cannot be triggered until the mouse leaves and re-enters the control. Sometimes you might need to process more than one MouseHover </font><font color="#0000ff">event</font><font>, </font><font color="#0000ff">for</font><font> example </font><font color="#0000ff">if</font><font> you have a user control which has draws shapes on itself. As </font><font color="#0000ff">long</font><font> </font><font color="#0000ff">as</font><font> you have a record of where the shapes are (by storing them </font><font color="#0000ff">in</font><font> a collection), you can use the method below </font><font color="#0000ff">as</font><font> a workaround.</font><font>
<p>I used <font color="#0000ff">this</font><font> to display a tooltip, so to prevent the MouseHover </font><font color="#0000ff">event</font><font> being spammed, action </font><font color="#0000ff">is</font><font> only taken when my tooltip </font><font color="#0000ff">is</font><font> not visible.</font></p>
</font><font color="#0000ff">
<p>private<font> </font><font color="#0000ff">const</font><font> </font><font color="#0000ff">uint</font><font> TME_HOVER = 0x00000001;</font></p>
</font><font color="#0000ff">
<p>private<font> </font><font color="#0000ff">const</font><font> </font><font color="#0000ff">uint</font><font> TME_LEAVE = 0x00000002;</font></p>
</font><font color="#0000ff">private</font><font> </font><font color="#0000ff">const</font><font> </font><font color="#0000ff">uint</font><font> HOVER_DEFAULT = 0xFFFFFFFF;</font><font>
<p>&nbsp;</p>
	<p>[DllImport(<font color="#a31515">&quot;user32.dll&quot;</font><font>)]</font></p>
</font><font color="#0000ff">public</font><font> </font><font color="#0000ff">static</font><font> </font><font color="#0000ff">extern</font><font> </font><font color="#0000ff">bool</font><font> TrackMouseEvent(</font><font color="#0000ff">ref</font><font> TRACKMOUSEEVENT lpEventTrack);</font><font>
<p>&nbsp;</p>
</font><font color="#0000ff">public</font><font> </font><font color="#0000ff">struct</font><font> </font><font color="#2b91af">TRACKMOUSEEVENT</font><font> {</font><font>
<p><font color="#0000ff">public</font><font> </font><font color="#0000ff">uint</font><font> cbSize;</font></p>
</font><font color="#0000ff">public</font><font> </font><font color="#0000ff">uint</font><font> dwFlags;</font><font>
<p><font color="#0000ff">public</font><font> IntPtr hwndTrack;</font></p>
</font><font color="#0000ff">public</font><font> </font><font color="#0000ff">uint</font><font> dwHoverTime;</font><font>
<p>}</p>
	<p>&nbsp;</p>
ToolTip toolTip = </font><font color="#0000ff">new</font><font> ToolTip();</font><font>toolTip.Location = </font><font color="#0000ff">new</font><font> System.Drawing.Point(290, 80);</font><font>
<p>&nbsp;</p>
	<p>Rectangle currentActiveShape = <font color="#0000ff">new</font><font> Rectangle(); </font><font color="#008000">// the currently active shape (over which the mouse is hovering)</font></p>
</font><font>
<p>&nbsp;</p>
</font><font color="#0000ff">this</font><font>.MouseMove += </font><font color="#0000ff">delegate</font><font>(</font><font color="#0000ff">object</font><font> sender, MouseEventArgs e) {</font><font>
<p><font color="#0000ff">foreach</font><font>(Rectangle rect </font><font color="#0000ff">in</font><font> myShapeCollection) {</font></p>
</font><font color="#0000ff">if</font><font>(rect.Contains(e.Location)) {</font><font /><font color="#0000ff">if</font><font>(currentActiveDay != day.Bounds) {</font><font>
<p>toolTip.Hide();</p>
Console.WriteLine(</font><font color="#a31515">&quot;Hide tooltip&quot;</font><font>);</font><font>
<p>}</p>
	<p>currentActiveShape = rect;</p>
	<p><font color="#008000">// Set location here</font></p>
</font><font>Console.WriteLine(</font><font color="#a31515">&quot;Entered &quot;</font><font> + rect.ToString());</font><font>
<p>}</p>
	<p>}</p>
	<p>};</p>
</font><font color="#0000ff">this</font><font>.MouseHover += </font><font color="#0000ff">delegate</font><font>(</font><font color="#0000ff">object</font><font> sender, EventArgs e) {</font><font>TRACKMOUSEEVENT trackMouseEvent = </font><font color="#0000ff">new</font><font> TRACKMOUSEEVENT();</font><font>
<p>trackMouseEvent.hwndTrack = ((Control)sender).Handle;</p>
	<p>trackMouseEvent.dwFlags = TME_HOVER;</p>
	<p>trackMouseEvent.dwHoverTime = HOVER_DEFAULT;</p>
trackMouseEvent.cbSize = (</font><font color="#0000ff">uint</font><font>)System.Runtime.InteropServices.Marshal.SizeOf(trackMouseEvent);</font><font>TrackMouseEvent(</font><font color="#0000ff">ref</font><font> trackMouseEvent);</font><font>
<p>&nbsp;</p>
</font><font color="#0000ff">if</font><font>(!toolTip.Active) {</font><font>
<p>toolTip.Show();</p>
Console.WriteLine(</font><font color="#a31515">&quot;Show tooltip&quot;</font><font>);</font><font>
<p>}</p>
	<p>};</p>
As the mouse moves around the control, the location of the tooltip changes, but it&rsquo;s not shown until the MouseHover </font><font color="#0000ff">event</font><font> </font><font color="#0000ff">is</font><font> triggerd.</font><font>
<p>Due to a quirk <font color="#0000ff">in</font><font> the way Windows handles events, once a mouse hover </font><font color="#0000ff">event</font><font> has been triggered on a windows form control, another </font><font color="#0000ff">event</font><font> cannot be triggered until the mouse leaves and re-enters the control. Sometimes you might need to process more than one MouseHover </font><font color="#0000ff">event</font><font>, </font><font color="#0000ff">for</font><font> example </font><font color="#0000ff">if</font><font> you have a user control which has draws shapes on itself. As </font><font color="#0000ff">long</font><font> </font><font color="#0000ff">as</font><font> you have a record of where the shapes are (by storing them </font><font color="#0000ff">in</font><font> a collection), you can use the method below </font><font color="#0000ff">as</font><font> a workaround.</font></p>
</font>
</p>
]]></content:encoded>
			<wfw:commentRss>http://lifan.blogsome.com/2009/02/24/repeated-mousehover-events-in-c/feed/</wfw:commentRss>
	</item>
		<item>
		<title>当前主流的测试工具</title>
		<link>http://lifan.blogsome.com/2006/09/18/p3/</link>
		<comments>http://lifan.blogsome.com/2006/09/18/p3/#comments</comments>
		<pubDate>Mon, 18 Sep 2006 01:02:29 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Uncategorized</category>
		<guid>http://lifan.blogsome.com/2006/09/18/p3/</guid>
		<description><![CDATA[	如代码检查工具:LINT；覆盖率检测工具:TrueCoverage；内存检查工具:BounderChecker；性能检测工具:TrueTime,LOADRUNNER等
	1.数据库工具建数据库工具，代表 powerdesigner数据库分析工具。很多大型的数据库都会带的。 
	2.流程图设计代表 visio 2000 ， smartdraw 
	3.case 工具代表 rose 
	4.代码分析工具代表 bounderchecker （for vc delphi ），smartcheck（for vb）&hellip;&hellip; 
	5.编辑器代表 vi ，vic ，Ultra Edit 6. 源代码管理代表 vss，cvs
]]></description>
			<content:encoded><![CDATA[	<p>如代码检查工具:LINT；覆盖率检测工具:TrueCoverage；内存检查工具:BounderChecker；性能检测工具:TrueTime,LOADRUNNER等</p>
	<p>1.数据库工具建数据库工具，代表 powerdesigner数据库分析工具。很多大型的数据库都会带的。 </p>
	<p>2.流程图设计代表 visio 2000 ， smartdraw </p>
	<p>3.case 工具代表 rose </p>
	<p>4.代码分析工具代表 bounderchecker （for vc delphi ），smartcheck（for vb）&hellip;&hellip; </p>
	<p>5.编辑器代表 vi ，vic ，Ultra Edit 6. 源代码管理代表 vss，cvs</p>
]]></content:encoded>
			<wfw:commentRss>http://lifan.blogsome.com/2006/09/18/p3/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Language</title>
		<link>http://lifan.blogsome.com/2006/09/18/language/</link>
		<comments>http://lifan.blogsome.com/2006/09/18/language/#comments</comments>
		<pubDate>Mon, 18 Sep 2006 00:46:33 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Uncategorized</category>
		<guid>http://lifan.blogsome.com/2006/09/18/language/</guid>
		<description><![CDATA[	　　当前静态语言有：java、C/C++、C#、DELPHI、VB等。　　动态语言有：asp、php、cgi、lisp、Perl、python,Smalltalk、Ruby等。

]]></description>
			<content:encoded><![CDATA[	<p>　　当前静态语言有：java、C/C++、C#、DELPHI、VB等。<br />　　动态语言有：asp、php、cgi、lisp、Perl、python,Smalltalk、Ruby等。
</p>
]]></content:encoded>
			<wfw:commentRss>http://lifan.blogsome.com/2006/09/18/language/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://lifan.blogsome.com/2006/09/18/hello-world/</link>
		<comments>http://lifan.blogsome.com/2006/09/18/hello-world/#comments</comments>
		<pubDate>Mon, 18 Sep 2006 00:35:38 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Uncategorized</category>
		<guid>http://lifan.blogsome.com/2006/09/18/hello-world/</guid>
		<description><![CDATA[	Welcome to your new blog. This is your first post. Edit or delete it, then start blogging!
	An email has been sent to you giving you details of how to log in to the administration section. From there you can change the design by clicking on the tab MANAGE and then click on the tab THEMES. [...]]]></description>
			<content:encoded><![CDATA[	<p>Welcome to your new blog. This is your first post. Edit or delete it, then start blogging!</p>
	<p>An email has been sent to you giving you details of how to log in to the administration section. From there you can change the design by clicking on the tab MANAGE and then click on the tab THEMES. If you have any questions, ask them in the <a href="http://blogsome-forum.blogsome.com">forums</a> &#8212; we are only too willing to help.
</p>
]]></content:encoded>
			<wfw:commentRss>http://lifan.blogsome.com/2006/09/18/hello-world/feed/</wfw:commentRss>
	</item>
	</channel>
</rss>
