Boucle sur objet image en visual studio express 2010 c++

Résolu
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013 - 2 août 2012 à 08:40
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013 - 7 août 2012 à 21:13
Bonjour,

Ne connaissant pas très bien le c++,
je souhaiterai faire une boucle sur des images.
Je m'explique:

Voici ce que je fais actuellement
P1-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p2-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p3-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p4-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p5-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p6-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p7-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p8-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p9-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");

Et ce que je souhaite :
for(int i=1;i<10;i++)
{
p & i-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
}

Je vous remercie par avance.

16 réponses

ed73 Messages postés 276 Date d'inscription lundi 8 septembre 2008 Statut Membre Dernière intervention 15 avril 2013 2
2 août 2012 à 09:50
Bonjour

Utilise un tableau au lieu de p1, p2, etc.

for(int i=1;i<10;i++)
{
p[i]-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
}
3
BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 103
2 août 2012 à 10:50
Hello,

Plutôt ceci:
Image img = Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
for(int i=1;i<10;i++) // bien sûr, remplace 10 par la taille de ton tableau
{ 
  p[i]->Imag e= img; 
}


En passant, ça me dérange d'aller chercher une image dans le répertoire musique...

@+
Buno, Admin CS
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
3
mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023
2 août 2012 à 11:21
les solutions proposées te font passer par un tableau

au lieu d'avoir p1, p2, p3, ...
tu auras p[1], p[2], p[3], ...


c'est à toi de modifier ton code, pour que chaque appel à pX soit remplacé par son correspondant tableau p[X]
3
BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 103
2 août 2012 à 11:22
ça ne fonctionne pas non plus.

Un peu court comme retour...

Je ne sais pas ce que sont tes objets p, mais tu as des modifications à faire:
au lieu d'avoir de nombreuses variables p1, p2, p3..., ed te propose d'utiliser plutôt un tableau de p


@+
Buno, Admin CS
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
3

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
yann_lo_san Messages postés 1137 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 23 janvier 2016 26
2 août 2012 à 13:19
Salut,

heuuuu int->Image...
Un entier qui contient une image !! c pas cool.

Il faut déclarer un membre de ta classe qui est un tableau de pictureBox

(syntaxe non /cli)
PictureBox* p[9]={NULL};

puis affecter dans l'init du formulaire par exemple :
p[0] = p1; //p1 est déjà un ptr sur pictureBox
p[1] = p2; //p2 aussi
ect...

Maintenant, en manipulant p[0], tu manipule le pictureBox1 ...
3
yann_lo_san Messages postés 1137 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 23 janvier 2016 26
3 août 2012 à 13:45
Salut,

La syntaxe /cli (paramètre à la compilation) permet de faire du c++ .net (avec les classes System::...)
Cela veut dire "Common Language Infrastructure"
(avec extentions managées)

D'ou la syntaxe différente avec du C++ win32 natif.
Par exemple les pointeurs avec ^ gcnew alors qu'en natif c'est * new ect..

Ensuite,
tes pictures box sont déjà déclarés car visual studio génère automatiquement le code lorsque tu fais glisser un controle sur le formulaire, les allocations sont faites dans InitializeComponent.

Rien ne t'empèche donc de déclarer des variables membres dans ta classe ref class Form1
En dessous du dernier pictureBox :
private: System::Windows::Forms::PictureBox^ p6;

// déclare un tableau
array^ p;

// alloue 6 éléments
array^ p = gcnew array(6);

// Affecte leurs valeurs références dans le constructeur, après l'appel à InitializeComponent();

Form1(void)
{
InitializeComponent();
//TODO: ajoutez ici le code du constructeur
p[0] = p1;
p[1] = p2;
//ect...
}

je ne programme pas en c++ /cli, donc vérifier que l'affectation des références p1, p2... est correcte, il faut peut etre ajouter l'opérateur % mais je suis pas sur.


Bye...
3
yann_lo_san Messages postés 1137 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 23 janvier 2016 26
6 août 2012 à 12:28
Salut,

pour que ça compile comme il faut, il faut :

1 : déclarer le tableau en tant que variable membre comme je te l'ai montré (en dessous des déclarations des pictureBox) :

// déclare un tableau
array^ p;

2 : Par contre l'allocation doit se faire dans le constructeur de la classe (je l'avait pas précisé)

Form1(void) 
{ 
    InitializeComponent(); 
    //TODO: ajoutez ici le code du constructeur 

    // alloue 6 éléments 
    array^ p = gcnew array(6); 

    p[0] = p1; 
    p[1] = p2; 
    //ect... 
} 


bye...
3
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
2 août 2012 à 10:50
Bonjour,
Merci pour la réponse mais j'ai déjà essayer et ça ne fonctionne pas.
A bientôt.
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
2 août 2012 à 10:58
Re, excusez moi je répondais à la réponse de ed73
Au passage comment modifiez un message pour éviter ceci.
pour votre solution je vais essayer,
il est vrai que pour le dossier c'est un peu gênant,je l'avoue c'est qqch que je dois changer.
Merci.
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
2 août 2012 à 11:03
ça ne fonctionne pas non plus.
lorsque j'utilise la méthode p1,p2,p3,p...
ça fonctionne donc je pense que cela ne viens pas du reste du code.
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
2 août 2012 à 11:55
Désolé,je vais tenter d'être un peu plus explicite.
Mes objets sont des picturebox sous visual studio express 2010.
j'en ai 9
Au départ elle se nommées:
PictureBox1, PictureBox2 etc... (propriétée name)
Je l'ai est renomer p1 , p2 ,p3 etc.. pour simplifier
Je comprends ce que vous me dites,mais lorsque j'essai les codes proposées il ne compile pas,
voici le message d'erreur:
error C2065: 'p' : identificateur non déclaré
error C2227: la partie gauche de '->Image' doit pointer vers un type class/struct/union/générique
======== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========

Merci pour votre compréhension.
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
2 août 2012 à 12:20
Je fais ça mais rien ne fonctionne:
for(int i=1;i<10;i++) 

{ 
    int p[9]; 
p[i]->Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
}

Je sais bien que cela viens de moi mais je ne comprend pas comment passé cette propriété name en variable
Au plaisir de vous lire.
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
3 août 2012 à 09:24
Bonjour,
Merci pour votre réponse.
Le problème dans tout ceci c'est moi (je ne comprend rien),je ne sais pas ou je doit placer le code car si je le copie et le colle je doute que je le place correctement.
Que voulez vous dire par (syntaxe non/cli)
j'ai creer une classe image j'ai image.h et image.cpp
es ce que cela va me servir ou pas??
comment et ou dois je intégrer le code:
voici le code de mon projet:(bien sur je vous rappel que je suis novice et que j'ai développé ceci avec le peu de connaissance et bidouille que j'ai réussit a faire et conseil que j'ai eut sur d'autre fil)
#pragma once

namespace jeupapillons {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

std::vectormes_nombres;
std::vectorcompare_idem;
int reponse;
int faute;
int maxi;
int stop;
int nombre;
int j;
char titre;


// variable fmod
FMOD_RESULT result;
    FMOD_SYSTEM *system;
FMOD_SOUND *musique;			
    FMOD_RESULT resultat;
    



/// <summary>
/// Description résumée de Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//			

//TODO: ajoutez ici le code du constructeur
//
}

protected:
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}

private: System::Windows::Forms::PictureBox^  p1;
private: System::Windows::Forms::PictureBox^  p2;
private: System::Windows::Forms::PictureBox^  p3;
private: System::Windows::Forms::PictureBox^  p4;
private: System::Windows::Forms::PictureBox^  p5;
private: System::Windows::Forms::PictureBox^  p6;
protected: 






private: System::Windows::Forms::TextBox^  textBox1;
private: System::Windows::Forms::PictureBox^  p7;
private: System::Windows::Forms::PictureBox^  p8;
private: System::Windows::Forms::PictureBox^  p9;
private: System::Windows::Forms::Button^  button1;
private: System::Windows::Forms::TextBox^  textBox2;
private: System::Windows::Forms::Button^  button2;

private: System::Windows::Forms::Button^  ouioui;
private: System::Windows::Forms::Button^  button3;
private: System::Windows::Forms::Button^  button4;
private: System::Windows::Forms::Button^  button5;
private: System::Windows::Forms::Button^  button6;
private: System::Windows::Forms::Button^  button7;
private: System::Windows::Forms::Button^  button8;
private: System::Windows::Forms::Button^  button9;
private: System::Windows::Forms::Button^  button10;
private: System::Windows::Forms::Button^  button11;
private: System::Windows::Forms::Button^  button12;
private: System::Windows::Forms::Button^  button13;
private: System::Windows::Forms::Button^  button14;
private: System::Windows::Forms::Button^  button15;
private: System::Windows::Forms::Button^  button16;
private: System::Windows::Forms::Button^  button17;








private:
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>


System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->p1 = (gcnew System::Windows::Forms::PictureBox());
this->p2 = (gcnew System::Windows::Forms::PictureBox());
this->p3 = (gcnew System::Windows::Forms::PictureBox());
this->p4 = (gcnew System::Windows::Forms::PictureBox());
this->p5 = (gcnew System::Windows::Forms::PictureBox());
this->p6 = (gcnew System::Windows::Forms::PictureBox());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->p7 = (gcnew System::Windows::Forms::PictureBox());
this->p8 = (gcnew System::Windows::Forms::PictureBox());
this->p9 = (gcnew System::Windows::Forms::PictureBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->ouioui = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->button5 = (gcnew System::Windows::Forms::Button());
this->button6 = (gcnew System::Windows::Forms::Button());
this->button7 = (gcnew System::Windows::Forms::Button());
this->button8 = (gcnew System::Windows::Forms::Button());
this->button9 = (gcnew System::Windows::Forms::Button());
this->button10 = (gcnew System::Windows::Forms::Button());
this->button11 = (gcnew System::Windows::Forms::Button());
this->button12 = (gcnew System::Windows::Forms::Button());
this->button13 = (gcnew System::Windows::Forms::Button());
this->button14 = (gcnew System::Windows::Forms::Button());
this->button15 = (gcnew System::Windows::Forms::Button());
this->button16 = (gcnew System::Windows::Forms::Button());
this->button17 = (gcnew System::Windows::Forms::Button());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p1))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p2))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p3))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p4))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p5))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p6))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p7))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p8))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p9))->BeginInit();
this->SuspendLayout();
// 
// p1
// 
this->p1->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p1.Image")));
this->p1->Location = System::Drawing::Point(61, 85);
this->p1->Name = L"p1";
this->p1->Size = System::Drawing::Size(43, 37);
this->p1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p1->TabIndex = 1;
this->p1->TabStop = false;
// 
// p2
// 
this->p2->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p2.Image")));
this->p2->Location = System::Drawing::Point(176, 178);
this->p2->Name = L"p2";
this->p2->Size = System::Drawing::Size(43, 37);
this->p2->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p2->TabIndex = 2;
this->p2->TabStop = false;
// 
// p3
// 
this->p3->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p3.Image")));
this->p3->Location = System::Drawing::Point(61, 336);
this->p3->Name = L"p3";
this->p3->Size = System::Drawing::Size(43, 37);
this->p3->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p3->TabIndex = 3;
this->p3->TabStop = false;
// 
// p4
// 
this->p4->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p4->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p4.Image")));
this->p4->Location = System::Drawing::Point(315, 334);
this->p4->Name = L"p4";
this->p4->Size = System::Drawing::Size(43, 37);
this->p4->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p4->TabIndex = 4;
this->p4->TabStop = false;
// 
// p5
// 
this->p5->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p5->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p5.Image")));
this->p5->Location = System::Drawing::Point(357, 178);
this->p5->Name = L"p5";
this->p5->Size = System::Drawing::Size(43, 37);
this->p5->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p5->TabIndex = 5;
this->p5->TabStop = false;
// 
// p6
// 
this->p6->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p6->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p6.Image")));
this->p6->Location = System::Drawing::Point(491, 259);
this->p6->Name = L"p6";
this->p6->Size = System::Drawing::Size(43, 37);
this->p6->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p6->TabIndex = 6;
this->p6->TabStop = false;
// 
// textBox1
// 
this->textBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
| System::Windows::Forms::AnchorStyles::Left) 
| System::Windows::Forms::AnchorStyles::Right));
this->textBox1->BackColor = System::Drawing::SystemColors::Window;
this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
static_cast<System::Byte>(0)));
this->textBox1->Location = System::Drawing::Point(604, 176);
this->textBox1->MaxLength = 10;
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(39, 38);
this->textBox1->TabIndex = 1;
this->textBox1->Visible = false;
this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged_1);
// 
// p7
// 
this->p7->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p7->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p7.Image")));
this->p7->Location = System::Drawing::Point(633, 336);
this->p7->Name = L"p7";
this->p7->Size = System::Drawing::Size(43, 37);
this->p7->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p7->TabIndex = 8;
this->p7->TabStop = false;
// 
// p8
// 
this->p8->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p8->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p8.Image")));
this->p8->Location = System::Drawing::Point(739, 241);
this->p8->Name = L"p8";
this->p8->Size = System::Drawing::Size(43, 37);
this->p8->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p8->TabIndex = 9;
this->p8->TabStop = false;
// 
// p9
// 
this->p9->BackColor = System::Drawing::SystemColors::WindowFrame;
this->p9->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"p9.Image")));
this->p9->Location = System::Drawing::Point(881, 336);
this->p9->Name = L"p9";
this->p9->Size = System::Drawing::Size(43, 37);
this->p9->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->p9->TabIndex = 10;
this->p9->TabStop = false;
// 
// button1
// 
this->button1->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button1->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button1->Location = System::Drawing::Point(214, 3);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(51, 42);
this->button1->TabIndex = 11;
this->button1->Text = L"1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click_1);
// 
// textBox2
// 
this->textBox2->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
| System::Windows::Forms::AnchorStyles::Left) 
| System::Windows::Forms::AnchorStyles::Right));
this->textBox2->BackColor = System::Drawing::SystemColors::Window;
this->textBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
static_cast<System::Byte>(0)));
this->textBox2->Location = System::Drawing::Point(12, 532);
this->textBox2->MaxLength = 10;
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(948, 29);
this->textBox2->TabIndex = 12;
this->textBox2->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
// 
// button2
// 
this->button2->Enabled = false;
this->button2->ForeColor = System::Drawing::SystemColors::WindowFrame;
this->button2->Location = System::Drawing::Point(812, 586);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(148, 27);
this->button2->TabIndex = 13;
this->button2->Text = L"COMMENCER";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
// 
// ouioui
// 
this->ouioui->Location = System::Drawing::Point(12, 587);
this->ouioui->Name = L"ouioui";
this->ouioui->Size = System::Drawing::Size(99, 25);
this->ouioui->TabIndex = 15;
this->ouioui->Text = L"Oui Oui";
this->ouioui->UseVisualStyleBackColor = true;
this->ouioui->Click += gcnew System::EventHandler(this, &Form1::ouioui_Click);
// 
// button3
// 
this->button3->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button3->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button3->Location = System::Drawing::Point(267, 3);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(51, 42);
this->button3->TabIndex = 16;
this->button3->Text = L"2";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
// 
// button4
// 
this->button4->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button4->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button4->Location = System::Drawing::Point(324, 3);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(51, 42);
this->button4->TabIndex = 17;
this->button4->Text = L"3";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
// 
// button5
// 
this->button5->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button5->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button5->Location = System::Drawing::Point(491, 3);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(51, 42);
this->button5->TabIndex = 20;
this->button5->Text = L"6";
this->button5->UseVisualStyleBackColor = true;
this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
// 
// button6
// 
this->button6->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button6->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button6->Location = System::Drawing::Point(434, 3);
this->button6->Name = L"button6";
this->button6->Size = System::Drawing::Size(51, 42);
this->button6->TabIndex = 19;
this->button6->Text = L"5";
this->button6->UseVisualStyleBackColor = true;
this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
// 
// button7
// 
this->button7->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button7->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button7->Location = System::Drawing::Point(381, 3);
this->button7->Name = L"button7";
this->button7->Size = System::Drawing::Size(51, 42);
this->button7->TabIndex = 18;
this->button7->Text = L"4";
this->button7->UseVisualStyleBackColor = true;
this->button7->Click += gcnew System::EventHandler(this, &Form1::button7_Click);
// 
// button8
// 
this->button8->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button8->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button8->Location = System::Drawing::Point(658, 3);
this->button8->Name = L"button8";
this->button8->Size = System::Drawing::Size(51, 42);
this->button8->TabIndex = 23;
this->button8->Text = L"9";
this->button8->UseVisualStyleBackColor = true;
this->button8->Click += gcnew System::EventHandler(this, &Form1::button8_Click);
// 
// button9
// 
this->button9->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button9->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button9->Location = System::Drawing::Point(601, 3);
this->button9->Name = L"button9";
this->button9->Size = System::Drawing::Size(51, 42);
this->button9->TabIndex = 22;
this->button9->Text = L"8";
this->button9->UseVisualStyleBackColor = true;
this->button9->Click += gcnew System::EventHandler(this, &Form1::button9_Click_1);
// 
// button10
// 
this->button10->FlatStyle = System::Windows::Forms::FlatStyle::System;
this->button10->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
this->button10->Location = System::Drawing::Point(548, 3);
this->button10->Name = L"button10";
this->button10->Size = System::Drawing::Size(51, 42);
this->button10->TabIndex = 21;
this->button10->Text = L"7";
this->button10->UseVisualStyleBackColor = true;
this->button10->Click += gcnew System::EventHandler(this, &Form1::button10_Click);
// 
// button11
// 
this->button11->Location = System::Drawing::Point(108, 587);
this->button11->Name = L"button11";
this->button11->Size = System::Drawing::Size(122, 26);
this->button11->TabIndex = 24;
this->button11->Text = L"Inspecteur gadget";
this->button11->UseVisualStyleBackColor = true;
this->button11->Click += gcnew System::EventHandler(this, &Form1::button11_Click);
// 
// button12
// 
this->button12->Location = System::Drawing::Point(227, 587);
this->button12->Name = L"button12";
this->button12->Size = System::Drawing::Size(124, 26);
this->button12->TabIndex = 25;
this->button12->Text = L"La Panthere Rose";
this->button12->UseVisualStyleBackColor = true;
this->button12->Click += gcnew System::EventHandler(this, &Form1::button12_Click);
// 
// button13
// 
this->button13->Location = System::Drawing::Point(349, 587);
this->button13->Name = L"button13";
this->button13->Size = System::Drawing::Size(102, 26);
this->button13->TabIndex = 26;
this->button13->Text = L"Maya l \' abeille";
this->button13->UseVisualStyleBackColor = true;
this->button13->Click += gcnew System::EventHandler(this, &Form1::button13_Click);
// 
// button14
// 
this->button14->Location = System::Drawing::Point(437, 587);
this->button14->Name = L"button14";
this->button14->Size = System::Drawing::Size(120, 26);
this->button14->TabIndex = 27;
this->button14->Text = L"Olive et Tom";
this->button14->UseVisualStyleBackColor = true;
this->button14->Click += gcnew System::EventHandler(this, &Form1::button14_Click);
// 
// button15
// 
this->button15->Location = System::Drawing::Point(545, 587);
this->button15->Name = L"button15";
this->button15->Size = System::Drawing::Size(84, 26);
this->button15->TabIndex = 28;
this->button15->Text = L"Bouba";
this->button15->UseVisualStyleBackColor = true;
this->button15->Click += gcnew System::EventHandler(this, &Form1::button15_Click);
// 
// button16
// 
this->button16->Location = System::Drawing::Point(627, 587);
this->button16->Name = L"button16";
this->button16->Size = System::Drawing::Size(84, 26);
this->button16->TabIndex = 29;
this->button16->Text = L"Babar";
this->button16->UseVisualStyleBackColor = true;
this->button16->Click += gcnew System::EventHandler(this, &Form1::button16_Click_1);
// 
// button17
// 
this->button17->Location = System::Drawing::Point(709, 587);
this->button17->Name = L"button17";
this->button17->Size = System::Drawing::Size(84, 26);
this->button17->TabIndex = 30;
this->button17->Text = L"Pokemon";
this->button17->UseVisualStyleBackColor = true;
this->button17->Click += gcnew System::EventHandler(this, &Form1::button17_Click_2);
// 
// Form1
// 
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"$this.BackgroundImage")));
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
this->ClientSize = System::Drawing::Size(972, 621);
this->Controls->Add(this->button17);
this->Controls->Add(this->button16);
this->Controls->Add(this->button15);
this->Controls->Add(this->button14);
this->Controls->Add(this->button13);
this->Controls->Add(this->button12);
this->Controls->Add(this->button11);
this->Controls->Add(this->button8);
this->Controls->Add(this->button9);
this->Controls->Add(this->button10);
this->Controls->Add(this->button5);
this->Controls->Add(this->button6);
this->Controls->Add(this->button7);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->ouioui);
this->Controls->Add(this->button2);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->button1);
this->Controls->Add(this->p9);
this->Controls->Add(this->p8);
this->Controls->Add(this->p7);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->p6);
this->Controls->Add(this->p5);
this->Controls->Add(this->p4);
this->Controls->Add(this->p3);
this->Controls->Add(this->p2);
this->Controls->Add(this->p1);
this->Cursor = System::Windows::Forms::Cursors::Hand;
this->DoubleBuffered = true;
this->MaximizeBox = false;
this->MinimizeBox = false;
this->Name = L"Form1";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = L"Jeu du papillon  //  calcul premier age";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResizeBegin += gcnew System::EventHandler(this, &Form1::Form1_ResizeBegin);
this->Enter += gcnew System::EventHandler(this, &Form1::Form1_Enter);
this->Leave += gcnew System::EventHandler(this, &Form1::Form1_Leave);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p1))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p2))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p3))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p4))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p5))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p6))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p7))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p8))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->p9))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
int jeu(int f,int s){	
if (textBox1->Text=="") return 1;
if ((textBox1->Text)!=Convert::ToString(reponse))
{
PlaySound(TEXT(".\\musiquejeu\\Erreur.wav"), NULL, SND_FILENAME);
f=faute++;
s=s++;
}
else
{
PlaySound(TEXT(".\\musiquejeu\\Genial.wav"), NULL, SND_FILENAME);		
s=s++;
}
return (f,s) ;
}
int visibilite()

{				
switch (Convert::ToInt32(reponse)){

case 0:
textBox2->Text="RECOMMENCE UNE AUTRE PARTIE";
textBox1->Clear();
textBox1->Focus();
p1->Visible=false;
p2->Visible=false;
p3->Visible=false;
p4->Visible=false;
p5->Visible=false;
p6->Visible=false;
p7->Visible=false;
p8->Visible=false;
p9->Visible=false;
return true ;

case 1:
textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=false;
p3->Visible=false;
p4->Visible=false;
p5->Visible=false;
p6->Visible=false;
p7->Visible=false;
p8->Visible=false;
p9->Visible=false;

return true ;

                 	case 2:

textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=false;
p4->Visible=false;
p5->Visible=false;
p6->Visible=false;
p7->Visible=false;
p8->Visible=false;
p9->Visible=false;

return true ;

case 3 :

textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=true;
p4->Visible=false;
p5->Visible=false;
p6->Visible=false;
p7->Visible=false;
p8->Visible=false;
p9->Visible=false;


return true ;

case 4 :
    textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=true;
p4->Visible=true;
p5->Visible=false;
p6->Visible=false;
p7->Visible=false;
p8->Visible=false;
p9->Visible=false;


return true ;	

case 5 :
textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=true;
p4->Visible=true;
p5->Visible=true;
p6->Visible=false;
p7->Visible=false;
p8->Visible=false;
p9->Visible=false;


return true ;

case 6 :
textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
    textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=true;
p4->Visible=true;
p5->Visible=true;
p6->Visible=true;
p7->Visible=false;
p8->Visible=false;
p9->Visible=false;

return true ;	

case 7:
textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=true;
p4->Visible=true;
p5->Visible=true;
p6->Visible=true;
p7->Visible=true;
p8->Visible=false;
p9->Visible=false;
return true ;	

case 8 :

textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=true;
p4->Visible=true;
p5->Visible=true;
p6->Visible=true;
p7->Visible=true;
p8->Visible=true;
p9->Visible=false;


return true ;				
case 9 :
textBox2->Text="TROUVE LE NOMBRE DE PAPILLONS PUIS CLIQUE SUR SON CHIFFRE ";
textBox1->Clear();
textBox1->Focus();
p1->Visible=true;
p2->Visible=true;
p3->Visible=true;
p4->Visible=true;
p5->Visible=true;
p6->Visible=true;
p7->Visible=true;
p8->Visible=true;
p9->Visible=true;

return true ;	


}

return 1;			   
}
int aleatoire(int chiffretest)
{
   j=j++;				  
   return compare_idem.at(j-1);
   }
  void nouveau_chiffre()
{

while(nombre!=0)
{
srand(time(0));
int  nombre = rand()% 10;
if (nombre!=0) compare_idem.push_back (nombre);
}
   
while(!(compare_idem.size()==9))
{
bool exist=false;
int nombre = rand()% 10;
   	for (std::vector::iterator it= compare_idem.begin();it!=compare_idem.end();++it)
    { 
    if (nombre == *it) 
{
exist=true;
}

}
    if (!exist && nombre!=0) {
compare_idem.push_back (nombre);
}

};
   return ;
}
private: System::Void btnlancer_Click(System::Object^  sender, System::EventArgs^  e) {



 }

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
    
nouveau_chiffre();
reponse=aleatoire(reponse);		 
    jeu(faute,stop); 
    stop=stop++;
visibilite();
button1->Enabled=true;
this->Refresh();

PlaySound(TEXT(".\\musiquejeu\\SALUT.wav"), NULL, SND_FILENAME);
 
//***********************************************************************
FMOD_System_Close(system);
FMOD_System_Release(system);
FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\OUIOUI.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL);        
 }
private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
 }       	

 
private: System::Void textBox1_Enter(System::Object^  sender, System::EventArgs^  e) {
  }
private: System::Void textBox1_Leave(System::Object^  sender, System::EventArgs^  e) {
}



void souffle()
{
if (textBox1->Text!= "")
{
if (stop!=9) {
jeu(faute,stop); 
    stop=stop++;
reponse=aleatoire(reponse);
visibilite();

}
else  
{
PlaySound(TEXT(".\\musiquejeu\\Applaudissement.wav"), NULL, SND_FILENAME);   
int resultat=(10-faute);
   if (resultat > 5) { 
   
   reponse=0;
   visibilite();
   this->Refresh();
   PlaySound(TEXT(".\\musiquejeu\\EXCELLENT.wav"), NULL, SND_FILENAME);
   }
   
  
   textBox2->Text=" INITIALISATION NOUVELLE PARTIE";
   textBox1->Text="...";
           this->Refresh();
   
//Application::Exit(); 
        compare_idem.clear();		
    nouveau_chiffre();
textBox1->Text="...";
            textBox2->Text="APPUYER SUR LE BOUTON COMMENCER";
    button1->Enabled= false;
button2->Enabled= true;
this->Refresh();
reponse=0;
stop=0;
    j=0;
return;
//  
    
}
}

}
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {

 FMOD_System_Close(system);
 FMOD_System_Release(system);	
stop=stop++;
reponse=aleatoire(reponse);
visibilite();
button2->Enabled = false;
button1->Enabled = true;	 }
private: System::Void axWindowsMediaPlayer1_Enter(System::Object^  sender, System::EventArgs^  e) {
 }
private: System::Void ouioui_Click(System::Object^  sender, System::EventArgs^  e) {
    FMOD_System_Close(system);
FMOD_System_Release(system); 
FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/*Chargement des images comptage*/ 
 

//PictureBox* p[9]={NULL}; 
//p[0] = p1; //p1 est déjà un ptr sur pictureBox
//p[1] = p2; //p2 aussi
 
//	for(int i=0;i<2;i++) 

//{ 
    
//p[i]->Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
//}

/*p2-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p3-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p4-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p5-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p6-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p7-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p8-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
p9-> Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");*/

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\OUIOUI.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
 this->BackgroundImage= Image::FromFile(".\\musiquejeu\\OUIOUI.jpg");
 
 
 }
private: System::Void button1_Click_1(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button1->Text;
 souffle();
         
 }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button3->Text;
 souffle();
 
 }
private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button4->Text;
 souffle();
 
 }
private: System::Void button7_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button7->Text;
 souffle();
 
 }
private: System::Void button6_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button6->Text;
 souffle();
 
 }
private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button5->Text;
 souffle();
 
 }
private: System::Void button10_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button10->Text;
 souffle();
 
 }
private: System::Void button9_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button9->Text;
 souffle();
 
 }
private: System::Void button8_Click(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button8->Text;
 souffle();
 
 }
private: System::Void textBox1_TextChanged_1(System::Object^  sender, System::EventArgs^  e) {

 }
private: System::Void button9_Click_1(System::Object^  sender, System::EventArgs^  e) {
 textBox1->Text=button9->Text;
 souffle();
 }
private: System::Void button11_Click(System::Object^  sender, System::EventArgs^  e) {
FMOD_System_Close(system);
FMOD_System_Release(system);
FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\Inspecteur gadget.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
          
  this->BackgroundImage=Image::FromFile (".\\musiquejeu\\Inspecteur gadget.jpg");
 
 
 }
private: System::Void button12_Click(System::Object^  sender, System::EventArgs^  e) {
FMOD_System_Close(system);
FMOD_System_Release(system);
FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\La Panthere Rose.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 

this->BackgroundImage=Image::FromFile (".\\musiquejeu\\La Panthere Rose.jpg");

 }
private: System::Void button13_Click(System::Object^  sender, System::EventArgs^  e) {
 FMOD_System_Close(system);
 FMOD_System_Release(system);
 FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\Maya.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
 this->BackgroundImage=Image::FromFile (".\\musiquejeu\\Maya.jpg");
 
 }
private: System::Void button14_Click(System::Object^  sender, System::EventArgs^  e) {
 FMOD_System_Close(system);
 FMOD_System_Release(system);
 FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\Olive et Tom.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
 this->BackgroundImage=Image::FromFile (".\\musiquejeu\\Olive et Tom.jpg");
 
 }
private: System::Void button15_Click(System::Object^  sender, System::EventArgs^  e) {
 FMOD_System_Close(system);
FMOD_System_Release(system);
 FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\Bouba.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
 this->BackgroundImage=Image::FromFile (".\\musiquejeu\\Bouba.jpg");
 
 }
private: System::Void button16_Click(System::Object^  sender, System::EventArgs^  e) {
 
 }
private: System::Void button17_Click(System::Object^  sender, System::EventArgs^  e) {
  
 }
private: System::Void button16_Click_1(System::Object^  sender, System::EventArgs^  e) {
 FMOD_System_Close(system);
FMOD_System_Release(system);
 FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\Babar.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
this->BackgroundImage=Image::FromFile (".\\musiquejeu\\Babar.jpg");
 }

private: System::Void button17_Click_1(System::Object^  sender, System::EventArgs^  e) {
 }
private: System::Void button17_Click_2(System::Object^  sender, System::EventArgs^  e) {
FMOD_System_Close(system);
FMOD_System_Release(system);
FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\Pokemon.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
 this->BackgroundImage=Image::FromFile (".\\musiquejeu\\Pokemon.jpg");
 }
private: System::Void Form1_Leave(System::Object^  sender, System::EventArgs^  e) {
 FMOD_System_Close(system);
             FMOD_System_Release(system);
 }



private: System::Void Form1_Enter(System::Object^  sender, System::EventArgs^  e) {

 }
private: System::Void Form1_ResizeBegin(System::Object^  sender, System::EventArgs^  e) { 
 }
};
}


Je souhaiterais mettre ce code sous le bouton OUIOUI
Encore merci pour votre patience
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
3 août 2012 à 22:52
Merci beaucoup,pour la réponse et l'explication
je vais essayé ce weekend et vous tenir informer,
Bonne soirée.
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
5 août 2012 à 22:20
Bonsoir,
Voilà après vos conseil j'ai réussit à faire fonctionner le code mais j'ai un problème Eh oui !!
En effet lorsque je déclare le tableau je suis obligé de le faire dans le code du bouton et de mettre les égalités au même endroit sous cette forme:
private: System::Void ouioui_Click(System::Object^  sender, System::EventArgs^  e) {
    FMOD_System_Close(system);
FMOD_System_Release(system); 
FMOD_System_Create(&system);
            FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

/*Chargement des images comptage */
array^ p = gcnew array(9);
p[0] = p1;      
p[1] = p2;
p[2] = p3;
p[3] = p4;
p[4] = p5;
p[5] = p6;
p[6] = p7;
p[7] = p8;
p[8] = p9; 		 


for(int i=0;i<9;i++) 

{ 
    p[i]->Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG");
}



/* On ouvre la musique */
resultat = FMOD_System_CreateSound(system,".\\musiquejeu\\OUIOUI.mp3" , FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);

/* On active la répétition de la musique à l'infini */
//FMOD_Sound_SetLoopCount(musique, -1);

/* On joue la musique */
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); 
 this->BackgroundImage= Image::FromFile(".\\musiquejeu\\OUIOUI.jpg");
 
 
 }

le problème est que je suis obligé de mettre ce code à chaque bouton ou je veux mettre une autre image. donc c'est aussi long qu'avant mais en bonne voie (je vous en remercie)
Comment dois je faire pour rendre ce tableau en public ou autre (pour qu'il soit portable au travers différents évènement et bouton de commande différents.
Si je mets le code exactement comme vous le dites j'ai des erreurs et ça ne compile pas(mais grâce à vous tous j'avance peu à peu)
0
fhoest Messages postés 40 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 6 août 2013
7 août 2012 à 21:13
Bonsoir,

Avant tout je tiens a tous vous dire merci pour votre patience.
J'ai essayé la proposition du dessus mais je ne suis pas parvenu a la faire tourner
J'avais des erreurs de compilation et je ne comprenais pas tout a fait comment les contourner
Mais grâce a vous et vos conseil j'ai réussi:
Étant donné que je dois utilisé le code sur 7 ou 8 bouton j'ai créé une fonction spéciale pour cela.
voici ce que j'ai fait peut être cela pourra servir à d'autres:
//Appel de la fonction image avec argument chemin de l'image dans le code du bouton	
image(".\\musiquejeu\\OUIOUI.jpg");

puis la fonction:
void image(String^ img)
{

array^ p = gcnew array(9);
p[0] = p1;      
p[1] = p2;
p[2] = p3;
p[3] = p4;
p[4] = p5;
p[5] = p6;
p[6] = p7;
p[7] = p8;
p[8] = p9;

for(int i=0;i<9;i++)
{
 p[i]->Image= Image::FromFile (img);
}
return;
}


Un grand merci
Au plaisir.
0
Rejoignez-nous