对于一个form调用show方法以后,发现它在屏幕上的位置是随机变化的,怎么才能固定它的位置呢,可以通过代码实现么,还有,对于对话框类型的form,能不能设置它出现在相对于父窗口的某一个位置

解决方案 »

  1.   

    me.StartUpPosition=1 '所有者中心
      

  2.   

    Private Sub Form_Load()
    '移动到屏幕中间
    Me.Move Screen.Width / 2 - Me.Width / 2, Screen.Height / 2 - Me.Height / 2
    End Sub
      

  3.   

    Private Sub Command1_Click()
    InputBox "你好,散的分吧!!", "hehe", 11, Form1.Left + Form1.Width / 2, Form1.Top + Form1.Height / 2 
    End SubPrivate Sub Form_Load()
    Me.Move (Screen.Width - Form1.Width) / 2, (Screen.Height - Form1.Height) / 2  '窗体居中
    End Sub
      

  4.   

    form1的属性页里的StartUpPosition = 2 屏幕中心
    StartUpPosition = 1 所有者中心