<?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, 28 Sep 2011 23:00:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Diego</title>
		<link>http://goneale.com/2009/05/26/datagridview-tricks-1-set-hand-cursor-for-entire-cell/comment-page-1/#comment-26602</link>
		<dc:creator>Diego</dc:creator>
		<pubDate>Sat, 26 Mar 2011 01:07:01 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=631#comment-26602</guid>
		<description>Sorry for bringing back to life this post but i found it just now...

Couldn&#039;t this be done using the EditingControlShowing event?

i.e.:
private void mydatagrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            // set hand cursor only for button column types
            if (!(e.Control is Button)) return;


            e.Control.Cursor = Cursors.Hand;
        }

Just a thought...</description>
		<content:encoded><![CDATA[<p>Sorry for bringing back to life this post but i found it just now&#8230;</p>
<p>Couldn&#8217;t this be done using the EditingControlShowing event?</p>
<p>i.e.:<br />
private void mydatagrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)<br />
        {<br />
            // set hand cursor only for button column types<br />
            if (!(e.Control is Button)) return;</p>
<p>            e.Control.Cursor = Cursors.Hand;<br />
        }</p>
<p>Just a thought&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronnie Stum</title>
		<link>http://goneale.com/2009/05/26/datagridview-tricks-1-set-hand-cursor-for-entire-cell/comment-page-1/#comment-12833</link>
		<dc:creator>Ronnie Stum</dc:creator>
		<pubDate>Fri, 10 Sep 2010 17:37:14 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=631#comment-12833</guid>
		<description>That&#039;s funny Veljko, I was about to post the same thing.</description>
		<content:encoded><![CDATA[<p>That&#8217;s funny Veljko, I was about to post the same thing.</p>
]]></content:encoded>
	</item>
	<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>

