VB 关于窗体的一个问题 ? ⼀编程⼀窗体⼀VB

2024-11-08 00:45:15
有3个网友回答
网友(1):

设置 好w1 的左边据 与上边距
这是w1的
Private Sub Form_Activate()
Form2.Show
End Sub
这是w2的
Dim top1 As Single, left1 As Single
Private Sub Form_Load()
Form2.Top = Form1.Top + Height
Form2.left = Form1.left
top1 = Form1.Top
left1 = Form1.left
End Sub
Private Sub Timer1_Timer() 'interval =100
If Form1.Top <> top1 Or left <> Form1.left Then
Form2.Top = Form1.Top + Height
Form2.left = Form1.left
top1 = Form1.Top
left1 = Form1.left
End If
End Sub

网友(2):

这些都是在上面的窗体w1的代码
Public h, j As String

Private Sub Form_Load()
Me.ZOrder 1
Form2.Show
h = Me.Left
j = Me.Top
End Sub

Private Sub Timer1_Timer()'interval=100
If h = Me.Left Then
If j = Me.Top Then
Exit Sub
End If
End If
Form2.Left = Form2.Left + (Me.Left - h)
Form2.Top = Form2.Top + (Me.Top - j)
h = Me.Left
j = Me.Top
End Sub
w2:

Private Sub Form_Load()
Me.ZOrder 0
End Sub

网友(3):

这么费力为了什么呢?为何不把两者做在一个画面上?或者使用多页控件呢?