无法在程序中动态设定Location,请教应该使用什么方法?

解决方案 »

  1.   

    form1
       dim frm as new form2(bounds)
       frm.show子窗体构造
       public sub New(rec as Rectangle)
            MyBase.New()
            InitializeComponent()
            Dim int_X As Integer = rec.X + (rec.Width - Width) / 2
            Dim int_Y As Integer = rec.Y + (rec.Height - Height) / 2
            If int_X > 700 Or int_X < 0 Or int_Y > 700 Or int_Y < 0 Then
                StartPosition = FormStartPosition.CenterScreen
            Else
                Location = New Point(int_X, int_Y)
            End If
       end sub
      

  2.   

    在frm.show()后再设定location,不要在其内部实现
    frm.show();
    frm.Location = new Point(.....