471,613 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,613 software developers and data experts.

In winform datagrid, How to find the datagridcell by mouse coodina

Hi there,
I have a problem needs help.

In a winform, I have a datagrid.

In Mouse move event, I can get coodinates of Mouse. I want to decide which
datagridcell my mouse is on. Can anybody tell me how to do it?

Thanks,

Karl
Nov 25 '05 #1
1 1760
Karl wrote:
In Mouse move event, I can get coodinates of Mouse. I want to decide
which datagridcell my mouse is on. Can anybody tell me how to do it?


private void datagrid_MouseHover(object sender, System.EventArgs e)
{
Point pt = this.PointToClient(Cursor.Position);
DataGrid.HitTestInfo myHitTest = datagrid.HitTest(pt);
int column = myHitTest.Column;
int row = myHitTest.Row;
// :
// :

--
Truth,
James Curran [erstwhile-MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Nov 25 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Chris Plowman | last post: by
5 posts views Thread by Bryan Masephol | last post: by
1 post views Thread by Marre | last post: by
1 post views Thread by John Bayly via .NET 247 | last post: by
2 posts views Thread by Carl Tribble | last post: by
6 posts views Thread by Doug Bell | last post: by
1 post views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.