Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- using System.Drawing;
- namespace Practicum1
- {
- class Program
- {
- static void Main()
- {
- Application.Run(new Scherm());
- }
- }
- class Scherm : Form
- {
- Button knop = new Button();
- public Scherm()
- {
- SetSize();
- this.BackColor = Color.White;
- this.Text = "Fitts' Law";
- Start();
- }
- public void SetSize()
- {
- //select screen size
- string screenWidth = Screen.PrimaryScreen.Bounds.Width.ToString();
- string screenHeight = Screen.PrimaryScreen.Bounds.Height.ToString();
- //convert string sizes to ints
- int width = Convert.ToInt32(screenWidth);
- int height = Convert.ToInt32(screenHeight);
- //set new screen size
- this.Size = new Size(width, height);
- }
- public void Start()
- {
- knop.Size = new Size(100, 30);
- knop.Text = "Start";
- knop.Left = (this.ClientSize.Width - knop.Width) / 2;
- knop.Top = (this.ClientSize.Height - knop.Height) / 2;
- this.Controls.Add(knop);
- knop.Click += this.click;
- }
- public void click(Object o, EventArgs pea)
- {
- knop.Hide();
- Button vierkant;
- vierkant = new Button();
- vierkant.Size = new Size(50, 50);
- vierkant.Text = "Click";
- vierkant.Click += this.click;
- this.Controls.Add(vierkant);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement