我需要在更新\ work時在我的DataGridView上平滑優雅的滾動。面板中的DataGridView無法滾動
因爲每次我更新我的DataGridView,它會將滾動條重置爲頂部。 我發現了一個使用FirstDisplayedScrollingRowIndex
屬性的解決方案,但後來我意識到僅僅保存RowIndex是不夠的,我需要將我的注意力放在滾動上。我試圖谷歌它,並發現我需要使用面板。
我試過了,但我不知道如何將我的DGV綁定到Panel。 我在面板中移動它。添加代碼this.panel1.Controls.Add(this.DGV);
並將DGV.ScrollBars
轉爲none
。 我仍然沒有在面板上看到任何滾動條來滾動DGV中的數據。
解決方案我想:
Scrollbar loses focus when datagridview refreshs its content
Problem with DataGridView and scroll position
How can I set the position of my datagrid scrollbar in my winforms app?
你能請,表現出一定的代碼示例。我無法理解如何將其綁定到DGV。 –
我使用Windows窗體,而不是WPF –