An example for this could be :
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
public class myPanel : Panel
{
public List<Point> ClickPoints {
get { return myClickPoints; }
set { myClickPoints = value; }
}
private List<Point> myClickPoints = new List<Point>();
public void ClearList()
{
myClickPoints.Clear();
}
protected override void OnMouseClick(MouseEventArgs e)
{
myClickPoints.Add(new Point(e.Location.X, e.Location.Y));
base.OnMouseClick(e);
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawString(myClickPoints.Count.ToString, Font, Brushes.Black, new Point(0, 10));
base.OnPaint(e);
}
}