简体   繁体   中英

How to Raise Event from ActiveX control

I am new in c#. I am working on image processing. I am creating a UserControl (ActiveX) which is adding just a panel on it.

When i use this user control in my another application then how i get the different events.

Suppose i want all mouseEvents occurred in my userContol then how i get in my application that mouse event occurred.

How User control raise a event and how i get in my application. Because i need to add some functionality on that events too from my application.

Now i got it. I have to define some delegates on my user control. And i have to attach event from calling side or where i am using that control. Thanks paw.

If I understand your question correctly, then you can reraise the events and hook them up in your other application.

public EventHandler<EventArgs> Button1Clicked;
private void button1_Click(object sender, EventArgs e)
{
    if (this.Button1Clicked != null)
    {
        this.Button1Clicked(sender, e);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM