我尝试使用可扩展菜单制作WinForm
应用。我试图创建一个方法来改变form1
中的面板属性,但即使它不是,它也会看到该值为false?我收到消息框"识别为假"。而不是代码我宁愿一个很好的解释
private void JobSelectButton_Click(object sender, EventArgs e)
{
//button to open a panel with "menu"
if (jobPanel.Visible == false)
{
// the panel is visible from this point
jobPanel.Visible = true;
}
else
{
jobPanel.Visible = false;
}
}
public void fla(bool flag)
{ //method inside form1 and it should make jobPanel.Visible = false
if (jobPanel.Visible == false)
MessageBox.Show("recognition as false");
else jobPanel.Visible = false;
}
private void notification_MouseClick(object sender, MouseEventArgs e)
{ // user control that will call the method
caseNBvalue = lbl_caseNB.Text;
profile f2 = new profile();
f2.fla(true);
}