Ausblendeffekt

    • VB.NET

    Es gibt 6 Antworten in diesem Thema. Der letzte Beitrag () ist von Bugcoder.

      Ausblendeffekt

      Hi Comm,
      das ist kein normaler Ausblendeffekt, sondern die Form schrumpft nach links oben hin weg.
      Ins FormClosing Event:

      VB.NET-Quellcode

      1. e.Cancel = True
      2. For i = 0 To Me.Size.Width
      3. Me.Size = New Size(Me.Size.Width - 1, Me.Size.Height)
      4. Next
      5. For i = 0 To Me.Size.Height
      6. Me.Size = New Size(Me.Size.Width, Me.Size.Height - 1)
      7. Next
      8. End
      LG
      Merio
      Ich würde statt End Application.Exit() nehmen, aber da er es dann nicht beenden wird(wegen e.cancel = true):

      VB.NET-Quellcode

      1. For i = 0 To Me.Size.Width
      2. Me.Size = New Size(Me.Size.Width - 1, Me.Size.Height)
      3. Next
      4. For i = 0 To Me.Size.Height
      5. Me.Size = New Size(Me.Size.Width, Me.Size.Height - 1)
      6. Next
      7. Application.Exit()


      Gruß, Gugi :thumbup:
      Man könnte auch beide Seiten gleichzeitig wegschrumpfen lassen, etwa so:

      VB.NET-Quellcode

      1. e.Cancel = True
      2. Dim z As Integer = 300
      3. Dim x As Integer = Me.Width / z
      4. Dim y As Integer = Me.Height / z
      5. Dim mx As Integer = Me.Width
      6. Dim my As Integer = Me.Height
      7. For i = 1 To z
      8. Me.Width = mx - Math.Round(x * i)
      9. Me.Height = my - Math.Round(y * i)
      10. Next
      11. End
      @Kouki
      wie oben bereits gesagt würde ich statt end application.exit() nehmen.
      hab mir aus langeweile auch einen einblendeffekt gemacht ;) (die form muss quadratisch sein..)

      VB.NET-Quellcode

      1. Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
      2. For Each Control As Control In Me.Controls
      3. Control.Visible = False
      4. Next
      5. For i = 1 To 300
      6. Me.Width = i
      7. Me.Height = i
      8. Next
      9. For Each Control As Control In Me.Controls
      10. Control.Visible = True
      11. Next
      12. End Sub


      Gruß, Gugi :thumbup: