MDI的子父关系只能设定2层??

yunhaiC QQ654777694 2010-09-22 05:50:58
请教MDI问题

public frmContainer()
{
InitializeComponent();
frmChild child = new frmChild(this);
child.Show();
}

class frmChild
{
public frmChild(frmContainer Parent)
{
InitializeComponent();
this.MdiParnet = parent;
}

//我现在还有个窗口,它是由frmChild窗口里的一个Button弹出的,我该怎么设置子父关系???
private void btn_Ok_Click(object sender, EventArgs e)
{
M mr = new M((frmContainer)this.MdiParent);
mr.Show();
}
}

编译可以,不过怎么感觉执行的时候不太对劲,请教了
...全文
85 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wuyazhe 的回复:]

应该不会,就你贴的看不出问题。如果例子不保密,发到wuyazhe@yeah.net看看先。或是发到csdn下载频道。
[/Quote]

class frmContainer
{
public frmContainer()
{
InitializeComponent();
}

private void btn_frmChild(object sender,EventArgs e)
{
frmChild child = new frmChild(this);
child.Show();
}
}



class frmChild
{
public frmChild(frmContainer Parent)
{
InitializeComponent();
this.MdiParnet = parent;
}

//我现在还有个窗口,它是由frmChild窗口里的一个Button弹出的,我该怎么设置子父关系???
public static bool blM;
private void btn_Ok_Click(object sender, EventArgs e)
{
blM = true;
M mr = new M((frmContainer)this.MdiParent);
mr.Show();
}
}
上面多加了一个静态变量blM,然后弹出的mr窗口里面一段操作
if(blM == true)
{

}
结果发现blM还是false

兔子-顾问 2010-09-22
  • 打赏
  • 举报
回复
应该不会,就你贴的看不出问题。如果例子不保密,发到wuyazhe@yeah.net看看先。或是发到csdn下载频道。
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 wuyazhe 的回复:]

怎么不对劲
[/Quote]
以前可以自行的窗口报其他错误,而且显示不出来字,鼠标点上去才能显示出来

class frmContainer
{
public frmContainer()
{
InitializeComponent();
}

private void btn_frmChild(object sender,EventArgs e)
{
frmChild child = new frmChild(this);
child.Show();
}
}



class frmChild
{
public frmChild(frmContainer Parent)
{
InitializeComponent();
this.MdiParnet = parent;
}

//我现在还有个窗口,它是由frmChild窗口里的一个Button弹出的,我该怎么设置子父关系???
private void btn_Ok_Click(object sender, EventArgs e)
{
M mr = new M((frmContainer)this.MdiParent);
mr.Show();
}
}

兔子-顾问 2010-09-22
  • 打赏
  • 举报
回复
怎么不对劲
  • 打赏
  • 举报
回复

public frmContainer()
{
InitializeComponent();
frmChild child = new frmChild(this);
child.Show();
}


//这个改成在frmContainer的一个button里面

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧