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

Column / Cell Location

3 Answers 539 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raimund
Top achievements
Rank 1
Raimund asked on 23 Apr 2011, 09:31 AM
Hello,

someone knows how i can get the Location - X Coordinate of a Column or Cell Control / Element?
I could not manage it to get the position / location of the Column.

I only found the Location Property of the Cell Element.

radGV.CurrentCell.Location.X

But the Value is always 0.

Why I need this - I have a GridView and above the Grid I want to place a TextBox with the same Width and Location of the current Cell / Column. When I press a special key - the TextBox will stuck at the current Location - with that i want to highlight that this Column is Fixed ( I dont want to pin it ).

Best Regards,

Raimund

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 26 Apr 2011, 09:50 AM
Hello,

If I understand you correctly, you should just be able to use the mouse down to get the location.

E.g.
void radGridView1_MouseDown(object sender, MouseEventArgs e)
{
    System.Drawing.Point point = Control.MousePosition;
    MessageBox.Show(point.ToString());
}

Hope that helps
Richard
0
Accepted
Alexander
Telerik team
answered on 27 Apr 2011, 01:35 PM
Hello Raimund,

You can use the ControlBoundingRectangle property of CurrentCell. It gives you the position of the cell relative to the location of the RadGridView control. You can find the absolute position of the cell using the following code snippet:
int cellX = this.radGridView1.CurrentCell.ControlBoundingRectangle.X + this.radGridView1.Location.X;
int cellY = this.radGridView1.CurrentCell.ControlBoundingRectangle.Y + this.radGridView1.Location.Y;

I hope it helps.

Best regards,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Raimund
Top achievements
Rank 1
answered on 27 Apr 2011, 02:32 PM

Hello,

thanks to Richard and Alexander for the reply.

Best regards,

Raimund

Tags
GridView
Asked by
Raimund
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Alexander
Telerik team
Raimund
Top achievements
Rank 1
Share this question
or