471,325 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

DataGridView Cell Position

How do I get DataGridViewCell cell position in a window?

For a button I would do this:
this.Button.PointToClient(this.Button.Location)

But what do I do for DataGridViewCell?
Thanks
Peter
Dec 2 '05 #1
5 13201
Hi Peter,

Because the DataGridViewCell is inside the DataGridView, we cannot get the
location of the cell by any properties.

An alternative is to caculate the total size of the left and upper cells.
Then add the value of the DataGridView.Location to get the relative
position of the cell.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 3 '05 #2

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:Hz**************@TK2MSFTNGXA02.phx.gbl...
Hi Peter,

Because the DataGridViewCell is inside the DataGridView, we cannot get the
location of the cell by any properties.

An alternative is to caculate the total size of the left and upper cells.
Then add the value of the DataGridView.Location to get the relative
position of the cell.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


I do not understand what you mean by "total size of the left and upper
cells", do you have an example?
Dec 3 '05 #3
Hi Peter,

For example, the cell is on the 2nd row and 3rd column. In this case, we
need to collection the width of column 1 and 2, and the height of row 1. So
the left edge of cell(2,3) is width(1)+width(2) and the top is at height(1).

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 6 '05 #4

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:D3****************@TK2MSFTNGXA02.phx.gbl...
Hi Peter,

For example, the cell is on the 2nd row and 3rd column. In this case, we
need to collection the width of column 1 and 2, and the height of row 1.
So
the left edge of cell(2,3) is width(1)+width(2) and the top is at
height(1).

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Thank You
Dec 9 '05 #5
You're welcome.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 9 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by rosydwin | 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.