Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using System.Drawing;
  4.  
  5.  
  6. namespace Practicum1
  7. {
  8.  
  9. class Program
  10. {
  11. static void Main()
  12. {
  13. Application.Run(new Scherm());
  14. }
  15. }
  16.  
  17. class Scherm : Form
  18. {
  19. Button knop = new Button();
  20.  
  21. public Scherm()
  22. {
  23. SetSize();
  24. this.BackColor = Color.White;
  25. this.Text = "Fitts' Law";
  26. Start();
  27. }
  28.  
  29. public void SetSize()
  30. {
  31. //select screen size
  32. string screenWidth = Screen.PrimaryScreen.Bounds.Width.ToString();
  33. string screenHeight = Screen.PrimaryScreen.Bounds.Height.ToString();
  34. //convert string sizes to ints
  35. int width = Convert.ToInt32(screenWidth);
  36. int height = Convert.ToInt32(screenHeight);
  37. //set new screen size
  38. this.Size = new Size(width, height);
  39. }
  40.  
  41. public void Start()
  42. {
  43.  
  44.  
  45. knop.Size = new Size(100, 30);
  46. knop.Text = "Start";
  47.  
  48. knop.Left = (this.ClientSize.Width - knop.Width) / 2;
  49. knop.Top = (this.ClientSize.Height - knop.Height) / 2;
  50.  
  51. this.Controls.Add(knop);
  52. knop.Click += this.click;
  53.  
  54.  
  55. }
  56.  
  57.  
  58. public void click(Object o, EventArgs pea)
  59. {
  60. knop.Hide();
  61.  
  62. Button vierkant;
  63. vierkant = new Button();
  64. vierkant.Size = new Size(50, 50);
  65. vierkant.Text = "Click";
  66. vierkant.Click += this.click;
  67.  
  68. this.Controls.Add(vierkant);
  69.  
  70. }
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement