关于线程中调用修改主窗体中的控件 在一个窗体中创建一个线程,线程中的方法需要修改这个窗体中控件的属性,比如显隐等,可是调用时说不可修改创建线程窗体的控件,请高人指教如何实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用委托,invoke,我刚碰到过我还有个问题呢,有时间帮我看下http://topic.csdn.net/u/20110823/15/6e02718d-fedb-475e-b142-132dcb9634e4.html?98078 例:private delegate void WriteTxtDelegate(TextBox tb,string p_info); private void WriteTextBox(TextBox tb,string p_info) { if (this.InvokeRequired) { this.BeginInvoke(new WriteTxtDelegate(WriteTextBox), new object[] { tb, p_info }); } else { lock (sTxtBoxObj) { try { int intLine = System.Text.RegularExpressions.Regex.Matches(tb.Text, "\r\n").Count; if (intLine > 200) tb.Text = DateTime.Now.ToString() + ":" + p_info + "\r\n"; else tb.Text += DateTime.Now.ToString() + ":" + p_info + "\r\n"; tb.Select(tb.TextLength, 0); tb.ScrollToCaret(); } catch { } } } }还有,你给的分太少了 private void setTextBox1Visible_Click(object sender, EventArgs e){ Action func = () => { this.textBox1.Visible = true; }; if (this.textBox1.InvokeRequired) { this.textBox1.Invoke(func); } else { func(); }} 要学习看我这个http://topic.csdn.net/u/20110823/15/6e02718d-fedb-475e-b142-132dcb9634e4.html 兄弟们啊,c#在win7下调用一个exe,需要管理员权限怎么办? 【求助】C/S里的listView,Checkboxes怎么实现全选?? C# winform编程布局设置 backgroundworker的问题 关于代码抠像的问题 C#关于存储和显示图片的问题!!请高手指点啊!!在线等!!!!!!!! 请问怎样能够实现画矢量图呢?并且要求能够选择对像(点线面)? 一个简单的问题,用抽象类到底有什么好处呢? C#实现HTML原码解析,为DOMTree的调查及使用方法 如何动态删除控件? c# winform treeview DataGridView的选择问题
我还有个问题呢,有时间帮我看下http://topic.csdn.net/u/20110823/15/6e02718d-fedb-475e-b142-132dcb9634e4.html?98078
private delegate void WriteTxtDelegate(TextBox tb,string p_info);
private void WriteTextBox(TextBox tb,string p_info)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new WriteTxtDelegate(WriteTextBox), new object[] { tb, p_info });
}
else
{
lock (sTxtBoxObj)
{
try
{
int intLine = System.Text.RegularExpressions.Regex.Matches(tb.Text, "\r\n").Count;
if (intLine > 200)
tb.Text = DateTime.Now.ToString() + ":" + p_info + "\r\n";
else
tb.Text += DateTime.Now.ToString() + ":" + p_info + "\r\n"; tb.Select(tb.TextLength, 0);
tb.ScrollToCaret();
}
catch { }
}
} }还有,你给的分太少了
private void setTextBox1Visible_Click(object sender, EventArgs e)
{
Action func = () =>
{
this.textBox1.Visible = true;
};
if (this.textBox1.InvokeRequired)
{
this.textBox1.Invoke(func);
}
else
{
func();
}
}
要学习看我这个
http://topic.csdn.net/u/20110823/15/6e02718d-fedb-475e-b142-132dcb9634e4.html