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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| #pragma once
#include "Struct.h"
#include <string>
using namespace std;
namespace ftuy
{ using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class Form1 : public System::Windows::Forms::Form
{ public:
Form1()
{ InitializeComponent();
//creation et initialisation du picturebox dynamiquement ( à terme il y en aura un nombre indeterminé)
System::Windows::Forms::PictureBox^ Picture;
Picture = (gcnew System::Windows::Forms::PictureBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(Picture))->BeginInit();
Picture->Name="image";
Picture->Location = System::Drawing::Point(0, 0);
Picture->TabIndex = 0;
Picture->ImageLocation="C:\\mon_image.bmp";
Controls->Add(Picture);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(Picture))->EndInit();
Picture->Click += gcnew System::EventHandler(this, &Form1::Picture_Click);
}
private: System::Void Picture_Click(System::Object^ sender, System::EventArgs^ e)
{ Form1::Picture->ImageLocation="C:\\mon_image2.bmp";
}
protected:
~Form1()
{ if (components)
{ delete components;
}
}
private:
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{this->SuspendLayout();
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
}
#pragma endregion
}
};
} |
Partager