Advertisement
Guest User

FittsMalteSoFar

a guest
Nov 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using System.Drawing;
  4. using System.Diagnostics;
  5.  
  6.  
  7. namespace Fitts
  8. {
  9. class Program
  10. {
  11. static void Main()
  12. {
  13. Application.Run(new Scherm());
  14. }
  15. }
  16.  
  17.  
  18. class Scherm : Form
  19. {
  20. Button knop;
  21. Button knop2;
  22. Random x = new Random();
  23. Point punt;
  24.  
  25. public Scherm()
  26. {
  27. this.Text = "Prakticum1";
  28. this.ClientSize = new Size(240, 60);
  29. this.WindowState = FormWindowState.Maximized;
  30.  
  31. knop = new Button();
  32. knop.Location = new Point(600, 350);
  33. knop.Size = new Size(200, 80);
  34. knop.Text = "Start";
  35. this.Controls.Add(knop);
  36.  
  37. knop.Click += new EventHandler(eerste_click);
  38.  
  39. punt = new Point(int.Parse(x.Next(600).ToString()), int.Parse(x.Next(700).ToString()));
  40.  
  41. knop2 = new Button();
  42. knop2.Location = punt;
  43. knop2.Text = "Klik";
  44. knop2.Size = new Size(100, 100);
  45. knop2.Visible = false;
  46. this.Controls.Add(knop2);
  47.  
  48. knop2.Click += new EventHandler(tweede_klick);
  49.  
  50. }
  51.  
  52.  
  53. void eerste_click(object sender, EventArgs e)
  54. {
  55. this.BackColor = System.Drawing.Color.Azure;
  56. knop.Text = "Herhaal";
  57. knop.Visible = false;
  58. knop2.Visible = true;
  59.  
  60. }
  61. void tweede_klick(object sender, EventArgs e)
  62. {
  63. this.BackColor = System.Drawing.Color.White;
  64. knop.Visible = true;
  65. knop2.Location = new Point(int.Parse(x.Next(1500).ToString()), int.Parse(x.Next(600).ToString()));
  66. knop2.Size = new Size(int.Parse(x.Next(40, 120).ToString()), int.Parse(x.Next(40, 120).ToString()));
  67. knop2.Visible = false;
  68. Console.WriteLine();
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement