zoukankan      html  css  js  c++  java
  • 线程中访问控件

    记录一下一个比较通用的做法 线程中访问控件。

            private delegate void SetWebBorswerText(string value);
            private void SetValue(string value)
            {
                if (this.InvokeRequired)
                {
                    SetWebBorswerText d = new SetWebBorswerText(SetValue);
                    object arg = (object)value;
                    this.Invoke(d, arg);
                }
                else
                {
                    this.webBrowser1.DocumentText = value;
                }
            }
    
            private delegate string GetTextHandle(TextBox control);
            private string GetText(TextBox control)
            {
                if (this.InvokeRequired)
                {
                    return (string)this.Invoke(new GetTextHandle(this.GetText), control);
                }
                else
                {
                    return ((TextBox)control).Text;
                }
            }
  • 相关阅读:
    centos7安装kde桌面
    centos7安装NVIDIA驱动
    15日报
    11日报
    14日报
    奖励加分
    课程建议
    13日报
    12日报
    每日总结1213
  • 原文地址:https://www.cnblogs.com/wonderfuly/p/2650859.html
Copyright © 2011-2022 走看看