简体   繁体   中英

DataGridView Scroll Bar not displayed

I am trying to display the scroll bars on datagridview. I absolutely know how to do it but the issue is the scroll bar is not showing.

The major issue is that initially I don't have enough data on the gridView for there to be a need to display scrollBar but I want it displayed anyhow since when user scrolls down (vertically) the program send message to the server which in turn returns more data for the grid. Can I acheive this? Hope you are understanding the problem.

As var as I understand you own a huge junk of data thats to big to get displayed at once. So you just want to update the view on the fly. This seems to me a solution for the so called VirtualMode. In Virtual mode you tell the view. That there are a bunch of iteams but you don't give it to the view. Instead the view asks frequently for new data if they are needed. (eg. your view owns 3000 iteams but only 100 are shown) Then the view will only ask you to provide this 100 while the slider shows there are 2900 more. If you now change the slider. The view is going to ask on the fly for the new 100 iteams while dumping the old once. If the data are not available you just give a dummy (empty entrie) and call an update after the datas are available. I hope that does it.

Try this from the event of Mousewheel

 Private Sub MetroGrid1_MouseWheel(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles MetroGrid1.MouseWheel
     'Put your Codes here where to display Grid Content
 End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM