Quantcast
Channel: C# simulate a mouse click?
Viewing all articles
Browse latest Browse all 3

C# simulate a mouse click?

$
0
0
Hiya,

I have tried to follow the msdn article (http://msdn.microsoft.com/en-us/library/ms171548.aspx) on how to simulate mouse clicks. However, I don't understant it, or it doesn't do what I want it to do.

I want to simulate a mouse click on the form each time a particular event occurs (such as Form.Deactivate)

The way I understand this article it means to register and write a MouseClick event (handler):

this.MouseClick += new MouseEventHandler(Form1_MouseClick);

void Form1_MouseClick(object sender, MouseEventArgs e)
{
         textBox.Focus();   
}
Then, I thought the article said to use something called

OnMouseClick(Form1_MouseClick)

but this is obviously wrong. Can anyone help me? How do I now raise the Form1_MouseClick event in the code (i.e. without having to use a mouseclick)?

Thanks a lot,
Vic_code

Viewing all articles
Browse latest Browse all 3

Trending Articles