大家好:  
    我写了一个窗口缩放的程序,无论你如何变化,她都没问题,但是,但窗口最小化时,问题来了,出现了"无效属性值",代码如下:
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

解决方案 »

  1.   

    在过程的第一句写上
    On Error Resume Next
      

  2.   

    当最小化时你不能调用me.height或me.width,改一改就可以了:
    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
      

  3.   

    注意,即使没有调用me.height或me.width等属性,在Form_resize的代码中,最好都加上
     if me.windowstate<>1 then
       ---
     end if的判断,因为最小化时实际上一切的设置都没有用处,何必设置呢?既可以提高代码效率,又可以避免因此而来的诸多问题 !
      

  4.   

    加上on error resume next也可
    或是加上最小化的判断,这样最后