starxp

listview中有一个属性 EnsureVisible  可以保证选中行在可视范围内.如下描述:

ListView problem
--------------------------------------------------------------------------------

Hello,

Anyone know how to scroll down the listview by code?
Eg. I have 200 items in the listview. When I set the selectedItem to be
item 180, the user cannot see it if he don\'\'t scroll it down.

Thanks!
 
Re: ListView problem
--------------------------------------------------------------------------------

Use the EnsureVisible method. Pass in the index of the item you want to
scroll into view.
____________________
Klaus H. Probst, MVP


那么C#中的DataGridView呢?
虽让DataGridView没有那么直接的方法但是还是可以变通实现的,如下:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
arow.Selected = true;//选中某行
DataGridView.FirstDisplayedScrollingRowIndex = arow.Index; //让选中行显示在可视范围内
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

FirstDisplayedScrollingRowIndex 这个属性的意思蛮不好理解的.

 

文章出处:飞诺网(www.firnow.com):http://dev.firnow.com/course/4_webprogram/asp.net/asp_netshl/2008131/98223.html

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
  • 2021-06-05
  • 2022-01-08
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-02
  • 2021-11-01
  • 2021-11-14
  • 2021-08-17
  • 2021-11-14
  • 2022-12-23
相关资源
相似解决方案