INT型的数据,比如4210,转化为时间是1小时10分钟10秒,比如通过代码计算得到a=1,b=10,c=10,怎样把它转换成CString类型在EDIT控件显示成1:10:10呢?如果在EDIT里显示成1:10:10后,怎么让它隔2秒更新一次呢,变成1:10:12依次下去,如果在EDIT不能实现这个功能,用Date Time Picker能实现么。

解决方案 »

  1.   

    处理2秒更新一次的问题,可以使用对话框的SetTimer来实现。
      

  2.   

    4210,不就是小时*3600+分钟*60+秒吗,自己除一下就能得到时分秒了,然后格式化输出
    http://www.cnblogs.com/kingln/archive/2009/07/27/1531853.html
      

  3.   

    int Hours, Hour, Minutes, Minute, Seconds, Second;CTime currenttime;Hours = long(currenttime.GetHour())/10;  //获取小时
    Hour = long(currenttime.GetHour())%10;
    Minutes = long(currenttime.GetMinute())/10; //获取分钟
    Minute = long(currenttime.GetMinute())%10;
    Seconds = long(currenttime.GetSecond())/10; //获取秒速
    Second = long(currenttime.GetSecond())%10; CString showtime = NULL;
    showtime.Format("时间:%d%d:%d%d:%d%d\n",Hours,Hour,Minutes,Minute,Seconds,Second);//格式化时间用SetTime()设置刷新时间试试看这样的!