IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Création d'un contrôle personalisé (dll)


Sujet :

VB.NET

  1. #1
    Membre habitué Avatar de sihammaster
    Webmaster
    Inscrit en
    Mai 2009
    Messages
    256
    Détails du profil
    Informations professionnelles :
    Activité : Webmaster
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2009
    Messages : 256
    Points : 183
    Points
    183
    Par défaut Création d'un contrôle personalisé (dll)
    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.
    Images attachées Images attachées  

  2. #2
    Membre chevronné Avatar de _Ez3kiel
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2013
    Messages
    836
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Janvier 2013
    Messages : 836
    Points : 1 961
    Points
    1 961
    Par défaut
    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

  3. #3
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2012
    Messages
    206
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2012
    Messages : 206
    Points : 455
    Points
    455
    Par défaut
    Voir ce tuto

  4. #4
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    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
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

Discussions similaires

  1. [C#] Création d'un contrôle avec collection intégrée
    Par nerix dans le forum Windows Forms
    Réponses: 2
    Dernier message: 28/06/2006, 10h07
  2. Création du timer dans une Dll
    Par Hokagge dans le forum MFC
    Réponses: 13
    Dernier message: 14/03/2006, 18h04
  3. Erreur création dynamique de contrôle
    Par thierrybatlle dans le forum Access
    Réponses: 1
    Dernier message: 10/02/2006, 11h00
  4. [MFC] Création manuelle de contrôle bouton
    Par yanisliadon dans le forum MFC
    Réponses: 9
    Dernier message: 21/07/2005, 22h30
  5. Création dynamique de contrôles
    Par qi130 dans le forum Composants VCL
    Réponses: 5
    Dernier message: 17/12/2004, 13h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo