bestlong 怕失憶論壇

標題: Delphi DbGrid 滾輪不正常問題解決 [打印本頁]

作者: bestlong    時間: 2010-10-29 15:08     標題: Delphi DbGrid 滾輪不正常問題解決

參考來源 http://www.cnblogs.com/huangcong/archive/2010/08/22/1805718.html
  1. unit Unit1;

  2. interface

  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls;

  6. type
  7. TDBGrid=class(DBGrids.TDBGrid)
  8.     public
  9.     function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
  10.     end;

  11. TForm1 = class(TForm)
  12.     DataSource1: TDataSource;
  13.     DBGrid1: TDBGrid;
  14.     ADOTable1: TADOTable;
  15.     Edit1: TEdit;
  16. private
  17.     { Private declarations }
  18. public
  19.     { Public declarations }
  20. end;

  21. var
  22. Form1: TForm1;

  23. implementation

  24. {$R *.dfm}
  25. function TDBGrid.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
  26.     MousePos: TPoint): Boolean;
  27. begin
  28.     if WheelDelta < 0 then
  29.     datasource.DataSet.Next;
  30.     if wheelDelta > 0 then
  31.     DataSource.DataSet.Prior;
  32. end;

  33. end.
複製代碼





歡迎光臨 bestlong 怕失憶論壇 (http://www.bestlong.idv.tw/) Powered by Discuz! X1.5