Bonjour;


j'ai créer un user contrôle et voici le code
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
Option Strict On
Imports System.ComponentModel
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Public Class fleche
    Inherits System.Windows.Forms.Control
 
    Private panderation_ As Integer
    Private X1_ As Integer
    Private Y1_ As Integer
    Private X2_ As Integer
    Private Y2_ As Integer
 
    <DefaultValue(1), _
     Description("La Panderation du lien")> _
    Public Property panderation() As Integer
        Get
            Return panderation_
        End Get
        Set(ByVal value As Integer)
            If value <> Nothing Then
                panderation_ = value
                Me.Invalidate()
            End If
        End Set
    End Property
 
    <DefaultValue(1), _
     Description("X de depart")> _
    Public Property X1() As Integer
        Get
            Return X1_
        End Get
        Set(ByVal value As Integer)
            If value <> Nothing Then
                X1_ = value
                Me.Invalidate()
            End If
        End Set
    End Property
 
    <DefaultValue(1), _
    Description("Y de depart")> _
   Public Property Y1() As Integer
        Get
            Return Y1_
        End Get
        Set(ByVal value As Integer)
            If value <> Nothing Then
                Y1_ = value
                Me.Invalidate()
            End If
        End Set
    End Property
 
 
    <DefaultValue(1), _
    Description("X de fin")> _
   Public Property X2() As Integer
        Get
            Return X2_
        End Get
        Set(ByVal value As Integer)
            If value <> Nothing Then
                X2_ = value
                Me.Invalidate()
            End If
        End Set
    End Property
 
    <DefaultValue(1), _
    Description("Y de fin")> _
   Public Property Y2() As Integer
        Get
            Return Y2_
        End Get
        Set(ByVal value As Integer)
            If value <> Nothing Then
                Y2_ = value
                Me.Invalidate()
            End If
        End Set
    End Property
 
 
    Protected Overrides Sub OnPaint(ByVal pe As  _
 System.Windows.Forms.PaintEventArgs)
        MyBase.OnPaint(pe)
        Dim grfGraphics As System.Drawing.Graphics
        grfGraphics = pe.Graphics
 
        Dim g As Graphics
        g = Me.CreateGraphics
        Dim blackPen As New Pen(Color.Red, 2)
        g.DrawLine(blackPen, Me.X1, Me.Y1, Me.X2, Me.Y2)
 
        Dim XP As Integer = CInt((Me.X1 + Me.X2) / 2)
        Dim YP As Integer = CInt((Me.Y1 + Me.Y2) / 2)
 
        g.DrawString(Me.panderation.ToString, Me.Font, New SolidBrush(Color.Black), XP, YP)
    End Sub
*

mon probleme est ce je peux éliminer le compteur de mon user contrôle ?
ah mon user contrôle permet de dessiner une ligne et Ecrire un nombre au milieu de la ligne



pour la création de mon user contrôle j'ai suivi ce tutoriel

http://msdn.microsoft.com/fr-fr/library/bb469807.aspx