首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么获得datagridview单元格中心的坐标

2012-05-28 
如何获得datagridview单元格中心的坐标如何获得datagridview单元格中心的坐标以便绘制线条,把这些标记了0

如何获得datagridview单元格中心的坐标
如何获得datagridview单元格中心的坐标

以便绘制线条,把这些标记了0的单元格,从上到下,依次连接起来




谢谢

[解决办法]

C# code
DataGridViewCell cell = dgv[0, 0];Rectangle rect = cell.ContentBounds;
[解决办法]
监听 CellPainting 事件 在事件处理程序中绘制线条
[解决办法]
C# code
private void dataGridView1_CellPainting(object sender,     system.Windows.Forms.DataGridViewCellPaintingEventArgs e){    //e.CellBounds为单元格的区域,找到对应中心就很容易    //把值绘制在单元格中 e.Value    e.Handled=true; //不能漏了这句}
[解决办法]
探讨

引用:

C# code

DataGridViewCell cell = dgv[0, 0];
Rectangle rect = cell.ContentBounds;


如何把0给连起来呢

热点排行