怎样在datagrid控件中滚动动指定的一行

jellrey 2005-08-10 12:05:21
我知道一个条件可以在datafrid控件中找到确定的一行.
我怎么才能得到这行的行号,我怎么样让datagrid自动滚动到那一行.
谢谢大虾们的帮助.
...全文
86 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
moksha 2005-08-10
  • 打赏
  • 举报
回复
看起来GirdVScrolled应该是protected event。DataGrid既然没有提供访问这个protected成员的public方法或属性,所以只能继承后用public方法访问啦。不过,这种机制的作用是什么?俺一时想不明白。
namhyuk 2005-08-10
  • 打赏
  • 举报
回复
The DataGrid has a protected GridVScrolled member that can be used to scroll the grid. To use it , you can derive from DataGrid and and a ScrollToRow method.

class MyDataGrid : DataGrid
{
public ScrollToRow(int row)
{
this.GridVScrolled(this, ScrollEventArgs(Type.LargeIncrement, row));
}
}
未经测试。
marvelstack 2005-08-10
  • 打赏
  • 举报
回复
try
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx
fellowcheng 2005-08-10
  • 打赏
  • 举报
回复
BindingContext[yourDataSource].Position=index;
index为你所选的行的索引

或者
直接
DataGrid.Select(index);
jellrey 2005-08-10
  • 打赏
  • 举报
回复
我还是不懂阿!
首先我如何根据条件得到一个索引号呢?datagrid没有根据条件查找得到索引的函数阿!

我要滚动要继承那个东西阿?

我是很菜的菜鸟,请指导!

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧