如何获取Datagridview所以单元格所在窗体上的座标

cdjmonkey 2006-11-10 10:47:44
如题
...全文
166 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
北京的雾霾天 2007-01-18
  • 打赏
  • 举报
回复
如下得到当前单元格相对在Form上的位置大小:
Rectangle rect = this.dataGridView1.GetCellDisplayRectangle(this.dataGridView1.CurrentCell.ColumnIndex, this.dataGridView1.CurrentCell.ColumnIndex, true);
rect.Offset(this.dataGridView1.Location);



WeiWY 2007-01-18
  • 打赏
  • 举报
回复
Rectangle rect = dataGridView1.GetCellDisplayRectangle(1, 1, false);
可以使用rect.Left,rect.Top ,rect.Height等
固执的大叔 2007-01-03
  • 打赏
  • 举报
回复
With dgv
intLeft = 0
For i = 0 To .CurrentCell.ColumnIndex - 1
intLeft += .Columns(i).Width
Next

intTop = 0
For i = 0 To .CurrentRow.Index
intTop += .Rows(i).Height
Next
End With
ages7mark 2006-12-12
  • 打赏
  • 举报
回复
DataGridView1.CurrentCellAddress.x,DataGridView1.CurrentCellAddress.y
wangchong 2006-11-10
  • 打赏
  • 举报
回复
没有这个属性或方法,自己算吧!!

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧