怎么取得控件在容器的坐标? txt.Location.X.tostring();txt.Location.X.tostring(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 control.Location.X.tostring();control.Location.X.tostring(); 不是想得到这个,我在点击DataGrid控件时想得到我点击的单元格的容器坐标。可以用MousePosition得到屏幕坐标,但怎样将这个坐标转换成控件坐标呢???或者根据屏幕坐标来设置控件的位置??? 想将某个控件的位置和点击的单元格位置放在一起嘛?请参考以下代码: 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是一个列表筐,怎么样?不用找坐标了吧 :) 如何较好的防止并发操作? socket拔掉网线如何获取 打印功能。 求c#笔试编程题 问个简单问题,有关类的 c#中如何输出一个数组的最大值和最小值 怎样在一个指定的矩形区域内 纵向 连续画弧线?? 求一个SQL语句? Visual C# 请问C#如何做IT方面的分布式应用 我想用C#封装C写的API,里面一大堆void*, dword, LPCTSTR,请问分别用什么代替。 怎样结束一个进程?
control.Location.X.tostring();
可以用MousePosition得到屏幕坐标,但怎样将这个坐标转换成控件坐标呢???
或者根据屏幕坐标来设置控件的位置???
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是一个列表筐,怎么样?不用找坐标了吧 :)