Not quite as simple as parent-child form communication. To detect a size change event from a MouseUp event in a button in the programmatically created user control I added the following code in the user control:
public event EventHandler SizeChanged;
new protected virtual void OnSizeChanged(EventArgs e)
{
EventHandler eh = SizeChanged;
if (eh != null)
{
eh(this, e);
}
}
In the button MouseUp I added
private void cmdResize_MouseUp(object sender, MouseEventArgs e)
{
...
EventArgs ef = new EventArgs();
...
SizeChanged(sender,null);
}
In the form containing the User Control, the code creating the control was
UserControl.UserControl NewControl = new UserControl.UserControl();
...
UserControl.SizeChanged += new EventHandler(UserControl_SizeChanged);
ParentForm.Add(UserControl);
and new function
void UserControl_SizeChanged(object sender, EventArgs e)
{
...
}
is executed whenever there is a MouseUp event in the UserControl button