Bonjour
Je souhaiterai créer un usercontrol qui me perttrait d'afficher un label avec une ligne en dessous.
exemple :
leLabel :____________________
J'ai déjà un usercontrol qui me permet de tracer des lignes mais je ne sais pas comment ajouter le Label qui serait en autosize comment ca je n'aurais que la dimension de la ligne à manipuler.
Voici le code que j'ai trouvé sur le net pour tracer une ligne
Public Class LigneHorizontale
Inherits System.Windows.Forms.UserControl
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
'La méthode substituée Dispose du UserControl pour nettoyer la liste des composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE*: la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'LigneHorizontale
'
Me.Name = "LigneHorizontale"
Me.Size = New System.Drawing.Size(150, 2)
End Sub
#End Region
Private Sub LigneHorizontale_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim objPen1 As Pen = New Pen(Color.Gray, 1)
Dim objPen2 As Pen = New Pen(Color.White, 1)
Dim objPoint1 As Point = New Point(0, 0)
Dim objPoint2 As Point = New Point(Me.Size.Width, 0)
Dim objPoint3 As Point = New Point(0, 1)
Dim objPoint4 As Point = New Point(Me.Size.Width, 1)
e.Graphics.DrawLine(objPen1, objPoint1, objPoint2)
e.Graphics.DrawLine(objPen2, objPoint3, objPoint4)
End Sub
End Class
D'avance merci pour votre aide.
OLBI
Partager