I haveloaded a "Form"using the DesignSurface.

Now when I click the hosted form (or move my mouse over the hosted form's region), I would like to capture some events - specifically mouse events in this case. Need to capture the mouse co-ordinates where the user clicks.

Tried the following code, not sure if what I am doing is right. Is there another way to trap events for this form.

Thanks,

Sankalp

/// Code

public partial class MainForm : Form

{

System.ComponentModel.Design.DesignSurface ds;

public MainForm()

{

InitializeComponent();

ds = new System.ComponentModel.Design.DesignSurface();

ds.BeginLoad(typeof(Form));

Control c = ds.View as Control;

c.Parent = this;

c.Height = 350;

c.Width = 400;

c.Top = 10;

c.Left = 10;

c.BackColor = Color.White;

// get a reference to the hosted form

Form hostedForm = ds.GetService(typeof(Form)) as Form; // always null ???

if (null != hostedForm)

{

hostedForm.Click += new EventHandler(hostedForm_Click);

}

}

public void hostedForm_Click(object sender, EventArgs e)

{

// need to get the mouse co-ordinates

Console.WriteLine("hostedForm_Click");

}

}

/// end of code