Torna al Thread

Private Sub DataGridView1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseWheel Dim currentIndex As Integer = Me.DataGridView1.FirstDisplayedScrollingRowIndex Dim scrollLines As Integer = SystemInformation.MouseWheelScrollLines Select Case e.Delta Case 120 'Scrolling up 'We cannot scroll up past row 0. Me.DataGridView1.FirstDisplayedScrollingRowIndex = Math.Max(0, currentIndex - scrollLines) Case -120 'Scrolling down Me.DataGridView1.FirstDisplayedScrollingRowIndex = currentIndex + scrollLines End Select ''Happening when the User used the mouse wheel 'If e.Delta > 0 Then ' SendKeys.Send("{UP}") 'If the wheel is going up 'Else ' SendKeys.Send("{DOWN}") 'If the wheel is going down 'End If End Sub
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5