Antivir einblendeffekt

    • VB.NET

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

      Antivir einblendeffekt

      Blendet eine Form langsam rechts unten über der Taskleite ein.

      Wird benötigt
      1. 1x Windows Form (Name: Popup)

      VB.NET-Quellcode

      1. Public Class Popup
      2. Private y As Integer
      3. Private t As Threading.Thread
      4. Delegate Sub SetLocationCallback(ByVal location As Point)
      5. Delegate Sub CloseCallback()
      6. Private Sub SetLocation(ByVal location As Point)
      7. If Me.InvokeRequired Then
      8. Dim d As New SetLocationCallback(AddressOf SetLocation)
      9. Me.Invoke(d, New Object() {[location]})
      10. Else
      11. Me.Location = location
      12. End If
      13. End Sub
      14. Private Sub _Close()
      15. If Me.InvokeRequired Then
      16. Dim d As New CloseCallback(AddressOf _Close)
      17. Me.Invoke(d)
      18. Else
      19. Me.Close()
      20. End If
      21. End Sub
      22. Private Sub Popup_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      23. Me.y = My.Computer.Screen.WorkingArea.Height + Me.Height
      24. Me.TopMost = True
      25. Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
      26. Me.Location = New Point(My.Computer.Screen.WorkingArea.Width - Me.Width, y)
      27. Me.t = New Threading.Thread(AddressOf _show)
      28. Me.t.Start()
      29. End Sub
      30. Private Sub Popup_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
      31. Me.t = New Threading.Thread(AddressOf _hide)
      32. Me.t.Start()
      33. End Sub
      34. Private Sub _show()
      35. While Me.Location.Y >= My.Computer.Screen.WorkingArea.Height - Me.Height + 50
      36. Me.SetLocation(New Point(My.Computer.Screen.WorkingArea.Width - Me.Width, y))
      37. Me.y -= 50
      38. Threading.Thread.Sleep(50)
      39. End While
      40. End Sub
      41. Private Sub _hide()
      42. While Me.Location.Y <= My.Computer.Screen.WorkingArea.Height + Me.Height - 50
      43. Me.SetLocation(New Point(My.Computer.Screen.WorkingArea.Width - Me.Width, y))
      44. Me.y += 50
      45. Threading.Thread.Sleep(50)
      46. End While
      47. Me._Close()
      48. End Sub
      49. End Class


      Verbesserungsvorschläge erwünscht :)
      Dein Popup ist bei mir halb auf der Taskleiste, mit folgendem Code wird
      die Screengröße ermittelt , Taskbar in Height abgezogen und damit
      hat man das Popup da wo´s hinsoll.

      VB.NET-Quellcode

      1. Option Strict On
      2. Public Class Popup
      3. Dim screenheightwithouttaskbar As Integer
      4. Dim opening As Boolean
      5. Private Sub Popup_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      6. Me.Visible = False
      7. Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
      8. Me.TopMost = True
      9. Me.ShowInTaskbar = False
      10. Me.Width = 256
      11. Me.Height = 1
      12. screenheightwithouttaskbar = Screen.PrimaryScreen.Bounds.Height - (Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height) - Me.Height
      13. Me.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - Me.Width, screenheightwithouttaskbar)
      14. opening = True
      15. Me.Visible = True
      16. TiShow.Interval = 1
      17. TiShow.Start()
      18. End Sub
      19. Private Sub TiShow_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TiShow.Tick
      20. If opening = True Then
      21. If Me.Height < 256 Then
      22. Me.Height += 2
      23. screenheightwithouttaskbar = Screen.PrimaryScreen.Bounds.Height - (Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height) - Me.Height
      24. Me.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - Me.Width, screenheightwithouttaskbar)
      25. ElseIf Me.Height >= 256 Then
      26. System.Threading.Thread.Sleep(2500)
      27. opening = False
      28. End If
      29. Else
      30. If Me.Height > 2 Then
      31. Me.Height -= 2
      32. screenheightwithouttaskbar = Screen.PrimaryScreen.Bounds.Height - (Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height) - Me.Height
      33. Me.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - Me.Width, screenheightwithouttaskbar)
      34. ElseIf Me.Height <= 2 Then
      35. Application.Exit()
      36. End If
      37. End If
      38. End Sub
      39. End Class


      Ist etwas kürzer, aber meiner Meinung nach schöner im Ergebnis.

      MfG,

      Derfuhr.

      VB.NET-Quellcode

      1. Screen.PrimaryScreen.WorkingArea.Width - Me.Width - 20


      Sonst ist es ~10px außerhalb des Bildschirms. ;)
      Moderatorin: "Apropo ritzen.." Shin Chan: "hoho sie hat Po ritze gesagt"
      "saying to buy a mac because your anti-virus expired is like saying you're out of condoms so you're just going to go fuck dudes"
      "Wie auch in anderen Threads kann ich leider nichts bieten außer vielleicht spaß beim Skypen aber mehr leider auch nicht." - Sind kinder pornos nicht verboten?
      1920x1080
      Moderatorin: "Apropo ritzen.." Shin Chan: "hoho sie hat Po ritze gesagt"
      "saying to buy a mac because your anti-virus expired is like saying you're out of condoms so you're just going to go fuck dudes"
      "Wie auch in anderen Threads kann ich leider nichts bieten außer vielleicht spaß beim Skypen aber mehr leider auch nicht." - Sind kinder pornos nicht verboten?