C# Custom click event that not inherit from Control
<p>Can i implement a custom click event that raise when user click on my object.</p>

<p>My object doesn't inherit any class but it has a Location Width Height properties.</p>

<p>Question is : i don't know how code that when i create MyObj subscribe to click event.</p>

<pre><code>public delegate void CusEventHandler(object sender, CusEventArgs e);
public class MyObject
{
    private Point location;
    private int width;
    private int height;
    public event CusEventHandler Click;
    public MyObject(Point loc, int w, int h)
    {
        this.location = loc;
        this.width= w;
        this.height= h;
    }
    protected virtual void OnClick(CusEventArgs e)
    {
        if (Click != null)
        {
            Click(this, e);
        }
    }
}
public partial class Form1 : Form
{
    public MyObject myObj;
    public Form1()
    {
        InitializeComponent();
        myObj = new (new Point(5,5),100,100);
        myObj.Click+= new CusEventHandler(myObj_click);
    }
    private void myObj_click(object sender,CusEventArgs e)
    {
        //Some logic
    }
}
</code></pre>
