我在自定义控件中有这个代码:
Class CustomControl1
Inherits TextBox
Protected Overrides Sub WndProc(ByRef m As Message)
Select Case m.Msg
' WM_MOUSEWHEEL
Case &H20A, &H20E
' WM_MOUSEHWHEEL
If Me.ScrollBars = ScrollBars.None AndAlso Me.Parent IsNot Nothing Then
m.HWnd = Me.Parent.Handle
End If
' forward this to your parent
MyBase.WndProc(m)
Exit Select
Case Else
MyBase.WndProc(m)
Exit Select
End Select
End Sub
End Class
假设这是我在网上找到的解决方案,但不起作用。有人可以告诉我,如果它是正确的还是有另一种方式?