社区
C#
帖子详情
DataGrid如何行选中
sandhds
2003-09-11 01:14:54
DataGrid如何行选中
...全文
45
7
打赏
收藏
DataGrid如何行选中
DataGrid如何行选中
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ArEoN
2003-09-11
打赏
举报
回复
我帮你写一个datagrid事件:单击datagrid中某个单元格即选定该行
private void yourDataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hit = this.yourDataGrid.HitTest(pt);
if(hit.Type == DataGrid.HitTestType.Cell)
{
this.yourDataGrid.CurrentCell = new DataGridCell(hit.Row, hit.Column);
this.yourDataGrid.Select(hit.Row);
}
}
顺便说一句,分这么重要么?给5分?
jrh9981
2003-09-11
打赏
举报
回复
增加一个选择列,可以把选择列跟数据列绑定,就可以选择一行了
peng0929
2003-09-11
打赏
举报
回复
int i = 7;
DataGrid1.SelectedIndex = i;
skykevin
2003-09-11
打赏
举报
回复
把dataGrid设置为只读属性,即使用户还可以在网格中用鼠标点击而选择某一格,但改不了其中的数据。
sandhds
2003-09-11
打赏
举报
回复
楼上两位大侠:
运用上面的方法设置以后,用户还可以在网格中用鼠标点击而选择某一格
我的意思是设置以后用户只能进行行选中了。
dotnba
2003-09-11
打赏
举报
回复
grd.Select(0)
skykevin
2003-09-11
打赏
举报
回复
CurrencyManager cm;
cm=(CurrencyManager) BindingContext[dataGrid1.DataSource];
如要让第行选中(小三角移到该行),则如下表示:
cm.Position=4
WPF中
DataGrid
得到其中一
行
的值
WPF中
DataGrid
得到其中一
行
的值
easyUI
datagrid
行
上移,下移,置顶,置底的方法
easyUI
datagrid
行
上移,下移,置顶,置底的方法
easyui+jsp+servlet上手实例
完整的easyui的
datagrid
使用实例,带你快速入门,一步上手
DataGrid
全选并获取
选中
条目数
DataGrid
全选并获取
选中
条目数
C#实现给
DataGrid
单元
行
添加双击事件的方法
主要介绍了C#实现给
DataGrid
单元
行
添加双击事件的方法,较为详细的分析了C#给
DataGrid
单元添加双击事件的步骤及相关实现代码,具有一定参考借鉴价值,需要的朋友可以参考下
C#
110,538
社区成员
642,577
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章