cours01/COURS01/FAccueil.cs

58 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace COURS01
{
public partial class EcranAccueil : Form
{
private int nbClickBtnPoussez;
public EcranAccueil()
{
nbClickBtnPoussez = 0;
InitializeComponent();
}
private void btnPoussez_Click(object sender, EventArgs e)
{
if (++this.nbClickBtnPoussez % 2 == 1)
{
this.pictureBox1.Image = global::COURS01.Properties.Resources.Konachan_com___257209_clouds_grass_mifuru_night_original_seifuku_skirt_sky_socks_stars;
this.lblTitre.Text = "yolo";
this.lblTitre.Location = new Point(this.Width / 2 - this.lblTitre.Width / 2, this.lblTitre.Location.Y);
}
else
{
this.pictureBox1.Image = global::COURS01.Properties.Resources._4yfr26g;
this.lblTitre.Text = "Découverte de c#";
this.lblTitre.Location = new Point(this.Width / 2 - this.lblTitre.Width / 2, this.lblTitre.Location.Y);
}
}
private void EcranAccueil_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("Voulez-vous vraiment quiter ?", "Souhait", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
private void btnEntrez_Click(object sender, EventArgs e)
{
EcranPrincipal f = new EcranPrincipal(this);
this.Hide();
f.ShowDialog();//Bloque la fenetre parrent alors que show ne bloque pas le parent
}
}
}