Procedure OnMouseWheel(Var Msg :TMsg;var Handled:Boolean); // DBGrid鼠标滚动Application.OnMessage:=OnMouseWheel; // 截获鼠标滚动事件 放在主窗体的Create事件Procedure TFrmMain.OnMouseWheel(Var Msg :TMsg;var Handled:Boolean);var AMsg :TMsg;begin if Msg.message = WM_MouseWheel then begin if (Screen.ActiveForm.ActiveControl is TDBGRID) or (Screen.ActiveForm.ActiveControl is TStringGRID) then begin if Msg.wParam > 0 then begin postmessage(Screen.ActiveForm.ActiveControl.Handle,wm_keydown,vk_up,0); postmessage(Screen.ActiveForm.ActiveControl.Handle,wm_keyup,vk_up,0); end else begin postmessage(Screen.ActiveForm.ActiveControl.Handle,wm_keydown,vk_down,0); postmessage(Screen.ActiveForm.ActiveControl.Handle,wm_keyup,vk_down,0); end; Handled:= True; end else begin AMsg:=Msg; end; end else begin AMsg:=Msg; end;end;