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; }
ça ne fonctionne pas non plus.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionForm1(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... }
for(int i=1;i<10;i++) { int p[9]; p[i]->Image= Image::FromFile(".\\musiquejeu\\OUIOUI.JPG"); }
#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) { } }; }
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"); }
//Appel de la fonction image avec argument chemin de l'image dans le code du bouton image(".\\musiquejeu\\OUIOUI.jpg");
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; }