怎么用鼠标滚轮控制MSHFlexGrid控件的滚动条
答案:2 悬赏:50 手机版
解决时间 2021-02-01 04:32
- 提问者网友:愿为果
- 2021-02-01 00:27
怎么用鼠标滚轮控制MSHFlexGrid控件的滚动条
最佳答案
- 五星知识达人网友:你哪知我潦倒为你
- 2021-02-01 00:54
Private Sub MSHFlexGrid1_GotFocus()
Oldwinproc = GetWindowLong(Me.hwnd, GWL_WNDPROC)
SetWindowLong Me.hwnd, GWL_WNDPROC, AddressOf FlexScroll
End Sub
Private Sub MSHFlexGrid1_LostFocus()
SetWindowLong Me.hwnd, GWL_WNDPROC, Oldwinproc
End Sub
Public Function FlexScroll(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case wMsg
Case WM_MOUSEWHEEL
Select Case wParam
Case -7864320 '向下
SendKeys "{PGDN}"
Case 7864320 '向上
SendKeys "{PGUP}"
End Select
End Select
FlexScroll = CallWindowProc(Oldwinproc, hwnd, wMsg, wParam, lParam)
End Function
Oldwinproc = GetWindowLong(Me.hwnd, GWL_WNDPROC)
SetWindowLong Me.hwnd, GWL_WNDPROC, AddressOf FlexScroll
End Sub
Private Sub MSHFlexGrid1_LostFocus()
SetWindowLong Me.hwnd, GWL_WNDPROC, Oldwinproc
End Sub
Public Function FlexScroll(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case wMsg
Case WM_MOUSEWHEEL
Select Case wParam
Case -7864320 '向下
SendKeys "{PGDN}"
Case 7864320 '向上
SendKeys "{PGUP}"
End Select
End Select
FlexScroll = CallWindowProc(Oldwinproc, hwnd, wMsg, wParam, lParam)
End Function
全部回答
- 1楼网友:躲不过心动
- 2021-02-01 01:38
原因有两个吧
1.你电脑屏幕太小了。
2.你mshflexgrid控件的列太多了,超过你窗口大小了因此出现滚动条。可以把不必要的隐藏了。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯