Bonjour,
je voudrais crée un seul contrôle personnalisé à partir de plusieurs contrôles de vb.
voila ma form que je voudrais transférer comme un contrôle (voir l'image en Pièce jointe).
si quelqu’un a des idées ou des informations...
Merci.
Bonjour,
je voudrais crée un seul contrôle personnalisé à partir de plusieurs contrôles de vb.
voila ma form que je voudrais transférer comme un contrôle (voir l'image en Pièce jointe).
si quelqu’un a des idées ou des informations...
Merci.
Pour ma part, je créerais une classe qui hérite de la classe Panel afin de récupérer ses properties etc, et j'y incrusterais tes controls dedans (Dans ton cas, 3 Combos, 2 TextBox, 1 Boutton)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 Public Class TonControl Inherits Panel 'Déclaration des controls à l'intérieur du panneau Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox ''' <summary> ''' Constructeur ''' </summary> ''' <remarks></remarks> Public Sub New() InitializeComponent() initialiser() initialiserUI() End Sub ''' <summary> ''' Méthode pour initialiser les données des controls du panneau ''' </summary> ''' <remarks></remarks> Public Sub initialiser() End Sub ''' <summary> ''' Ajout des controls sur le panel ''' </summary> ''' <remarks></remarks> Private Sub initialiserUI() Controls.Add(ComboBox1) Controls.Add(ComboBox2) Controls.Add(ComboBox3) Controls.Add(TextBox1) Controls.Add(TextBox2) Controls.Add(Button1) End Sub ''' <summary> ''' Méthode d'initialisation des composants par le Designer ''' </summary> ''' <remarks></remarks> Private Sub InitializeComponent() Me.ComboBox1 = New System.Windows.Forms.ComboBox() Me.ComboBox2 = New System.Windows.Forms.ComboBox() Me.ComboBox3 = New System.Windows.Forms.ComboBox() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.TextBox2 = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'ComboBox1 ' Me.ComboBox1.FormattingEnabled = True Me.ComboBox1.Location = New System.Drawing.Point(0, 0) Me.ComboBox1.Name = "ComboBox1" Me.ComboBox1.Size = New System.Drawing.Size(121, 21) Me.ComboBox1.TabIndex = 0 ' 'ComboBox2 ' Me.ComboBox2.FormattingEnabled = True Me.ComboBox2.Location = New System.Drawing.Point(0, 0) Me.ComboBox2.Name = "ComboBox2" Me.ComboBox2.Size = New System.Drawing.Size(121, 21) Me.ComboBox2.TabIndex = 0 ' 'ComboBox3 ' Me.ComboBox3.FormattingEnabled = True Me.ComboBox3.Location = New System.Drawing.Point(0, 0) Me.ComboBox3.Name = "ComboBox3" Me.ComboBox3.Size = New System.Drawing.Size(121, 21) Me.ComboBox3.TabIndex = 0 ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(0, 0) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(100, 20) Me.TextBox1.TabIndex = 0 ' 'TextBox2 ' Me.TextBox2.Location = New System.Drawing.Point(0, 0) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(100, 20) Me.TextBox2.TabIndex = 0 ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(0, 0) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 23) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True ' 'TonControl ' Me.Size = New System.Drawing.Size(200, 200) Me.ResumeLayout(False) End Sub End Class
Aider les autres, c'est encore la meilleure façon de s'aider soi-même. Martin Gray
ToDo : Faire une ToDo List
Voir ce tuto
un usercontrol reste plus simple pour un débutant (clic droit sur le projet / ajouter controle utilisateur)
tu poses ce que tu veux dessus et après tu codes
si tu as besoin d'infos tu peux mettre des propriétés (titre as string ...)
et pas besoin de faire une dll pour ca
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager