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 WindowsFormsApp4
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- label2.BackColor = Color.Red;
- label1.BackColor = Color.Yellow;
- label3.BackColor = Color.Orange;
- label4.BackColor = Color.Purple;
- label5.BackColor = Color.Blue;
- labelCarcas.BackColor = Color.Black;
- }
- int pot1 = 44;
- bool flag = true;
- Stack<Label> F_stack = new Stack<Label>();
- Stack<Label> S_stack = new Stack<Label>();
- int i = 2, j = 0;
- Label[] massiv;
- int[] massivj = new int[4] { -1, -2, -3, -4 };
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- move_1_2();
- }
- public void button1_Click(object sender, EventArgs e)
- {
- timer1.Interval = 2;
- F_stack.Push(label1);
- F_stack.Push(label2);
- F_stack.Push(label3);
- //F_stack.Push(label4);
- //F_stack.Push(label5);
- massiv = new Label[5] { label11, label22, label33, label44, label55 };
- /*S_stack.Push(label55);
- S_stack.Push(label44);
- S_stack.Push(label33);
- S_stack.Push(label22);
- S_stack.Push(label11);*///�� ��������
- timer1.Start();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- public void move_1_2()
- {
- if (F_stack.Count == 0)
- {
- timer1.Stop();
- }
- else
- {
- if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y >= pot1 && flag)
- {
- F_stack.Peek().Top -= 4;
- }
- else if (F_stack.Peek().Location.Y == F_stack.Peek().Location.Y && F_stack.Peek().Location.X < massiv[i].Location.X)
- {
- F_stack.Peek().Left += 4;
- flag = false;
- }
- else if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y <= massiv[j].Location.Y)
- {
- F_stack.Peek().Top += 4;
- }
- else
- {
- S_stack.Push(F_stack.Peek());
- F_stack.Pop();
- i--;
- j++;
- flag = true;
- }
- }
- }//move_1_2_end
- private public move_1_3()
- {
- }//move_1_3_end
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement