用户操作
[留言]  [发消息]  [加为好友] 
订阅我的博客
XML聚合    FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
pp8403的公告
文章分类
    存档

    原创  线程中的timer 收藏

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Threading;

    namespace WindowsApplication2
    {
        
    public partial class Form1 : Form
        
    {
            System.Threading.Timer timer;

            
    private delegate void setInfo(string msg);
            
    private void setMsg(string msg)
            
    {
                
    this.Invoke(new setInfo(setmsg), new object[] { msg });
            }

            
    private void setmsg(string msg)
            
    {
                txtMsgInfo.AppendText(msg);
            }


            
    private void TimerTick(object state)
            
    {
                setMsg(
    "a");
            }

           

            
    public Form1()
            
    {
                InitializeComponent();
                TimerCallback OnTimerTick 
    = new TimerCallback(TimerTick);
                timer 
    = new System.Threading.Timer(OnTimerTick, null20002000);

            }


        }

    }
     

    发表于 @ 2008年01月26日 15:04:00 | 评论( loading... ) | 编辑| 举报| 收藏

    旧一篇:解决无法单击弹出网页 | 新一篇:在sql中读取excel文件

    • 发表评论
    • 评论内容:
    •  
    Copyright © pp8403
    Powered by CSDN Blog