就是WinForm主窗口中单击一个Button,弹出一个副窗口,我想让这个窗口的位置紧跟在Button下面。

解决方案 »

  1.   

    好像窗口有Location属性可以设置的
      

  2.   

    新窗口.Location.Y = 你的Button.Location.Y + 20
      

  3.   

    重绘制窗体位置.            Form form = new Form();
                Point p = new Point(1000,390);
                form.StartPosition = FormStartPosition.Manual;
                form.Location = p;
                form.Show();具体point(x,y)里面x,y的位置,你自己去试试,看在哪.
      

  4.   


            private void btnEdit_Click(object sender, EventArgs e)
            {
                Form2 frm = new Form2();
                frm.X = this.Left + ((Button)sender).Left;
                frm.Y = this.Top +((Button)sender).Bottom;
                frm.ShowDialog(this);
            }
    在Form2中定义两个PUBLIC变量X,Y;
    然后在Form2中的Form2_Load()中:
    this.left=X;
    this.Top=Y;
    测试成功!