#pragma once namespace tbb { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; /// /// Description résumée de Form1 /// /// AVERTISSEMENT : si vous modifiez le nom de cette classe, vous devrez modifier la /// propriété 'Nom du fichier de ressources' de l'outil de compilation de ressource managée /// pour tous les fichiers .resx dont dépend cette classe. Dans le cas contraire, /// les concepteurs ne pourront pas interagir correctement avec les ressources /// localisées associées à ce formulaire. /// [System::Xml::Serialization::XmlInclude(Form1::typeid)] public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO : ajoutez ici le code du constructeur // } protected: /// /// Nettoyage des ressources utilisées. /// ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Label^ label1; protected: private: System::Windows::Forms::Label^ label2; private: /// /// Variable nécessaire au concepteur. /// System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas /// le contenu de cette méthode avec l'éditeur de code. /// void InitializeComponent(void) { this->label1 = (gcnew System::Windows::Forms::Label()); this->label2 = (gcnew System::Windows::Forms::Label()); this->SuspendLayout(); // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(30, 9); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(35, 13); this->label1->TabIndex = 0; this->label1->Text = L"label1"; this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click); // // label2 // this->label2->AutoSize = true; this->label2->Location = System::Drawing::Point(30, 128); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(35, 13); this->label2->TabIndex = 1; this->label2->Text = L"label2"; this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(292, 273); this->Controls->Add(this->label2); this->Controls->Add(this->label1); this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion public: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) { System::Xml::Serialization::XmlSerializer ^ sr; try { sr = gcnew System::Xml::Serialization::XmlSerializer(Form1::typeid); this->label1->Text="suke"; } catch (Exception ^ e) { System::String ^ message = e->InnerException->Message->ToString(); this->label1->Text="" + message; } System::IO::StreamWriter ^ writer = gcnew System::IO::StreamWriter("fichier.xml"); try { sr->Serialize(writer, this); } catch (Exception ^ e) { System::String ^ message = e->InnerException->Message->ToString(); this->label1->Text="" + message; } this->label2->Text="serialisation réussie"; } }; }