@Alfie Chadd , If you want to use One button to limit the visiable of other buttons.
You could refer to the following code to use a bool variable:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
PowerButton.Visible = false;
SignOutButton.Visible = false;
}
bool t=true;
private void Btn_Home_Click(object sender, EventArgs e)
{
if(t)
{
PowerButton.Visible = true;
SignOutButton.Visible = true;
t=false;
Console.WriteLine("Show");
}
else
{
PowerButton.Visible = false;
SignOutButton.Visible = false;
t = true;
Console.WriteLine("not Show");
}
}
private void PowerButton_Click(object sender, EventArgs e)
{
//PowerRestartButton.Visible = true;
//PowerShutDownButton.Visible = true;
}
}
Result:
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.