type
    TDBGrid = class(TCustomDBGrid)
    public
        function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
    end;
 
再在 implementation 寫上實際執行 DoMouseWheel 的函數, 如下 ----
 
implementation
...
...
function TDBGrid.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;MousePos: TPoint): Boolean;
begin
    if WheelDelta <0 then
        datasource.DataSet.Next;
    if wheelDelta>0 then
        DataSource.DataSet.Prior;
    Result := true;
end;
 
新版的 Delphi 就已經支援滑鼠滾輪了。
沒有留言:
張貼留言