tags:

views:

316

answers:

2

Hi,

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.

A: 

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);
    }
}
Paw Baltzersen
Suppose i write your code in my user control.Then how i put my code on that button click from calling application.
prashant
i hope it works if i called from user control.
prashant
A: 

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.

prashant