您当前的位置: 首页 >  ui

程序员正茂

暂无认证

  • 5浏览

    0关注

    283博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C#子线程访问主线程UI

程序员正茂 发布时间:2018-05-18 15:28:27 ,浏览量:5

 private delegate void SetShootRecoordTextCallback(string text);         //在给textBox1.text赋值的地方调用以下方法即可         private void SetShootRecoordText(string text)         {             // InvokeRequired需要比较调用线程ID和创建线程ID             // 如果它们不相同则返回true             if (this.textBox_ShootRecoord.InvokeRequired)             {                 SetShootRecoordTextCallback d = new SetShootRecoordTextCallback(SetShootRecoordText);                 this.Invoke(d, new object[] { text });             }             else             {                 this.textBox_ShootRecoord.Text = text;                 textBox_ShootRecoord.SelectionStart = textBox_ShootRecoord.Text.Length;                 textBox_ShootRecoord.ScrollToCaret();             }                     }         
关注
打赏
1660743125
查看更多评论
立即登录/注册

微信扫码登录

0.0520s