Advertisement
D3NCE

ANIMATION IN WINFORMS – PART 2 – SIDE PANEL

Dec 22nd, 2018
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. Video URL: https://www.youtube.com/watch?v=JcPdy32rCNo
  2.  
  3. Hier der Programmcode:
  4.  
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14.  
  15. namespace AiWF2___Site_Panel
  16. {
  17. public partial class Form1 : Form
  18. {
  19. int panelbreite;
  20. bool zeigen;
  21.  
  22. public Form1()
  23. {
  24. InitializeComponent();
  25. panelbreite = pnl_dropmenu.Width;
  26. zeigen = false;
  27. }
  28.  
  29. private void Form1_Load(object sender, EventArgs e)
  30. {
  31.  
  32. }
  33.  
  34. private void bttn_open_Click(object sender, EventArgs e)
  35. {
  36. if (zeigen)
  37. {
  38. bttn_open.Text = "–>";
  39. }
  40. else
  41. {
  42. bttn_open.Text = "<–";
  43. }
  44.  
  45. time_form.Start();
  46. }
  47.  
  48. private void time_form_Tick(object sender, EventArgs e)
  49. {
  50. if (zeigen)
  51. {
  52. pnl_dropmenu.Width = pnl_dropmenu.Width + 20;
  53. if (pnl_dropmenu.Width >= panelbreite)
  54. {
  55. time_form.Stop();
  56. zeigen = false;
  57. this.Refresh();
  58. }
  59. }
  60. else
  61. {
  62. pnl_dropmenu.Width = pnl_dropmenu.Width20;
  63. if (pnl_dropmenu.Width <= 0)
  64. {
  65. time_form.Stop();
  66. zeigen = true;
  67. this.Refresh();
  68. }
  69. }
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement