我做个KTV包厢管理!设计到记时问题!用一个Timer怎么实现同时对多个包厢进行记时啊?我的包厢是以图标的形式放在listview中的!我要点击以开房的包厢图标就可以看到用了多久时间了!请问用Timer该怎么实现啊?

解决方案 »

  1.   

    不用Timer, 开房的时候记下开房的时间,点击时再跟当时的时间比较就行了
      

  2.   

    不用TIMER ,开房的时候使用服务器的时间,结束的时候也使用服务器的时间。结束时间-开始时间=开房时间。
      

  3.   

    Returns the number of minutes between two specified TDateTime values.UnitDateUtilsCategorydatetime routinesDelphi syntax:function MinutesBetween(const ANow, AThen: TDateTime): Int64;C++ syntax:extern PACKAGE __int64 __fastcall MinutesBetween(const System::TDateTime ANow, const System::TDateTime AThen);DescriptionCall MinutesBetween to obtain the difference, in minutes, between two TDateTime values. MinutesBetween counts only entire minutes. Thus, MinutesBetween reports the difference between 9:00:00 AM and 9:00:59:999 AM as 0 because the difference is one millisecond short of an entire minute.
      

  4.   

    var
      a, b, c: TTime;begin
      a := StrToTime('20:05:30');
      b := StrToTime('13:07:50');
      c := a - b;
      showmessage(TimeToStr(c));
    end;
    不过你肯定还要把日期也计算上的
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    var t1,t2:TDateTime;
    time:integer;
    begin
        t1:=strtodatetime('2005-7-14 20:05:30');
        t2:=now;
        time:=round((t2-t1)*24*60);
        ShowMessage('用了'+inttostr(time)+'分钟');
    end;