导航:
论坛 -> DELPHI技术
斑竹:liumazi,sephil
作者:
2003/5/23 10:23:25
标题:
怎么才能让DBGrid控件的内容跟着滚动条实时滚动?
浏览:2574
加入我的收藏
楼主:
delphi的DBGid控件怎么没有类似PB的Livescroll属性,怎么才能在拖动滚动条时让它的内容也跟着实时滚动?
----------------------------------------------
-
作者:
boy (阿門)
★☆☆☆☆
-
盒子活跃会员
2003/5/23 15:13:17
1楼:
試試 unit dumy1; interface uses Windows, 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; var Form1: 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); begin table1.open; end; end.
----------------------------------------------
Delphi開發◆伺服器架設◆免安裝APACHE,PHP,CGI Perl, MYSQL ★
作者:
2003/5/24 15:29:00
2楼:
谢谢.不过没成功,可能使我没有表达清楚我的意图.我的意思是在用鼠标拖动DBGrid右侧的滑块的时候,让它的内容也跟着动,而不是像默认的状态那样等鼠标键抬起后才滚动内容.
----------------------------------------------
-