您当前的位置: 首页 >  c#

彭世瑜

暂无认证

  • 4浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C#编程:用Thread获取系统时间-3_彭世瑜_新浪博客

彭世瑜 发布时间:2017-04-22 18:24:42 ,浏览量:4

C#编程:用Thread获取系统时间-3
private void button1_Click(object sender, EventArgs e)
        {
            System.Threading.Thread p_thread =
                new System.Threading.Thread(
                    () =>
                    {
                        while (true)
                        {
                            this.Invoke(
                                (MethodInvoker)delegate()
                                {
                                    this.Refresh();
                                    Graphics p_graphics =
                                        CreateGraphics();
                                    p_graphics.DrawString(
                                        "系统时间: " + DateTime.Now.ToString(
                                            "yyyy年MM月dd日hh时mm分ss秒"
                                        ), new Font("宋体", 15),
                                        Brushes.Blue,
                                        new Point(10, 10));
                                });
                            System.Threading.Thread.Sleep(1000);
                        }
                    });
            p_thread.IsBackground = true;
            p_thread.Start();
        }
关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.0939s