如何操作MDI父窗体控件集从子窗体可见的假 [英] how to manipulate mdi parent form control set visible false from child form
本文介绍了如何操作MDI父窗体控件集从子窗体可见的假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将在mdi父窗体上的图片框的可见性设置为false.我在子窗体上写了以下代码,但没有用...请帮助我
I want to set visibility false of a picturebox that is on mdi parent form. I wrote following code on child form but it doesn''t work...pls help me
private void Bill_Issue_FormClosed(object sender, FormClosedEventArgs e)
{
MasterForm f = new MasterForm();
f.pictureBox1.Visible = true;
}
感谢adv.
Thanks in adv.
推荐答案
您要做的第一件事是通过属性公开父窗体.
例如
以CHILD形式
//在CHILDFORM中创建类型为MDIform的属性
//frmMainMDI
first thing you do is to expose the parent form though properties.
for example
in the CHILD form
//create a properties with the typed of MDIform in CHILDFORM
// frmMainMDI
public frmMainMDI ParentMDI
{
get{return this.ParentForm;}
set{this = value; }
}
以MDI形式这样称呼CHILDFORM
call the CHILDFORM like this in MDI form
frmChild ofrmChild = new frmChild()
ofrmChild.ParentMDI = this;
ofrmChild.show()
在MDIFORM中设置图片框:
setting the picture box in MDIFORM:
ParentMDI.PictureBox.Enable = false;
如果Bill_issue_Form是孩子表格然后尝试
If Bill_issue_Form is a child form then try
private void Bill_Issue_FormClosed(object sender, FormClosedEventArgs e)
{
this.ParentForm.pictureBox1.Visible = false;
}
这篇关于如何操作MDI父窗体控件集从子窗体可见的假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文