Bonjour à tous,
Comme le titre l'évoque je voudrais créer un contrôle personnalisé (appelle Button_Text) pour une application destinée à une école maternelle (celle-ci servira à faire l'appel).
Le contrôle est compose par un Button et une Textbox (a la place du texte du Button).
J'ai déjà crée le contrôle mais quand je veux déclencher l’événement KeyDown du contrôle personnalisé (Button_Text) ce ci ne fonctionne pas.
Et de plus en double-cliquant sur le Button_Text (une fois ajouté à la biblioteque) un événement Load est affiché au lieu d'un double-clique (dans le Form du code).
Merci à tous pour votre aide.

Voici le code du Button_Text :
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
 
Imports System.Drawing
 
Public Class Button_Text
 
      Property BText() As String
        Get
            Return TextBox1.Text
        End Get
        Set(value As String)
            TextBox1.Text = value
        End Set
    End Property
 
    Public Overrides Property BackColor As Drawing.Color
        Get
            Return Button1.BackColor
        End Get
        Set(value As Drawing.Color)
            Button1.BackColor = value
            Button1.FlatAppearance.BorderColor = value
            Button1.FlatAppearance.MouseOverBackColor = value
            Button1.FlatAppearance.MouseDownBackColor = value
            TextBox1.BackColor = value
        End Set
    End Property
 
    Private Sub Button_text_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged
        TextBox1.AutoSize = True
        TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", Button1.Size.Height / 6)
        TextBox1.Location = New Point(0, (Button1.Size.Height / 2) - (TextBox1.Size.Height / 2))
        TextBox1.Width = Button1.Size.Width
    End Sub
 
    Public Overrides Property BackgroundImageLayout As Windows.Forms.ImageLayout
        Get
            Return Button1.BackgroundImageLayout
        End Get
        Set(value As Windows.Forms.ImageLayout)
            Button1.BackgroundImageLayout = value
        End Set
    End Property
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox1.Text = Nothing
        TextBox1.Visible = True
        TextBox1.Focus()
        Button1.BackgroundImage = Nothing
    End Sub
 
    Private Sub TextBox1_Click(sender As Object, e As EventArgs) Handles TextBox1.Click
        TextBox1.Text = Nothing
        TextBox1.Visible = True
        Button1.BackgroundImage = Nothing
    End Sub
 
End Class