跨线程调用form控件技巧
private delegate void MethodSocket(object obj);//使用托管
ss = "OK"; this.BeginInvoke(new MethodSocket(InvokerReadMsg), ss);//this指向本窗体,回调函数InvokerReadMsg, private void InvokerReadMsg(object obj)//在这个函数里面可以直接访问Form控件<span style="font-family: Arial, Helvetica, sans-serif;">txtContent</span> { this.txtContent.Text += obj.ToString() + "\r\n"; }
//byte 转string string test = Encoding.Default.GetString(bytes, 0, length); //string 转 byte byte[] bytes = System.Text.Encoding.Default.GetBytes(test);
C# 跨线程调用form控件技巧及byte[]与string型相互转换,布布扣,bubuko.com
C# 跨线程调用form控件技巧及byte[]与string型相互转换
原文地址:http://blog.csdn.net/liucheng5037/article/details/38117761