This is a migrated thread and some comments may be shown as answers.

Determining the mouse down position in Cell

2 Answers 727 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Osama
Top achievements
Rank 1
Osama asked on 11 Sep 2012, 08:18 AM
Hi..

I want to ask if there is any approach to determine the position of mouse down or up related to cell, in order to know which part of cell has been clicked.

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 13 Sep 2012, 11:28 AM
Hi Osamaweb,

You can do this by using the ControlBoundingRectangle property of the cell, and you can get the cell that is located under the mouse by using GetElementAtPoint method when handling MouseDown event for example:
void radGridView1_MouseDown(object sender, MouseEventArgs e)
{
    RadGridView grid = (RadGridView)sender;
    GridCellElement cell = grid.ElementTree.GetElementAtPoint(e.Location) as GridCellElement;
    if (cell != null)
    {
        Rectangle cellBounds = cell.ControlBoundingRectangle;
        //...
    }
}

I hope this helps.
 
Greetings,
Jack
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Jeff
Top achievements
Rank 1
Iron
answered on 01 Dec 2023, 12:59 PM
Is this guy for real? His name is supposedly Osama and he is asking on September 11th? Is that a joke?
Tags
GridView
Asked by
Osama
Top achievements
Rank 1
Answers by
Jack
Telerik team
Jeff
Top achievements
Rank 1
Iron
Share this question
or