你可以用Form的location属性设置。

解决方案 »

  1.   

    设置location属性或StartPosition属性
      

  2.   

    Button btn=(Button)sender;
    openForm=new OpenForm();
    openForm.Location=new System.Drawing.Point(btn.Location.X,btn.Location.Y+20);
    openForm.Show();
    我这样做是没有达到我上述要求,
    为什么?
      

  3.   

    to:declude
    单击第一次它出现在左上方,以后每单击打开
    它会沿,他的X,Y坐标会增加即往,bottom,right方向移动
    到屏幕中间后有会退至第一次的位置
      

  4.   

    public class MainForm
    {
        private OpenForm openForm;//另一窗体
        public  MainForm()
        {
            ......
        } 
        private void Buttons_Click(object sender,EvengArgs e)
        {
           Button btn=(Button)sender;
           openForm=new OpenForm();
           openForm.Location=new System.Drawing.Point(tn.Location.X,btn.Location.Y+20);
            openForm.Show();   
        }   
    }
      

  5.   

    private  void button1_Click(object sender, System.EventArgs e)
    {
    form2=new Form2 ();
    form2.StartPosition=FormStartPosition.Manual ;
    form2.Location =new System.Drawing.Point(0,200);
    form2.Show ();
    }
    即可
      

  6.   

    谢谢JOELIU,但是父窗体不是最大化时,openForm的位置就不会根我的按钮位置走啊?
      

  7.   

    沒問題啊
    openForm.Location=new System.Drawing.Point(tn.Location.X,btn.Location.Y+20);試試用:
    openForm.Left=btn.Left;
    openForm.Top=btn.Top+20;
      

  8.   

    加个循环:
    System.Windows.Forms.Control parentControl=button.Parent;
    System.Drawing.Point position = new System.Drawing.Point(0,0);
    while (!(parentControl is System.Windows.Forms.Form))
    {
    position.X += parentControl.Location.X;
    position.Y += parentControl.Location.Y;
    parentControl = parentControl.Parent;
    }
    position.X += button.Location.X;
    position.Y += button.Location.Y+button.Height;
    openForm.Location=position;
      

  9.   

    private  void button1_Click(object sender, System.EventArgs e)
    {
    form2=new Form1 ();
    form2.StartPosition=FormStartPosition.Manual ;
    //横坐标
    int X=this.Location.X +this.button1 .Location .X ;
    //纵坐标
    int Y=this.Location .Y+this.button1 .Location .Y
                                     +this.button1 .Size .Height+30;
    form2.Location =new System.Drawing.Point(X,Y);

    form2.Show ();
    }
    不断点按钮,效果是不错的
    坐标中的数字30是form2的上面显示标题部分(蓝色条)的高度