c # comment FormWindowState.Normal
-
20-09-2019 - |
Question
J'ai ce code:
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
about About = new about();
About.ShowDialog();
}
il minimise l'état de fenêtre parent pour minimiser et affiche un formulaire de démarrage.
ma question est quand l'écran de démarrage ferme comment puis-je revenir à parentwindowstate.normal?
La solution
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
about About = new about();
About.ShowDialog();
this.WindowState = FormWindowState.Normal;
}
Autres conseils
Si vous utilisez ShowDialog au lieu de Afficher; vous pouvez ajouter
this.WindowState = FormWindowState.Normal;
après l'appel ShowDialog. (ShowDialog bloque, à la différence Show.)
Appel ShowDialog () comme ceci:
About.ShowDialog(this);
Ensuite, dans le cas FormClosing du formulaire A propos, mettre:
this.Parent.WindowState = WindowState.Normal;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow