ALX
Well-known member
I'm trying to limit the number of rows that are scrolled with each mouse wheel indent on a Data Grid View as it displays thumbnail bitmaps. The standard 3 rows is disorienting for the user and I'd like it to resemble Windows Explorer when scrolling through thumbnails at 1 row per indent. I've tried to do my homework and came up with the following ridiculous code below which of course doesn't work at all...
Apparently there are no quick & dirty ways to do this by handling the MouseWheel event since the MouseEventArgs does not have a ".handled" property to set. It seems I need to set up a WndProc listener and handle the wheel event by sending UP & DOWN keys to the DGV. I know this does not consider the wheelDelta value. I'm still trying to get this to trap the MouseWheel event.
VB.NET:
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub WndProc(ByRef m As Message)
If (m.Msg = &H20A) Then
If CInt(m.WParam) < 0 Then
SendKeys.Send("{DOWN}")
ElseIf CInt(m.WParam) > 0 Then
SendKeys.Send("{UP}")
End If
Else
MyBase.WndProc(m)
End If
End Sub
Apparently there are no quick & dirty ways to do this by handling the MouseWheel event since the MouseEventArgs does not have a ".handled" property to set. It seems I need to set up a WndProc listener and handle the wheel event by sending UP & DOWN keys to the DGV. I know this does not consider the wheelDelta value. I'm still trying to get this to trap the MouseWheel event.