Http://www.mndsoft.com/blog/article.asp? Id = 901
In this site VB source code "Data Grid drop-down list box controls" (link address: http://www.mndsoft.com/blog/article.asp? In id = 214), the user taomaintao prompts that the scroll wheel and mouse are supported.CodeSome API code is intended to support scroll wheel, but it may not be added by the author later. Based on this, I found a solution (from the Network), taomaintao
You can follow the steps below to modify it.
First, set the "select box style" in the "split" attribute of the DataGrid to 3, that is, to highlight and select the entire row, and add the following code to support it, as long as you move the mouse focus on the Grid Control and scroll the mouse pulley, the grid scroll bar will automatically scroll.
If you need more smooth scrolling and custom scrolling methods, I still have a code to send to you. Study it by yourself.
Example operation method:
Write the following code to the public module:
'Support scroll mouse API ---------------------------------
Public const gwl_wndproc = (-4)
Public const wm_command = & h111
Public const wm_mbuttondown = & h207
Public const wm_mbuttonup = & h208
Public const wm_mousewheel = & h20a
Public oldwinproc as long
Public declare function setwindowlong lib "USER32" alias "setwindowlonga" (byval hwnd as long ,_
Byval nindex as long, byval dwnewlong as long) as long
Public declare function callwindowproc lib "USER32" alias "callwindowproca" (byval lpprevwndfunc as long ,_
Byval hwnd as long, byval MSG as long, byval wparam as long, byval lparam as long) as long
Public declare function getwindowlong lib "USER32" alias "getwindowlonga" (byval hwnd as long ,_
Byval nindex as long) as long
Public Function flexscroll (byval hwnd as long, byval wmsg as long, byval wparam as long, byval lparam as long) as long
'The scroll Yu of the scroll wheel is supported.
Select case wmsg
Case wm_mousewheel
Select case wparam
Case-7864320 'roll down
Sendkeys "{pgdn }"
Case 7864320 'roll up
Sendkeys "{pgup }"
End select
End select
Flexscroll = callwindowproc (oldwinproc, hwnd, wmsg, wparam, lparam)
End Function
'Support scroll mouse API ---------------------------------
'Write the following code to the gotfocus event of the table control.
Private sub control name_gotfocus ()
Oldwinproc = getwindowlong (Me. hwnd, gwl_wndproc)
Setwindowlong me. hwnd, gwl_wndproc, addressof flexscroll
End sub
'Write the following code to the lostfocus event of the table control.
Private sub control name_lostfocus ()
Setwindowlong me. hwnd, gwl_wndproc, oldwinproc
End sub