txt.Location.X.tostring();
txt.Location.X.tostring();

解决方案 »

  1.   

    control.Location.X.tostring();
    control.Location.X.tostring();
      

  2.   

    不是想得到这个,我在点击DataGrid控件时想得到我点击的单元格的容器坐标。
    可以用MousePosition得到屏幕坐标,但怎样将这个坐标转换成控件坐标呢???
    或者根据屏幕坐标来设置控件的位置???
      

  3.   

    想将某个控件的位置和点击的单元格位置放在一起嘛?请参考以下代码:
    private void TotalDataGrid_CurrentCellChanged(object sender, System.EventArgs e)
    {
    Rectangle r=TotalDataGrid.GetCurrentCellBounds();
    cbAll.Left=r.Left;
    cbAll.Top=r.Top;
    cbAll.Width=r.Width;
    cbAll.Height=r.Height; cbAll.Show();
    }//cbAll是一个列表筐,怎么样?不用找坐标了吧  :)