如何控制ScrollBar,使其按一定的速度向下滚动!高分答谢!

解决方案 »

  1.   

    窗体上一个按钮,一个Timer,一个Scroll
    Timer的Interval为500....单元文件代码如下:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        Button3: TButton;
        ScrollBar1: TScrollBar;
        Timer1: TTimer;
        procedure Button3Click(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button3Click(Sender: TObject);
    begin
      Timer1.Enabled :=True;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      with ScrollBar1 do
      begin
        SetParams(Self.Tag,Min,Max);  //也可以直接用Position属性
        if Self.Tag<Max then
          Self.Tag:=Self.Tag+1
        else
          Timer1.Enabled :=False;
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      Self.Tag:=0;
      with ScrollBar1 do
      begin
        Min:=0;
        Max:=100;
      end;
    end;end.
      

  2.   

    我现在的ScrollBar是指dbgrid中出现的ScrollBar,如何控制使其按一定速度下滑,谢谢!
      

  3.   

    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
       with DBGrid1.DataSource.DataSet do
       begin
           if not Eof then
             Next;
       end;
    end;