Bonjour tout le monde.
voila ma classe Boutons dans laquelle j'ai codé un bouton vente
Votre aide me serait d'une grande utilité.
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 class Boutons { public Button Vente() { Button para = new Button(); para.Name = "Vente"; para.BackColor = System.Drawing.Color.LightGray; para.FlatStyle = System.Windows.Forms.FlatStyle.Popup; para.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); para.Location = new System.Drawing.Point(3, 0); para.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); para.Size = new System.Drawing.Size(318, 30); para.TabIndex = 1; para.Tag = "001"; para.Text = "vente"; return para; } } je l'affiche sans souci dans le flowlayoutpanel2 de mon form principal à l'aide de ce code: boutons aff = new boutons(); Button ba = new Button(); ba = aff.vente(); flowLayoutPanel2.Controls.Add(ba); mon projet prévoir daccéder à un autre form par un click sur ce bouton. seulement, je ne parviens pas à lui attacher l'événement click. pour ce qui est de la methode qui va gerer cet evenement, juste ceci: public void vente_Click(object sender, EventArgs e) { form2 fr=new form2(); fr.show(); }
Partager