全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:911
推到 Plurk!
推到 Facebook!

test code

 
ddy
站務副站長


發表:262
回覆:2105
積分:1169
註冊:2002-07-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-02-24 18:17:53 IP:61.218.xxx.xxx 未訂閱
TwinControl有一onMouseWheel Event(protected). Tform published此event,故From可接受滾輪移動.  TDBGrid 則未published此Event.無法直接使用,但由於為proteced,只要繼承即可使用 試試這個例子, Form上放Table, DataSource, DBGrid各一,Pas 如下unit dumy1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, ComCtrls, DB, DBTables, Grids, DBGrids;type  TDBGrid=class(DBGrids.TDBGrid)public  function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;end;TForm1 = class(TForm)  DBGrid1: TDBGrid;  Table1: TTable;  DataSource1: TDataSource;procedure FormCreate(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;implementation{$R *.dfm}{ TDBGrid }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;end;procedure TForm1.FormCreate(Sender: TObject);begintable1.open;end;end.         發表人 - ddy 於 2003/02/24 18:18:20
系統時間:2024-04-24 19:27:43
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!