Bonjour tout le monde,
Je suis débutante dans la programmation avec C#. J'ai un GUI contenant un menu dont le code se trouve ci-dessous. Il fonctionne bien mais maintenant j'aimerais bien implementer un clic c'est à dire par exemple j'aimerai pouvoir cliquer sur "One" ou "Two"et afficher un message.
Merci bien
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 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class Form1 : Form { private ToolStripContainer toolStripContainer1; private ToolStrip toolStrip1; public Form1() { InitializeComponent(); } [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Form1()); } private void InitializeComponent() { toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); toolStrip1 = new System.Windows.Forms.ToolStrip(); // Add items to the ToolStrip. toolStrip1.Items.Add("One"); toolStrip1.Items.Add("Two"); toolStrip1.Items.Add("Three"); // Add the ToolStrip to the top panel of the ToolStripContainer. toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1); // Add the ToolStripContainer to the form. Controls.Add(toolStripContainer1); } }
Partager