Simulating events. Calling Click on a button

  • Thread starter Thread starter Pieter Breed
  • Start date Start date
P

Pieter Breed

Hi,

I would like to simulate UI events on UI controls. For example, I would
like to make a button control think its been Clicked (from an outside
class), so it would go through the click animation, raise the
associated events etc.

Is there a way to do this?

Regards,
Pieter
 
"Pieter Breed" <[email protected]> a écrit dans le message de (e-mail address removed)...

| I would like to simulate UI events on UI controls. For example, I would
| like to make a button control think its been Clicked (from an outside
| class), so it would go through the click animation, raise the
| associated events etc.
|
| Is there a way to do this?

Why not separate out the code into another method and call that method from
the Click event, then you can call the separate method from other code ?


public partial class Form1 : Form
{
public void MyMethod()
{
// do stuff
}

private void button1_Click(object sender, EventArgs args)
{
MyMethod();
}
}


Joanna
 
Back
Top