子窗口主要是用来帮助输入的
不知道怎么样控制子窗口的位置
 Form2 f2 = new Form2();
 f2.Left = button1.Left;
 f2.Top = button1.Bottom + 1;
 f2.ShowDialog();
是想让f2显示在button1的下方,但是没达到效果,为什么?
应该怎么做。

解决方案 »

  1.   

    需要将坐标转换为屏幕坐标,
    Form2 f2 = new Form2();
    f2.Location = button1.PointToScreen(new Point(button1.Left, button1.Bottom+1)); f2.ShowDialog();
      

  2.   

    Form2 f2 = new Form2();
                Point pt = new Point(button1.Left, button1.Bottom);
                f2.Left = pt.X;
                f2.Top = pt.Y + 10;
                pt=PointToScreen(pt);            
                f2.ShowDialog();
      
    好像并不理想呀?
      

  3.   

    Form2 f2 = new Form2();
                Point pt = new Point(button1.Left, button1.Bottom);
                pt = PointToScreen(pt); 
                f2.Left = pt.X;
                f2.Top = pt.Y + 10;                      
                f2.ShowDialog();   
    好像不行