Bonjour,

SVP , j'ai arrivé à trouver un code ci dessous qui permet de créer une ligne cliquable
je cherche comment créer une ligne cliquable mais cette dernière sera dessiner après un Click sur un bouton 'ajouter ligne'

le code c'est :

Code c# : 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
public Form1() 
        { 
            InitializeComponent(); 
            myButtonObject myButton = new myButtonObject(); 
    EventHandler myHandler = new EventHandler(myButton_Click); 
    myButton.Click += myHandler; 
    myButton.Location = new System.Drawing.Point(20, 20); 
    myButton.Size = new System.Drawing.Size(101, 101); 
    this.Controls.Add(myButton); 
} 
public class myButtonObject : UserControl 
{ 
    // Draw the new button. 
    protected override void OnPaint(PaintEventArgs e) 
    { 
        Point point9 = new Point(10, 30); 
        Point point10 = new Point(30, 10); 
        Graphics graphics = e.Graphics; 
        Pen myPen = new Pen(Color.Black); 
        // Draw the button in the form of a circle 
              graphics.DrawLine(myPen, point9, point10); 
 
 
        myPen.Dispose(); 
    } 
} 
 
        private void myButton_Click(object sender, EventArgs e) 
        { 
            MessageBox.Show("Click"); 
        } 
        }


merci