-1
我創建了一個ParentForm。從ParentForm的菜單上,我從ChildForm菜單項創建一個ChildForm。當創建ChildForm時,我將ParentForm上的Childform菜單項設置爲禁用。 當我們關閉ChildForm時,我必須設置和引用ParentForm 上的ChildForm菜單項。引用父窗體到子窗體
感謝
塔馬斯
我創建了一個ParentForm。從ParentForm的菜單上,我從ChildForm菜單項創建一個ChildForm。當創建ChildForm時,我將ParentForm上的Childform菜單項設置爲禁用。 當我們關閉ChildForm時,我必須設置和引用ParentForm 上的ChildForm菜單項。引用父窗體到子窗體
感謝
塔馬斯
public partial class myParent : Form {
...
...
public myParent {
initChildren();
}
void initiChildren() {
myChildAlpha = new ChildForm();
myChildAlpha.FormClosed += new FormClosedEventHandler(enable_menu)
}
void enable_menu(object sender,FormClosedEventArgs e) {
//check if sender == ChildForm -> if so enable the proper menu
}
}
ParentForm form;
public ChildForm(ParentForm _form) //pass ParentForm as Parameter
{
InitializeComponent();
form = _form; //save Parameter to variable form
}
//raised when Form was closed
private void ChildForm_FormClosed(object sender, FormClosedEventArgs e)
{
//set item to public modifier in properties window or specify getter and setter, then you can set it set it to enabled again like this
//Pseudo: form.menu.item.enabled = true;
}
//create Instance of ChildForm like this "ChildForm child = new ChildForm(this);"
顯示你的代碼.. –
你有什麼迄今所做? –