<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: DataGridView Tricks #1: Set Hand Cursor for Entire Cell</title>
	<atom:link href="http://goneale.com/2009/05/26/datagridview-tricks-1-set-hand-cursor-for-entire-cell/feed/" rel="self" type="application/rss+xml" />
	<link>http://goneale.com/2009/05/26/datagridview-tricks-1-set-hand-cursor-for-entire-cell/</link>
	<description>Graham O&#039;Neale – Deep In .NET Development: ASP.NET, MVC, jQuery, WPF, WCF, Silverlight</description>
	<lastBuildDate>Wed, 10 Mar 2010 13:27:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Veljko</title>
		<link>http://goneale.com/2009/05/26/datagridview-tricks-1-set-hand-cursor-for-entire-cell/comment-page-1/#comment-6019</link>
		<dc:creator>Veljko</dc:creator>
		<pubDate>Tue, 26 Jan 2010 12:13:03 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=631#comment-6019</guid>
		<description>The CellMouseEnter and CellMouseLeave are a bit more effective in performance because the event is not so frequently fired as CellMouseMove.
The glitches you receive is probably because you declared both events and in both placed the &#039;else&#039; branch - this is a bit of a problem because both events fire when mouse is moved from one cell to another. So, the sufficient code should be:
private void grd_CellMouseEnter(....)
if (CheckIsClickable(e.RowIndex, e.ColumnIndex))
{
    this.Cursor = Cursors.Hand;
}

private void grd_CellMouseLeave(....)
if (CheckIsClickable(e.RowIndex, e.ColumnIndex))
{
    this.Cursor = Cursors.Default;
}

I&#039;ve tried this and works just fine...

(The CheckIsClickable is my method that returns true or false based on the current row and column index - columns that hold clickable cells and rows that have data (i.e. &gt; 0 and &lt; grd.Rows.Count))</description>
		<content:encoded><![CDATA[<p>The CellMouseEnter and CellMouseLeave are a bit more effective in performance because the event is not so frequently fired as CellMouseMove.<br />
The glitches you receive is probably because you declared both events and in both placed the &#8216;else&#8217; branch &#8211; this is a bit of a problem because both events fire when mouse is moved from one cell to another. So, the sufficient code should be:<br />
private void grd_CellMouseEnter(&#8230;.)<br />
if (CheckIsClickable(e.RowIndex, e.ColumnIndex))<br />
{<br />
    this.Cursor = Cursors.Hand;<br />
}</p>
<p>private void grd_CellMouseLeave(&#8230;.)<br />
if (CheckIsClickable(e.RowIndex, e.ColumnIndex))<br />
{<br />
    this.Cursor = Cursors.Default;<br />
}</p>
<p>I&#8217;ve tried this and works just fine&#8230;</p>
<p>(The CheckIsClickable is my method that returns true or false based on the current row and column index &#8211; columns that hold clickable cells and rows that have data (i.e. &gt; 0 and &lt; grd.Rows.Count))</p>
]]></content:encoded>
	</item>
</channel>
</rss>
