Bonjour,
Dans le cadre d'un proje scolaire, je suis en train de réaliser un jeu de FreeCell en C#. Les cartes sont enregistrées dans des fichiers .png. La fenetre principale contient deux boutons. Quand on clique sur le bouton de gauche, c'est censé lancer une nouvelle partie, ce qui passe par l'affichage des cartes. J'ai fait un premier cas d'essai où je demande juste l'affichage d'une carte, et cela ne marche pas. Je ne comprends pas pourquoi. Pourriez vous m'aider ?
Merci d'avance
Ci-joint le code de la fenetre principale :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Design; using System.Text; using System.Windows.Forms; using System.IO; namespace FreeCell { public partial class Form1 : Form { // ajouté a la main private Plateau plateau; public Form1() { InitializeComponent(); plateau = new Plateau(); } private void exit_Click(object sender, EventArgs e) { System.Environment.Exit(0); } private void newGame_Click(object sender, EventArgs e) { plateau.init(); Invalidate(true); } protected void Form1_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawImage(new Bitmap("1.png"), new Point(13, 30)); } } }
Partager