| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1217 人关注过本帖
标题:获取系统时间
只看楼主 加入收藏
wxiaoer2008
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-18
收藏
得分:0 
要想和系统时间同步,要用Timer这个类:
程序代码:
    public partial class Form1 : Form
    {
        Timer timer1= new Timer();
        public Form1()
        {
            InitializeComponent();
            this.timer1.Enabled = true;
            this.timer1.Interval = 200;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text=DateTime.Now.ToString();//label1自己从右边拉一个
        }
    }


[[it] 本帖最后由 wxiaoer2008 于 2008-10-9 20:05 编辑 [/it]]

开源部落http://www.
2008-10-09 20:04
快速回复:获取系统时间
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013375 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved