大家好:
我写了一个窗口缩放的程序,无论你如何变化,她都没问题,但是,但窗口最小化时,问题来了,出现了"无效属性值",代码如下:
Private Sub Form_Resize()
With SSTab1
.Top = 480
.Left = 0
.Height = Me.Height - 1150 **错误在这"无效属性值"
.Width = Me.Width - 100
End With
With lv1
.Top = 360
.Left = 0
.Width = Me.Width - 150
.Height = Me.Height - 1500
End With
With tv1
.Top = 360
.Left = 0
.Height = Me.Height - 1495
End With
With lv2
.Left = 3960
.Top = 360
.Width = Me.Width - 4100
.Height = (Me.Height - 1760) / 2
End With
With Text4
.Top = 3480 + (Me.Height - 8000) / 2
.Left = 3960
.Width = Me.Width - 4100
.Height = (Me.Height - 1960) / 2 + 350
End With
End Sub
我写了一个窗口缩放的程序,无论你如何变化,她都没问题,但是,但窗口最小化时,问题来了,出现了"无效属性值",代码如下:
Private Sub Form_Resize()
With SSTab1
.Top = 480
.Left = 0
.Height = Me.Height - 1150 **错误在这"无效属性值"
.Width = Me.Width - 100
End With
With lv1
.Top = 360
.Left = 0
.Width = Me.Width - 150
.Height = Me.Height - 1500
End With
With tv1
.Top = 360
.Left = 0
.Height = Me.Height - 1495
End With
With lv2
.Left = 3960
.Top = 360
.Width = Me.Width - 4100
.Height = (Me.Height - 1760) / 2
End With
With Text4
.Top = 3480 + (Me.Height - 8000) / 2
.Left = 3960
.Width = Me.Width - 4100
.Height = (Me.Height - 1960) / 2 + 350
End With
End Sub
On Error Resume Next
Private Sub Form_Resize()
if me.windowstate <>1 then
With SSTab1
.Top = 480
.Left = 0
.Height = Me.Height - 1150 **错误在这"无效属性值"
.Width = Me.Width - 100
End With
With lv1
.Top = 360
.Left = 0
.Width = Me.Width - 150
.Height = Me.Height - 1500
End With
With tv1
.Top = 360
.Left = 0
.Height = Me.Height - 1495
End With
With lv2
.Left = 3960
.Top = 360
.Width = Me.Width - 4100
.Height = (Me.Height - 1760) / 2
End With
With Text4
.Top = 3480 + (Me.Height - 8000) / 2
.Left = 3960
.Width = Me.Width - 4100
.Height = (Me.Height - 1960) / 2 + 350
End With
end if
End Sub
if me.windowstate<>1 then
---
end if的判断,因为最小化时实际上一切的设置都没有用处,何必设置呢?既可以提高代码效率,又可以避免因此而来的诸多问题 !
或是加上最小化的判断,这样最后