me.Opacity Animation bugt

  • Allgemein

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von rotherford.

    me.Opacity Animation bugt

    Hallo liebe Community!

    Zuerst mal das ist mein einfacher Code:

    VB.NET-Quellcode

    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2. My.Settings.FSU = True
    3. If My.Settings.FSU = True Then
    4. Me.Opacity = 0%
    5. TimerAnimation.Start()
    6. Else
    7. Me.Opacity = 100%
    8. End If
    9. End Sub
    10. Private Sub TimerAnimation_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerAnimation.Tick
    11. If Me.Opacity = 100% Then
    12. TimerAnimation.Stop()
    13. My.Settings.FSU = False
    14. My.Settings.Save()
    15. Else
    16. Me.Opacity = Me.Opacity + 2%
    17. End If
    18. End Sub


    My.Settings.FSU ist der erste start (FirstStartUp). Dies ist (schätze ich) irrelewant, da ich (zim testen) den ersten startup immer auf True setze.
    Das Problem ist jetzt, der Timer funktioniert nicht. es passiert nichts. Die Form wird einfach ganz normal angezeigt.

    Bitte um Hilfe.

    Edit:// Es kommt nicht auf das % zeichen an. ich habe es auch ohne probiert!
    Mfg: Gather
    Private Nachrichten bezüglich VB-Fragen werden Ignoriert!


    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Gather“ ()

    Gather schrieb:

    Es kommt nicht auf das % zeichen an

    % bedeutet Integer.
    # hingegen Double.

    Die Eigenschaft Form.Opacity ist vom Typ Double und geht von 0.00 - 1.00

    Folglich:

    VB.NET-Quellcode

    1. Me.Opacity += 0.02#


    Zu deinem Problem:

    VB.NET-Quellcode

    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2. My.Settings.FSU = True
    3. TimerAnimation.Start()
    4. End Sub
    5. Private Sub TimerAnimation_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerAnimation.Tick
    6. If Not Me.Opacity = 1.00# Then
    7. Me.Opacity += 0.02#
    8. Else
    9. TimerAnimation.Stop()
    10. My.Settings.FSU = False
    11. My.Settings.Save()
    12. End If
    13. End Sub
    /nicht getestet