Advertisement
Guest User

sadsadsa

a guest
Oct 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. int AB = 0;
  2.  
  3.  
  4. private void Form1_MouseClick(object sender, MouseEventArgs e)
  5. {
  6. Random rand = new Random();
  7. int g2 = rand.Next(450);
  8. int g3 = rand.Next(240);
  9. int r1 = rand.Next(90);
  10. Button b1 = new Button();
  11. TextBox b2 = new TextBox();
  12. b1.Name = "b12";
  13. b2.Name = "b22";
  14. if (e.Button == MouseButtons.Left && AB%2 != 0)
  15. {
  16. b1.Location = new Point(e.X, e.Y);
  17. b1.Text = string.Format("{0},{1}", e.X, e.Y);
  18. b1.Parent = this;
  19. AB++;
  20. }
  21.  
  22. else if (e.Button == MouseButtons.Left && AB % 2 == 0)
  23. {
  24. b2.Location = new Point(e.X, e.Y);
  25. b2.Text = string.Format("{0},{1}", e.X, e.Y);
  26. b2.Parent = this;
  27. AB++;
  28. }
  29. else if (e.Button == MouseButtons.Right)
  30. {
  31. this.Controls.Remove(b1);
  32. this.Controls.Remove(b2);
  33. this.Refresh();
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement