private void timer3_Tick(object sender, EventArgs e) //////BIG FORM { var exePath = AppDomain.CurrentDomain.BaseDirectory; //path to exe file var path = Path.Combine(exePath, @"Foto\DogRun.png"); pictureBox1.BackColor = Color.Transparent; pictureBox1.Image = Image.FromFile(path); //pictureBox1.Image = Image.FromFile("E:/Мопс2.png"); pictureBox1.Left += x; Random r = new Random(); if (pictureBox1.Left >= this.ClientSize.Width - pictureBox1.Width) { x *= (-1); } if (this.ClientSize.Width <= 816) { pictureBox1.Location = new Point(this.ClientSize.Width - pictureBox1.Location.X, 333); BigForm.Stop(); timer1.Start(); } if (pictureBox1.Left < 0) { x *= (-1); } }
private void Action_Click(object sender, EventArgs e) { if (pictureBox2.Visible == false) { if (this.ClientSize.Width <= 816) { timer1.Start(); } if (this.ClientSize.Width > 816) { pictureBox1.Location = new Point(pictureBox1.Location.X, 560); if (pictureBox1.Location.Y == 560) { timer1.Stop(); BigForm.Start(); } } } var exePath = AppDomain.CurrentDomain.BaseDirectory;//path to exe file var path = Path.Combine(exePath, @"Foto\SleepRoom.png"); var LiveRoom = Path.Combine(exePath, @"Foto\Фон.png"); if (Train.Visible == false) { BackgroundImage = Image.FromFile(LiveRoom); Ball.Visible = true; Train.Visible = true; Action.Visible = true; timer1.Start(); } if (pictureBox2.Visible == true) { int meat; MessageBox.Show("Liy"); meat = r.Next(liy1, liy2); if (meat == 3) { exePath = AppDomain.CurrentDomain.BaseDirectory;//path to exe file var DogLie = Path.Combine(exePath, @"Foto\DogLie.png"); pictureBox1.Image = Image.FromFile(DogLie); pictureBox2.Visible = false; if (liy1 == 2 || liy2 == 4) { return; } liy1++; liy2--; } } }
private void Ball_Click(object sender, EventArgs e) { var exePath = AppDomain.CurrentDomain.BaseDirectory;//path to exe file var Ball = Path.Combine(exePath, @"Foto\Мяч.png"); pictureBox2.Visible = true; pictureBox2.Image = Image.FromFile(Ball); pictureBox2.BackColor = Color.Transparent; pictureBox2.Location = new Point(351, 197); //pictureBox1.Image = Image.FromFile("E:/Безимени-1.png"); timer1.Stop(); BigForm.Stop(); timer2.Start(); }
private void Sleep_Click(object sender, EventArgs e) { var exePath = AppDomain.CurrentDomain.BaseDirectory;//path to exe file var pathDog = Path.Combine(exePath, @"Foto\DogSleep.png"); var path = Path.Combine(exePath, @"Foto\SleepRoom.png"); BackgroundImage = Image.FromFile(path); pictureBox1.Image = Image.FromFile(pathDog); //pictureBox1.Location = new Point(900, 480); timer1.Stop(); timer2.Stop(); BigForm.Stop(); Ball.Visible = false; Train.Visible = false; }
private void Train_Click(object sender, EventArgs e) { var exePath = AppDomain.CurrentDomain.BaseDirectory;//path to exe file var Meat = Path.Combine(exePath, @"Foto\Безимени-2.png"); int x1 = pictureBox1.Location.X; pictureBox2.Visible = true; pictureBox2.BackColor = Color.Transparent; pictureBox2.Location = new Point(x1, 208); pictureBox2.Image = Image.FromFile(Meat); var Dog = Path.Combine(exePath, @"Foto\Dog1.png"); pictureBox1.Image = Image.FromFile(Dog); timer1.Stop(); timer2.Stop(); BigForm.Stop(); }
private void timer2_Tick(object sender, EventArgs e) { var exePath = AppDomain.CurrentDomain.BaseDirectory;//path to exe file var path = Path.Combine(exePath, @"Foto\DogRun.png"); pictureBox1.BackColor = Color.Transparent; pictureBox1.Image = Image.FromFile(path); if (this.ClientSize.Width > 816) { pictureBox1.Location = new Point(pictureBox1.Location.X, 560); } if (this.ClientSize.Width <= 816) { pictureBox1.Location = new Point(pictureBox1.Location.X, 333); } pictureBox1.Left += x; pictureBox2.Left += xbal; pictureBox2.Top -= ybal; if (pictureBox2.Left >= this.ClientSize.Width - pictureBox2.Width) { xbal *= (-1); } if (pictureBox2.Left < 0) { xbal *= (-1); } if (pictureBox2.Top < 0) { ybal *= (-1); } if (pictureBox2.Top > this.ClientSize.Height - pictureBox2.Height) { ybal *= (-1); } if (pictureBox1.Left >= this.ClientSize.Width - pictureBox1.Width) { x *= (-1); } if (pictureBox1.Left < 0) { x *= (-1); } if (pictureBox1.Left <= pictureBox2.Right && pictureBox2.Left <= pictureBox1.Right && pictureBox1.Top <= pictureBox2.Bottom && pictureBox2.Top <= pictureBox1.Bottom) { timer2.Stop(); if (this.ClientSize.Width == 816) { timer1.Start(); } if (this.ClientSize.Width > 816) { if (pictureBox1.Location.Y == 560) { BigForm.Stop(); } } var DogBall = Path.Combine(exePath, @"Foto\МопсМяч.png"); pictureBox2.Visible = false; pictureBox1.Image = Image.FromFile(DogBall); // timer1.Start(); } }