Claude Azoulai
Messages postés26Date d'inscriptionmercredi 11 août 2004StatutMembreDernière intervention13 avril 2013
-
12 avril 2013 à 15:51
Claude Azoulai
Messages postés26Date d'inscriptionmercredi 11 août 2004StatutMembreDernière intervention13 avril 2013
-
13 avril 2013 à 18:12
Bonjour à tous
J'ai deux formulaires, Form1 et Form2.
Quand Form1 est affiché, j'ouvre Form2 et je minimise Form1
Sur Form2, j'ai un bouton button1.
Quand je clique sur button1, j'appelle une routine public « Ouvre_Form1 »qui se trouve sur Form1.
Dans cette routine, j'ai écrit :
this.WindowState = FormWindowState.Normal;
Bien que le programme exécute cette ligne, il ne déclenche pas d'erreur, mais mon formulaire reste toujours minimisé dans la barre des tâches
J'ai fait une application identique en VB.Net, et là ça fonctionne
S'agit-il d'un Bug ? Ou bien, en tant que débutant, je me débrouille très mal.
Voici Form1.cs
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Shown(object sender, EventArgs e)
{
Form2 fr2 = new Form2();
fr2.Show();
fr2.Top = this.Top;
fr2.Left = this.Left + this.Width;
this.WindowState = FormWindowState.Minimized;
}
public void Ouvre_Form1()
{
this.WindowState = FormWindowState.Normal;
}
}
}
Voici Form2.cs
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
Form1 frm1 = new Form1();
public Form2()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
frm1.Ouvre_Form1();
}
}
}