Hi Sharon,
Thanks for your feedback.
First, you should determine if ResizeEnd event meets your need. This event
is raised when the user finishes resizing a form, typically by dragging one
of the borders or the sizing grip located on the lower-right corner of the
form, and then releasing it. It is also generated after the user moves a
form, typically by clicking and dragging on the caption bar.
So for the second scenario, I do not think it meet your need. However, I
think we can distinguish these 2 conditions with comparing the new control
size with the original control size.(This requires to store the original
control size in a private filed/property)
Ok, I assume that you need this event in .Net1.1. Let's do some
customization to achieve this:
Form.ResizeEnd event leverages win32 WM_EXITSIZEMOVE message, so in
.Net1.1, we can override Form's WndProc and create a public ResizeEnd
event, trigger this event in WM_EXITSIZEMOVE message, like below:
public event EventHandler ResizeEnd;
private int WM_EXITSIZEMOVE=0x232;
protected override void WndProc(ref Message m)
{
if(m.Msg==WM_EXITSIZEMOVE)
{
if(ResizeEnd!=null)
{
this.ResizeEnd(this, new EventArgs());
}
}
base.WndProc (ref m);
}
In usercontrol, we can just listen to this event:
//I write code to disable this code from running in designmode.
private void UserControl1_Load(object sender, System.EventArgs e)
{
if(!this.DesignMode)
{
((Form1)this.Parent).ResizeEnd += new
EventHandler(UserControl1_ResizeEnd);
}
else
{
MessageBox.Show("design time");
}
}
private void UserControl1_ResizeEnd(object sender, EventArgs e)
{
MessageBox.Show("Resize end");
}
Hope this helps
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.