Advertisement
al33kappa

Untitled

May 15th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Idon_tevenknow
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19. bool flag = true;
  20. int pol = 427;
  21. int potolok1 = 70;
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24.  
  25. timer1.Interval = 10;
  26. timer1.Start();
  27. //HB(3, 1, 2, 3);
  28. }
  29. public void HB(int n, int x, int y, int z)
  30. {
  31. if (n != 0)
  32. {
  33. HB(n - 1, x, z, y);
  34. listBox1.Items.Add($"{x} -> {y}");
  35. HB(n - 1, z, y, x);
  36. }
  37. }
  38. public void moving()
  39. {
  40. int potolok2 = (label6.Location.X - (label3.Width / 2));
  41. if (label3.Location.X == label3.Location.X && label3.Location.Y > potolok1 && flag) label3.Top -= 5;
  42. else if (label3.Location.Y == label3.Location.Y && label3.Location.X < potolok2)
  43. {
  44. label3.Left += 5;
  45. flag = false;
  46. }
  47. else if (label3.Location.X > potolok2 && label3.Bottom+(label3.Height+ label3.Height/2) < 427) label3.Top += 5;
  48. else textBox1.Text = label3.Location.X + " " + label3.Location.Y.ToString();
  49. }
  50.  
  51. private void timer1_Tick(object sender, EventArgs e)
  52. {
  53. moving();
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement