Bonjour,

Voila, étant utilisateur notamment de c++ builder, je dois bosser actuellement au boulot sur Visual C++ Edition express (pour sa gratuité par rapport à borland).

J'ai donc effectué des petits test sur une form pour l'utilisation des boutons etc...et donc j'aimerai comprendre comment ca se passe pour qu'un simple bouton interfère avec ma form (fermeture, etc...)

Donc j'ai ce code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#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)
		{
			this->DialogDirectory = (gcnew System::Windows::Forms::FolderBrowserDialog());
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
			this->fichierToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->quitterToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->composantsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->comparerToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->directorySearcher1 = (gcnew System::DirectoryServices::DirectorySearcher());
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->menuStrip1->SuspendLayout();
			this->SuspendLayout();
			// 
			// menuStrip1
			// 
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->fichierToolStripMenuItem, 
				this->composantsToolStripMenuItem});
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
			this->menuStrip1->Name = L"menuStrip1";
			this->menuStrip1->Size = System::Drawing::Size(704, 24);
			this->menuStrip1->TabIndex = 1;
			this->menuStrip1->Text = L"menuStrip1";
			this->menuStrip1->ItemClicked += gcnew System::Windows::Forms::ToolStripItemClickedEventHandler(this, &Form1::menuStrip1_ItemClicked);
			// 
			// fichierToolStripMenuItem
			// 
			this->fichierToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->quitterToolStripMenuItem});
			this->fichierToolStripMenuItem->Name = L"fichierToolStripMenuItem";
			this->fichierToolStripMenuItem->Size = System::Drawing::Size(50, 20);
			this->fichierToolStripMenuItem->Text = L"Fichier";
			// 
			// quitterToolStripMenuItem
			// 
			this->quitterToolStripMenuItem->Name = L"quitterToolStripMenuItem";
			this->quitterToolStripMenuItem->Size = System::Drawing::Size(152, 22);
			this->quitterToolStripMenuItem->Text = L"Quitter";
			this->quitterToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::quitterToolStripMenuItem_Click);
			// 
			// composantsToolStripMenuItem
			// 
			this->composantsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->comparerToolStripMenuItem});
			this->composantsToolStripMenuItem->Name = L"composantsToolStripMenuItem";
			this->composantsToolStripMenuItem->Size = System::Drawing::Size(78, 20);
			this->composantsToolStripMenuItem->Text = L"Composants";
			// 
			// comparerToolStripMenuItem
			// 
			this->comparerToolStripMenuItem->Name = L"comparerToolStripMenuItem";
			this->comparerToolStripMenuItem->Size = System::Drawing::Size(132, 22);
			this->comparerToolStripMenuItem->Text = L"Comparer";
			// 
			// directorySearcher1
			// 
			this->directorySearcher1->ClientTimeout = System::TimeSpan::Parse(L"-00:00:01");
			this->directorySearcher1->ServerPageTimeLimit = System::TimeSpan::Parse(L"-00:00:01");
			this->directorySearcher1->ServerTimeLimit = System::TimeSpan::Parse(L"-00:00:01");
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(257, 174);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(75, 23);
			this->button1->TabIndex = 2;
			this->button1->Text = L"button1";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(704, 400);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->menuStrip1);
			this->MainMenuStrip = this->menuStrip1;
			this->Name = L"Form1";
			this->menuStrip1->ResumeLayout(false);
			this->menuStrip1->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();
 
		}
Qui est si j'ai bien compris, une déclaration des différents composants graphiques que j'ai inséré sur ma form.

Et donc sur un bouton de mon menu, j'aimerai que cela quitte mon application, j'ai donc cette méthode :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
private: System::Void quitterToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) 
{
 
 
}
Mais le problème est que je ne sais pas quoi mettre comme code pour que cela ferme ma fenetre, je ne sais pas ou trouver le bon objet...vous pourriez croire que je suis pire qu'un débutant, mais la j'avoue que le code généré par Visual c++ me perturbe un peu...

merci par avance