I am working on a personal project. At one point in the project you have a menu with some buttons, and one of those buttons will:
- Hide current form
- Create a second form and show it through
ShowDialog(this)
- When the second form closes, the first form will be shown again with
Show()
My issue is, that after showing the first form again, a certain border is not being redrawn. The object with this border is called pnlInfoBoard
.
Here is some screenshots to show the problem:
The border appears to become transparent, and this only happens after hiding and showing the form.
I found out that the second form has no influence on this, it is only the act of hiding and showing the form. I had tried providing a fix by explicitly invalidating and updating pnlInfoBoard
however, this appears to have no effect.
Here is the code:
private void btnInstructions_Click(object sender, EventArgs e)
{
this.Hide();
//Instructions frmInstructions = new TowerTitans.Instructions();
//frmInstructions.ShowDialog(this);
this.Show();
pnlInfoBoard.Invalidate();
pnlInfoBoard.Update();
}
Why would this happen?
How do I fix it?