简体   繁体   English

DataGridView滚动条未显示

[英]DataGridView Scroll Bar not displayed

I am trying to display the scroll bars on datagridview. 我正在尝试在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. 主要的问题是,最初我在gridView上没有足够的数据,因此不需要显示scrollBar,但是我希望无论如何都要显示它,因为当用户向下(垂直)滚动时,程序会将消息发送到服务器,该消息随后又返回网格的更多数据。 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. 在我看来,这似乎是所谓的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. (例如,您的视图拥有3000个iteam,但仅显示了100个),然后视图将只要求您提供100个,而滑块显示的是另外2900个。 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. 该视图将即时询问新的100个iteam,而旧的则要丢弃一次。 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 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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