Bonjour,

J'ai une interface avec beaucoup de bouton.
j'ai, pour le moment, 3 évènements par boutons.
Mais je vous avoue que d'avoir 3 Sub par bouton sa fait beaucoup, et je voudrais savoir s'il y a pas possibilité de simplifié en 1 seul Sub.

Voici mes Sub :

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
 
'SUB 1
    Private Sub Activ_Mvt_Manu(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
                            Handles BtManuMorsPlus.MouseDown
 
        Dim BoutonAppuye As Button = CType(sender, Button)
 
        EtatBitMvt(BoutonAppuye, True)
 
    End Sub
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'SUB 2
    Private Sub Desactiv_Mvt_Manu_1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
                            Handles BtManuMorsPlus.MouseUp
 
        Dim BoutonRelache As Button = CType(sender, Button)
 
        EtatBitMvt(BoutonRelache, False)
 
    End Sub
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'SUB 3
    Private Sub Desactiv_Mvt_Manu_2(ByVal sender As Object, ByVal e As System.Windows.Forms.InvalidateEventArgs) _
                            Handles BtManuMorsPlus.Invalidated
 
        Dim BoutonRelache As Button = CType(sender, Button)
 
        EtatBitMvt(BoutonRelache, False)
 
    End Sub