开发者

Handling Mouse Scroll event of window datagrid in C#

开发者 https://www.devze.com 2023-01-29 15:13 出处:网络
Can anybody tell me how to handle mouse scroll event(vertical scroll) 开发者_如何学Goin a datagrid? If i scroll the mouse scroller, then datagrid will scrolls. I want to get rowIndex of datagrid\'s ro

Can anybody tell me how to handle mouse scroll event(vertical scroll) 开发者_如何学Goin a datagrid? If i scroll the mouse scroller, then datagrid will scrolls. I want to get rowIndex of datagrid's row that is displayed at the top when scroll the grid vertically.

can any body help me?


Use the FirstDisplayedScrollingRowIndex property.


Use DataGridView Scroll event

 if (e.ScrollOrientation == ScrollOrientation.VerticalScroll)
 {
      int i = dataGridView1.FirstDisplayedCell.RowIndex;
 }


You can use MouseWheel and/or PreviewMouseWheel events of the DataGrid MouseWheel fires when the user ended scrolling, whilst the Preview one fires when the user is about to scroll

Concerning the topmodt drawn index, i cant say anything :/

Hope it helps :p

0

精彩评论

暂无评论...
验证码 换一张
取 消