Fire up a click event inside a control

T

Tao

hi.. group

I have a user control A. How can I manually fire up an event (e.g.
MouseClick) in A.

That is the code looks like:

class A : UserControl
{
private void Fireup()
{
//fire up an mouse click event.
}
}

thanks
 
M

Marc Gravell

To invoke an event from a subclass, the general convention is a
protected OnEventName(...) method; in this case, you can simulate a
mouse-click by calling OnMouseClick(EventArgs.Empty);

Marc
 
M

Marc Gravell

Oops; previous post should have used either MouseEventArgs.Empty or
something like new MouseEventArgs( MouseButtons.Right, 1, xPos, yPos,
0)

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top