3
I need to change the opacity of the main form every time the user clicks on the close button. When he clicks on this button the opacity is in this.Opacity = .75;
and opens a new form asking if he wants to close the program.
Close button on the main form:
private void btFechar_Click(object sender, EventArgs e)
{
this.Opacity = .75;
fechar f = new fechar();
f.ShowDialog();
f.Dispose();
}
The problem is that when the user clicks to not close the system in the form "close" the opacity of the main form does not return to this.Opacity = 1;
Button to not close the program:
public void btFecharNAO_Click(object sender, EventArgs e)
{
principal p = new principal();
p.Opacity = 1;
this.Close();
}
Worked perfectly!
– Marlon Pereira
If it worked, mark it as the right answer. :)
– Marco Giovanni
In the close constructor you can set
frmParent.Opacity = .75
, so automatically when you call thefechar
, will change the screen. If you have a project with multiple screens this will be useful.– Marco Giovanni
The @ramaral response makes more sense.
– Marco Giovanni