如何从子窗体启用工具条带 1

  • 本文关键字:工具 启用 窗体 c#
  • 更新时间 :
  • 英文 :


当我关闭子表单时,我正在尝试启用/可见为true。 这是我的示例代码。 我将不胜感激你的帮助。

//This code works perfectly 
private void TSBRekrytering_Click(object sender, EventArgs e)
        {
            FrmRekrytering RekryteringForm = new FrmRekrytering();
            RekryteringForm.MdiParent = this;
            RekryteringForm.Show();
            //Hide toolstrip for the FrmMain or MDI Parent Form
            TSFrmMain.Visible = false;
        }

但是当我关闭FrmRekrytering我想启用主窗体(即 MDI 窗体)的工具行程。

再次感谢。

在父窗体中添加此代码

 private void TSBRekrytering_Click(object sender, EventArgs e)
    {
        FrmRekrytering RekryteringForm = new FrmRekrytering();
        RekryteringForm.Show(this);
        TSFrmMain.Visible = false;
    }
    public string toolstripvalue
    {
        get
        {
            return toolstripvalue;
        }
        set
        {
            toolStrip.Visible = Convert.ToBoolean(value);
        }
    }

和这个子形式的代码,即FrmRekrytering。

  protected override void OnFormClosing(FormClosingEventArgs e)
    {
        ((MDIParent1)this.Owner).toolstripvalue = "true";
    }

最新更新