How to make Click me game in c#
Screen Shot
Code
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 ClickMe
{
public partial class Game : Form
{
public Game()
{
InitializeComponent();
}
private void button1_MouseEnter(object sender, EventArgs e)
{
Random r = new Random();
int i = r.Next(0 + 100, this.Width - 100);
Random rb = new Random();
int j = rb.Next(0 + 100, this.Height - 100);
button1.Location = new System.Drawing.Point(i, j);
//button1.Text = string.Format("({0}:{1})", i, j);
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Nice");
}
}
}
Screen Shot
Code
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 ClickMe
{
public partial class Game : Form
{
public Game()
{
InitializeComponent();
}
private void button1_MouseEnter(object sender, EventArgs e)
{
Random r = new Random();
int i = r.Next(0 + 100, this.Width - 100);
Random rb = new Random();
int j = rb.Next(0 + 100, this.Height - 100);
button1.Location = new System.Drawing.Point(i, j);
//button1.Text = string.Format("({0}:{1})", i, j);
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Nice");
}
}
}
No comments:
Post a Comment