Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using System.Drawing;
  4.  
  5. namespace Fitt_s_Law
  6. {
  7. class Startscherm : Form
  8. {
  9. Button beginBtn = new Button();
  10. Button randomBtn = new Button();
  11.  
  12. Random plaats = new Random();
  13. //int plaatsx = 50;
  14. //int plaatsy = 50;
  15.  
  16.  
  17. public Startscherm() {
  18.  
  19. //Opmaak startscherm
  20. this.Text = "Fitts' Law - Startscherm";
  21. this.Size = new Size(500, 500);
  22.  
  23. beginBtn.Location = new Point(230, 250);
  24. randomBtn.Location = new Point(210, 250);
  25.  
  26. //Aanroepen inhoud startscherm
  27. this.Paint += this.StartGame;
  28.  
  29. }
  30.  
  31.  
  32.  
  33. public void StartGame(object obj, PaintEventArgs pea)
  34. {
  35. //Random locatie aanmaken
  36.  
  37.  
  38. //Aanmaken startknop
  39.  
  40. beginBtn.Text = "je moeder";
  41.  
  42. //Aanmaken randomBtn
  43.  
  44. randomBtn.Text = "Klik mij!";
  45.  
  46. //Opmaak van beginBtn
  47. beginBtn.BackColor = Color.White;
  48. beginBtn.FlatStyle = FlatStyle.Flat;
  49. beginBtn.FlatAppearance.BorderColor = Color.Maroon;
  50. beginBtn.Location = new Point(230, 250);
  51.  
  52. //Aanroepen acties na het klikken op beginBtn
  53. beginBtn.Click += beginBtn_Click;
  54.  
  55.  
  56. //Opmaak van randomBtn
  57. randomBtn.BackColor = Color.White;
  58. randomBtn.FlatStyle = FlatStyle.Flat;
  59. randomBtn.FlatAppearance.BorderColor = Color.Maroon;
  60. randomBtn.Location = new Point(210, 250);
  61.  
  62. //Aanroepen acties na het klikken op randomBtn
  63. randomBtn.Click += randomBtn_Click;
  64.  
  65. //Verbergen van randomBtn tijdens opstart form
  66. randomBtn.Hide();
  67.  
  68. //Toevoegen van knoppen aan scherm
  69. this.Controls.Add(beginBtn);
  70. this.Controls.Add(randomBtn);
  71.  
  72. // beginBtn.Click += beginBtn_Click;
  73.  
  74.  
  75. }
  76.  
  77. public void beginBtn_Click(object sender, EventArgs e)
  78. {
  79. Console.WriteLine("PEPERAGE");
  80. beginBtn.Hide();
  81. randomBtn.Show();
  82.  
  83. //Random plaats = new Random();
  84. //int plaatsx = plaats.Next(0, 500);
  85. //int plaatsy = plaats.Next(0, 500);
  86. //randomBtn.Location = new Point(50, 50);
  87. //randomBtn.Show();
  88.  
  89. }
  90.  
  91.  
  92. public void randomBtn_Click(object sender, EventArgs e)
  93. {
  94. Console.WriteLine("pepeace");
  95.  
  96. randomBtn.Hide();
  97.  
  98. beginBtn.Show();
  99.  
  100. // beginBtn.Show();
  101.  
  102.  
  103.  
  104. }
  105.  
  106. }
  107.  
  108. class Program
  109. {
  110.  
  111. static void Main(string[] args)
  112. {
  113. //Aanmaken en opstarten van startscherm
  114. Startscherm startscherm;
  115. startscherm = new Startscherm();
  116. Application.Run(startscherm);
  117.  
  118. }
  119.  
  120.  
  121.  
  122.  
  123.  
  124. }
  125.  
  126.  
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement