Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Idon_tevenknow
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- bool flag = true;
- Stack<Label> FirstStack = new Stack<Label>();
- Stack<Label> SecondStack = new Stack<Label>();
- Stack<Label> ThirdStack = new Stack<Label>();
- int pol = 427;
- int potolok1 = 70;
- int ukaz1 = 3, ukaz2 = 0, ukaz3 = 0;
- private void button1_Click(object sender, EventArgs e)
- {
- FirstStack.Push(label1);
- FirstStack.Push(label2);
- FirstStack.Push(label3);
- timer1.Interval = 10;
- timer1.Start();
- }
- public void HB(int n, int x, int y, int z)
- {
- if (n != 0)
- {
- HB(n - 1, x, z, y);
- listBox1.Items.Add($"{x} -> {y}");
- HB(n - 1, z, y, x);
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- HB(3, 1, 2, 3);
- }
- public void moving()
- {
- if (FirstStack.Count == 0)
- {
- timer1.Stop();
- }
- else
- {
- int potolok2 = (label6.Location.X - (FirstStack.Peek().Width / 2));
- if (FirstStack.Peek().Location.X == FirstStack.Peek().Location.X && FirstStack.Peek().Location.Y > potolok1 && flag) FirstStack.Peek().Top -= 5;
- else if (FirstStack.Peek().Location.Y == FirstStack.Peek().Location.Y && FirstStack.Peek().Location.X < potolok2)
- {
- FirstStack.Peek().Left += 5;
- flag = false;
- }
- else if (FirstStack.Peek().Location.X > potolok2 && FirstStack.Peek().Bottom + (FirstStack.Peek().Height + FirstStack.Peek().Height / 2) < 427) FirstStack.Peek().Top += 5;
- else
- {
- SecondStack.Push(FirstStack.Peek());
- FirstStack.Pop();
- textBox1.Text = label3.Location.X + " " + label3.Location.Y.ToString();
- }
- }
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- moving();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement