码迷,mamicode.com
首页 > 其他好文 > 详细

DevExpress gridview获取单元格坐标

时间:2014-08-05 14:05:19      阅读:368      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   io   ar   代码   div   

获取坐标(在RowCellClick事件中)的代码如下:

 private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            //获取点击单元格左上角的坐标
            GridViewInfo info = gridView1.GetViewInfo() as GridViewInfo;
            GridCellInfo cellInfo = info.GetGridCellInfo(gridView1.FocusedRowHandle, gridView1.FocusedColumn);
            string m= cellInfo.Bounds.X.ToString();
            string m2 = cellInfo.Bounds.Y.ToString();

            //获取鼠标点击时的坐标
            Point p = this.gridControl1.PointToClient(Control.MousePosition);
            string n = p.X.ToString();
            string n2 = p.Y.ToString();

            MessageBox.Show("单元格坐标:"+ m+","+m2+"\n"+"鼠标坐标:"+n+","+n2);
        }

 

DevExpress gridview获取单元格坐标,布布扣,bubuko.com

DevExpress gridview获取单元格坐标

标签:style   blog   color   os   io   ar   代码   div   

原文地址:http://www.cnblogs.com/huangzhenhua/p/3892050.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!