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;
- using System.Threading;
- namespace gameCreation
- {
- public partial class Form1 : Form
- {
- int panelCount;
- public Form1()
- {
- InitializeComponent();
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- int trueX = Cursor.Position.X - this.Location.X;
- int trueY = Cursor.Position.Y - this.Location.Y;
- foreach(Panel P in this.Controls)
- {
- if(P != null)
- {
- if (trueX < this.Width && trueX > (this.Width - 50) && trueY < 112 && trueY > 12)
- {
- ((Panel)P).SetBounds(((Panel)P).Location.X - 3, ((Panel)P).Location.Y, 200, 100);
- }
- }
- if (((Panel)P).Location.X <= (0 - ((Panel)P).Width))
- {
- ((Panel)P).SetBounds(((Panel)P).Location.X + (panelCount * 200) + (panelCount * 6), ((Panel)P).Location.Y, 200, 100);
- }
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- foreach(Panel P in this.Controls)
- {
- panelCount++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment