delphi dbgrid支持鼠标滚动浏览

 应用组件:ApplicationEvents   (组件位置:delphi7->additional->ApplicationEvents)

procedure Tfrmmain.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
begin


if (DBGrid1.Focused) And (Msg.message = WM_MOUSEWHEEL) then
  begin
    if Msg.wParam > 0 then
      SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_UP, 0)
    else
      SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_DOWN, 0);

    Handled := True;
  end;

end;

你可能感兴趣的:(Delphi)