private void button1_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.MdiParent = this;
frm.LocationChanged += new EventHandler(frm_LocationChanged);
frm.Show();
} void frm_LocationChanged(object sender, EventArgs e)
{
Form frm = (Form)sender;
if (frm.Location.X+frm.Width>this.Width)
{
frm.Left = this.Width - frm.Width;
}
if (frm.Location.Y+frm.Height>this.Height)
{
frm.Top = this.Height - frm.Height ;
}
}
你可以试着限定死父窗体的大小,这样就不会有了
这个只有让子窗体不能超过父窗体边缘了