Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int AB = 0;
- private void Form1_MouseClick(object sender, MouseEventArgs e)
- {
- Random rand = new Random();
- int g2 = rand.Next(450);
- int g3 = rand.Next(240);
- int r1 = rand.Next(90);
- Button b1 = new Button();
- TextBox b2 = new TextBox();
- b1.Name = "b12";
- b2.Name = "b22";
- if (e.Button == MouseButtons.Left && AB%2 != 0)
- {
- b1.Location = new Point(e.X, e.Y);
- b1.Text = string.Format("{0},{1}", e.X, e.Y);
- b1.Parent = this;
- AB++;
- }
- else if (e.Button == MouseButtons.Left && AB % 2 == 0)
- {
- b2.Location = new Point(e.X, e.Y);
- b2.Text = string.Format("{0},{1}", e.X, e.Y);
- b2.Parent = this;
- AB++;
- }
- else if (e.Button == MouseButtons.Right)
- {
- this.Controls.Remove(b1);
- this.Controls.Remove(b2);
- this.Refresh();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement