0

と呼ばれるストリップ メニューを持つ親フォームがありますtopMenu

「SignIn」と​​いう子フォームがあり、ユーザーがログインしているときに、を無効にしtopMenu.item.logInて有効にしたいと考えていtopMenu.item.Logoutます。

topMenu子フォームから親コンテナを無効にするにはどうすればよいですか?

ユーザーがストリップ メニュー項目の [サインイン] をクリックすると、次のコードが実行されます。

private void signInToolStripMenuItem_Click(object sender, EventArgs e)
{
    var newMDIChild = new SignIn();

    // Set the Parent Form of the Child window.
    newMDIChild.MdiParent = this;

    newMDIChild.Dock = DockStyle.Fill;
    // Display the new form.
    newMDIChild.Show();

}

ユーザーがユーザー名とパスワードを入力した後、次のコードが実行されます

public partial class SignIn : Form
{
    public SignIn()
    {
        InitializeComponent();
    }

    private void btn_signin_Click(object sender, EventArgs e)
    {
        UserInfo.Autherized = true;

        // here I want to disable the sign in menu item
        // and enable the sign out menu item which is located on the parent form
        this.Close();
    }
}
4

1 に答える 1