delphi 用lable来显示内容 如何实现首先显示我查询出来的一条记录 然后在一定的时间后再显示下一条记录?

解决方案 »

  1.   

    用timer去next数据集,然后将当前数据写到label上
      

  2.   

    直接用timer里写,定时读取你要的数据,赋值给label。
      

  3.   

    我想实现在 Label1中输出符合条件的内容 在 Label3中实现时间的倒计时
    下面是代码 请大家帮忙  谢谢
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs,DateUtils;type
      TForm1 = class(TForm)
      private
        { Private declarations }
      public
      function test(i:integer):string;    { Public declarations }
      end;
    var
      Arr:array[1..500]of string;
      tCount:integer;implementation
    {$R *.dfm}
    function Tdisplay_frm.test(i:integer):string;
    var  list : TStringlist;
      MonthStr1,DateStr1,MonthStr2,DateStr2:string;
      Mz1, Dz1 :integer;
    begin
    if (Arr[3]<>'100%') then
     begin
      list := TStringlist.Create;
      list.Delimiter := '-';
      list.DelimitedText :=task_tab.FieldByName('endtime').AsString;  MonthStr1:= IntToStr(MonthOf(Date));
      DateStr1:= IntToStr(DayOf(Date));  MonthStr2:=list.Strings[1];
      DateStr2:=list.Strings[2];  Mz1:= strtoint(MonthStr2)-strtoint(MonthStr1);
      Dz1:=strtoint(DateStr2)-strtoint(DateStr1);  tCount:=Mz1*30*24*60*60+Dz1*24*60*60; //倒计时所用的秒 if (strtoint(MonthStr2)=strtoint(MonthStr1))and (strtoint(DateStr2)>strtoint(DateStr1)) then
      begin
       Label1.Caption:=Arr[1]+'还有 '+inttostr(Dz1)+' 天';
      end; end;
    end;
      

  4.   

    procedure Tdisplay_frm.Timer1Timer(Sender: TObject);
    var h,m,s:string;
    begin
    Dec(tCount);angle_tab.First;
    for i:=1 to task_tab.RecordCount do
      begin
        Arr[1]:=angle_tab.FieldByName('name').AsString;
        Arr[2]:=angle_tab.FieldByName('endtime').AsString;
        Arr[3]:=angle_tab.FieldByName('status').AsString;
        test(i);
        angle_tab.Next;
      end;
      h := IntToStr(tCount div 3600);          // 小时
      m := IntToStr((tCount div 60) mod 60);   // 分钟
      s := IntToStr(tCount mod 60);            // 秒
      if Length(h)=1 then h := '0'+h;
      if Length(m)=1 then m := '0'+m;
      if Length(s)=1 then s := '0'+s;
        Label3.Caption :=h+':'+m+':'+s;
      if tCount<=0 then
       begin       // 倒计时结束
        Timer1.Enabled := False;
       end;
    end;end.
      

  5.   

    补充一下 我的数据库中的endtime的时间格式是 2011-03-22 所以我要用分隔符-来分隔 然后获得 月 MonthStr2:=list.Strings[1]; 日 DateStr2:=list.Strings[2];现在的问题是Label1中输出的内容和 Label3中的时间差都不会动
    也就是说只输出了一条记录 而且也没有实现倒计时的功能  请大家帮忙修改修改 非常感谢~~