Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 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.Windows.Forms;
  9.  
  10. namespace ClickTheBox
  11. {
  12.     public partial class X : Form
  13.     {
  14.         int score;
  15.         public X()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Form1_Load(object sender, EventArgs e)
  21.         {
  22.             Left = 0;
  23.             Top = 0;
  24.             Width = Screen.PrimaryScreen.WorkingArea.Width;
  25.             Height = Screen.PrimaryScreen.WorkingArea.Height;
  26.         }
  27.  
  28.         private void label1_Click(object sender, EventArgs e)
  29.         {
  30.  
  31.         }
  32.  
  33.         private void label1_Click_1(object sender, EventArgs e)
  34.         {
  35.             timer1.Interval -= 50;
  36.             score += 1;
  37.             label2.Text = score.ToString();
  38.         }
  39.  
  40.         private void label1_Click_2(object sender, EventArgs e)
  41.         {
  42.             Application.Exit();
  43.         }
  44.  
  45.         private void timer1_Tick(object sender, EventArgs e)
  46.         {
  47.             Random r = new Random();
  48.  
  49.             Box.Left = r.Next(0, Width);
  50.             Box.Top = r.Next(0, Height);
  51.         }
  52.  
  53.         private void button1_Click(object sender, EventArgs e)
  54.         {
  55.             timer1.Interval = 1000;
  56.             label2.Text = "0";
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement