这是一个考验智商的代码,非战斗人员请撤离
这个是最初代码,运行无误
`Dim A As Variant, B As Variant
Private Sub Form_Click()
Unload Me
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X, Y
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
A = Label1.ForeColor
B = Label1.FontSize
End Sub
Private Sub Form_Resize() '图片适应窗体的大小
Me.PaintPicture Me.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight
End Sub
Private Sub Label1_Click() '单击标签框调用程序
Shell “explorer G:\作品展\New project\index.html”, vbNormalFocus
Unload Me
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '窗体鼠标移动事件
Label1.ForeColor = A
Label1.FontSize = B
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '标签框鼠标移动事件
Label1.ForeColor = vbRed
Label1.FontSize = 38
End Sub
但是分别加了下列三段语句后,下列代码段粗体
Dim A As Variant, B As Variant
Private Sub Form_Click()
Unload Me
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X, Y
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
A = Label1.ForeColor
B = Label1.FontSize
CurrentX = Label1.Top + Label1.Height / 2
CurrentY = Label1.Left + Label1.Width / 2
End Sub
Private Sub Form_Resize()
Me.PaintPicture Me.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight
End Sub
Private Sub Label1_Click()
Unload Me
Shell “explorer G:\作品展\New project\index.html”, vbNormalFocus
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.ForeColor = A
Label1.FontSize = B
Label1.Top = CurrentY - Label1.Height / 2
Label1.Left = (Form1.Width - Label1.Width) / 2
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.ForeColor = vbRed
Label1.FontSize = 38
Label1.Top = CurrentY - Label1.Height / 2
Label1.Left = (Form1.Width - Label1.Width) / 2
End Sub
则会在点击标签框卸载时,卸载成功后,会重新运行form2窗体,循环几次后才会关闭?这是什么原因造成的,求大神解答?有什么办法其实现其功能的同时,如何解决这个问题,快在下方评论哟!
(加入的语句是想让标签框变大后,中心位置不变)