I want to count all the mouseclicks
that are made in a window. I want the counter to increase on every single object i click on, even if its a button, the form it self or a textbox
etc. etc.
I have this so far but I cant seem to get it to work:
int mouseCounter = 0;
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control c in this.Controls)
{
c.Click += ClickCounter;
}
}
void ClickCounter(object sender, EventArgs e)
{
mouseCounter++;
label8.Text = mouseCounter.ToString();
}
The counter only respond to click on the controls for now and not the form it self. How can I simply fix that?