当前上下文中不存在名称 "Invoke "

private   void   timer1_Tick(object   sender,   EventArgs   e)//时钟事件
      {
                        Label   lab   =   new   Label();
                        Random   rm   =   new   Random();
                        int   result   =   rm.Next(0   ,this.Width);
                        int   aTz   =   rm.Next(65,91);
                        lab.AutoSize   =   true;
                        lab.Location   =   new   System.Drawing.Point(result,0);
                        lab.Name   =   Convert.ToChar(result).ToString();
                        //lab.Size   =   new   System.Drawing.Size(41,   12);
                        lab.Text   =   Convert.ToChar(aTz).ToString();
                        lab.Font   =   new   Font( "新宋体 ",13);
                        lab.ForeColor   =   Color.Blue;
                        this.Controls.Add(lab);
                        //
                        Thread   labelThread   =   new   Thread(new   ThreadStart(new   MoveChar(lab,this).Move));
                        labelThread.Start();
                       
        }

public   class   MoveChar
      {
                private   Label   labTeam;
                private   Form   formlab;
                public   MoveChar(Label   lab,   Form   form)
                {
                        labTeam   =   lab;
                        formlab   =   form;

                }
                public   void   Move()
                {
                        while   (true)
                        {
                                Thread.Sleep(100);
                                Invoke(new   MethodInvoker(mm));//当前上下文中不存在名称 "Invoke "
                                if   (this.labTeam.Top   > =   800)
                                {
                                        //this.labTeam.Visible   =   false;
                                        this.labTeam.Dispose();
                                        Thread.CurrentThread.Abort();
                                        break;
                                }
                        }
                }
                public   void   mm()
                {
                        this.labTeam.Top   +=   3;
                }


http://topic.csdn.net/u/20070608/11/d4098716-2718-432e-bacd-d10b6e75968c.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值