Advertisement
D3NCE

ANIMATION IN WINDOWS FORMS ANWENDUNGEN – PART 1 – TEXTANIMAT

Dec 22nd, 2018
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. Video URL: https://www.youtube.com/watch?v=CV9hGCDTPdA
  2.  
  3. Das muss in den Form Load:
  4.  
  5. private void Form1_Load(object sender, EventArgs e)
  6. {
  7. timer1.Start();
  8. timer2.Start();
  9. }
  10.  
  11.  
  12.  
  13. Hier der Code für den Lauftext:
  14.  
  15. private void timer1_Tick(object sender, EventArgs e)
  16. {
  17. lbl_lauf.Location = new Point(lbl_lauf.Location.X + 5, lbl_lauf.Location.Y);
  18. if (lbl_lauf.Location.X > this.Width)
  19. {
  20. lbl_lauf.Location = new Point(0 – lbl_lauf.Width, lbl_lauf.Location.Y);
  21. }
  22. }
  23.  
  24.  
  25.  
  26. Hier der Code für den Blinktext:
  27.  
  28. Ihr müsst zusätzlich einen Integer mit dem Farbzustand erstellen. Diesen müsst ihr direkt in die Partial Class erstellen da jede Methode Zugriff auf diesen benötigt. Für das erstellen könnt ihr: int co = 0; verwenden
  29.  
  30.  
  31.  
  32. private void timer2_Tick(object sender, EventArgs e)
  33. {
  34. if (co == 0)
  35. {
  36. lbl_blink.ForeColor = Color.Blue;
  37. co = 1;
  38. }
  39. else
  40. {
  41. lbl_blink.ForeColor = Color.Red;
  42. co = 0;
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement