Solve a method about the mouse wheel in DBGRID.

zhaozj2021-02-16  131

Method for solving the mouse scroll of DBGRID 1. Add in .h file:

Private: // Add Declaration VOID __FASTCALL (__closure * oldproc); void __fastcall newproc (tMessage & Message);

2. Add in .cpp file: // Add the following statement to the Oldproc = DBGRID1-> WINDOWPROC; DBGRID1-> WindowProc = NewProc;

void __fastcall TForm1 :: NewProc (TMessage & Message) {if (Message.Msg == WM_MOUSEWHEEL) {int z = GET_WHEEL_DELTA_WPARAM (Message.WParam); Message.Msg = WM_VSCROLL; if (z> 0) Message.WParam = SB_LINEUP; else Message.wparam = sb_linedown;} OldProc (Message);

转载请注明原文地址:https://www.9cbs.com/read-8510.html

New Post(0)