//********************************************************* // Société: ETML // Auteur: Rowien Bolkensteyn // Date: 01.10.2007 // But: Faire un mini jeu, dans lequel un chevalier // doit se deplacer le moins de coup possible et // être bloqué. //********************************************************** using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace WindowsApplication1 { /// /// Description résumée de Form1. /// public class FrmMain : System.Windows.Forms.Form { public const int INTNBLIGNES = 10; // Nombre de lignes pour le jeu public const int INTCOLONNES = 10; // Nombre de colonnes pour le jeu public const int TAILLECASE = 50; // Défini la taille de la case Button[,] tbl_Tableau = new Button[INTNBLIGNES, INTCOLONNES]; private System.Windows.Forms.Button btnInitialisation; private Button btnQuitter; private Panel panel1; private IContainer components; void CreerBouton() { int intTop = 0; for (int i = 0; i < INTNBLIGNES; i++) { int intLeft = 0; for (int j = 0;j /// Nettoyage des ressources utilisées. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Code généré par le Concepteur Windows Form /// /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas /// le contenu de cette méthode avec l'éditeur de code. /// private void InitializeComponent() { this.btnInitialisation = new System.Windows.Forms.Button(); this.btnQuitter = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); this.SuspendLayout(); // // btnInitialisation // this.btnInitialisation.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnInitialisation.Location = new System.Drawing.Point(24, 529); this.btnInitialisation.Name = "btnInitialisation"; this.btnInitialisation.RightToLeft = System.Windows.Forms.RightToLeft.No; this.btnInitialisation.Size = new System.Drawing.Size(472, 24); this.btnInitialisation.TabIndex = 0; this.btnInitialisation.Text = "Initialisation"; this.btnInitialisation.Click += new System.EventHandler(this.btnInitialisation_Click); this.tbl_Tableau[0, 0].Click += new EventHandler(this.btnTab_Click); // // btnQuitter // this.btnQuitter.Location = new System.Drawing.Point(24, 564); this.btnQuitter.Name = "btnQuitter"; this.btnQuitter.Size = new System.Drawing.Size(472, 24); this.btnQuitter.TabIndex = 1; this.btnQuitter.Text = "Quitter"; this.btnQuitter.UseVisualStyleBackColor = true; // // panel1 // this.panel1.Location = new System.Drawing.Point(10, 10); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(500, 500); this.panel1.TabIndex = 0; // // FrmMain // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(520, 600); this.Controls.Add(this.panel1); this.Controls.Add(this.btnQuitter); this.Controls.Add(this.btnInitialisation); this.Name = "FrmMain"; this.Text = "Le Cavalier Déchainé"; this.Load += new System.EventHandler(this.FrmMain_Load); this.ResumeLayout(false); } #endregion /// /// Point d'entrée principal de l'application. /// [STAThread] static void Main() { Application.Run(new FrmMain()); } private void FrmMain_Load(object sender, EventArgs e) { CreerBouton(); } private void btnInitialisation_Click(object sender, EventArgs e) { InitialiserJeu(); } private void btnTab_Click(object sender, EventArgs e) { InitialiserJeu(); } } }