这个问题已经困扰了我一段时间 - 当试图向下滚动面板时,直到释放鼠标才会移动栏(在其他控件中似乎不是问题)。
在这个论坛http://csharpcode25.appspot.com/question/5080f1624f1eba38a4ca86bf中,用户遇到了同样的问题,并且通过覆盖WndProc给出了一个可能的解决方案 - 不确定在从C#到VB的转换中是否丢失了某些内容但是它只会抛出错误'参数类型'Number'是'System.IntPtr',它不是数字。'在第一行。有什么想法吗?
由于
Public Class Panelx
Inherits Panel
Private Const WM_HSCROLL As Integer = &H114
Private Const WM_VSCROLL As Integer = &H115
Protected Overrides Sub WndProc(ByRef m As Message)
Try
If (m.Msg = WM_HSCROLL OrElse m.Msg = WM_VSCROLL) AndAlso ((CInt(Fix(m.WParam)) And &HFFFF) = 5) Then
' Change SB_THUMBTRACK to SB_THUMBPOSITION
m.WParam = CType((CInt(Fix(m.WParam)) And (Not &HFFFF)) Or 4, IntPtr)
End If
MyBase.WndProc(m)
Catch ex As Exception
EmailError(ex)
End Try
End Sub
End Class
答案 0 :(得分:1)
只需删除对Fix()方法的调用:
If (m.Msg = WM_HSCROLL OrElse m.Msg = WM_VSCROLL) AndAlso ((CInt(m.WParam) And &HFFFF) = 5) Then
' Change SB_THUMBTRACK to SB_THUMBPOSITION
m.WParam = CType((CInt(m.WParam) And (Not &HFFFF)) Or 4, IntPtr)
End If