c#如何使获取的时间同步 我用DateTime now = DateTime.Now;//获取了当前时间,然后lb1.Content = " "+ now; //可是如何做到在Label.content 里那个时间可以动的望各位大神帮帮我这个新手 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这不是同步的问题,你可以设置一个时钟Timer,间隔时间一秒,在时钟事件中反复调用你的这两句话: DateTime now = DateTime.Now;//获取了当前时间,然后lb1.Content = " "+ now; 就可以了, 在你的Form类中加入这些:System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer(); private void TimerEventProcessor(Object myObject, EventArgs myEventArgs) {DateTime now = DateTime.Now;//获取了当前时间,然后lb1.Content = " "+ now; }//假设你的Form类名是MyForm,在它的Load事件中启动时钟, private void MyForm_Load(object sender, EventArgs e){ myTimer.Tick += new EventHandler(TimerEventProcessor); myTimer.Interval = 1000; myTimer.Start();} 用Timer控件,每过一秒执行一次datatime.now 搞个timer,把你的代码放到timer中,timer的间隔设置为500就行 求QQ 在线状态原理 Microsoft.VisualStudio.TestTools.UnitTesting出错 急!在线等!c#中socket问题? datepart(day,变量) 问题,在线等 難者不會,會者不難,請教各位高手一個簡單的從文件中取字串的問題。 关于 反射 接口 dll 的问题 怎样把N次方的结果转换成int类型? 如何开发一个手机支付的APP 在用remoting时多个线程可否使用一个全局数据连接对象[这样做是否合理] 如何获取菜单项的名称!!! 使用backgroundWorker组件,为什么还会占用主线程,导致卡的现象? linq group 问题
EventArgs myEventArgs) {DateTime now = DateTime.Now;//获取了当前时间,然后lb1.Content = " "+ now;
}//假设你的Form类名是MyForm,在它的Load事件中启动时钟,
private void MyForm_Load(object sender, EventArgs e)
{
myTimer.Tick += new EventHandler(TimerEventProcessor); myTimer.Interval = 1000;
myTimer.Start();}