在 MDI 的主窗体中,调用以下代码显示子窗体FrmSZBOB frmSZBOB = new FrmSZBOB();
frmSZBOB.MdiParent = this;
frmSZBOB.WindowState = FormWindowState.Maximized;
frmSZBOB.Show();报告如下错误:Controls created on one thread cannot be parented to a control on a different thread.
parameter name:value不知道该如何解决。
请帮忙
frmSZBOB.MdiParent = this;
frmSZBOB.WindowState = FormWindowState.Maximized;
frmSZBOB.Show();报告如下错误:Controls created on one thread cannot be parented to a control on a different thread.
parameter name:value不知道该如何解决。
请帮忙
解决方案 »
- 一个数字图像书里的问题,求解
- Linq问题
- 谁能给个代码例子来解释什么叫delegate?看了半天文档一头雾水。
- 数据层,业务逻辑层,表示层,加上实体规范层、数据工厂层、数据接口层,一共6各层次了,还是3层模式吗?
- 请教编写一个c#程序,能够显示revit设计的building 3d模型
- 请问C#window 的ListView怎样隐藏列啊?不考虑Remove
- 问一个关于权限管理的问题,easy
- 怎样把从数据库读取的数据显示到listview中
- 请问每单击一次按钮,+1怎么总是加不了呢?急死我了!~!!!!!!!!!!!!!!!!!!!!!!!!
- 请教DevExpress大神,DevExpress中生成条形码的控件是哪个?
- 一个算法问题?
- MM美工50分问个问题! 我要怎么设置才能让做的网页不受屏幕分辨率的影响.
frmSZBOB.MdiParent = this;
frmSZBOB.WindowState = FormWindowState.Maximized;
frmSZBOB.Show(); 代码没有问题 可能是你其他部分代码的问题
form1.MdiParent = this;
form1.WindowState = FormWindowState.Maximized;
fform1.Show();
parameter name:value在执行这段代码的时候,首先需要设置主窗体的IsMdiContainer属性为true。
正确的答案应该是将FrmSZBOB窗体的IsMdiContainer属性设为true。
这个组件中间有一些的事件通知在事件响应的代码中,创建MDI子窗口,进行显示操作。
这个时候就会出问题。而在工具栏的按钮的点击事件中,同样的代码显示子窗口,确不会出现问题。
just try
*****************************************************************************
欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
private void button1_Click(object sender, System.EventArgs e)
{
System.Threading.Thread thd=new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadProc));
thd.Start();
}private void ThreadProc()
{
this.Invoke(new System.Threading.ThreadStart(this.ShowForm));
}private void ShowForm()
{
Form f=new Form();
f.MdiParent=this;
f.Show();
}