Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- using System.Drawing;
- using System.Diagnostics;
- namespace Fitts
- {
- class Program
- {
- static void Main()
- {
- Application.Run(new Scherm());
- }
- }
- class Scherm : Form
- {
- Button knop;
- Button knop2;
- Random x = new Random();
- Point punt;
- public Scherm()
- {
- this.Text = "Prakticum1";
- this.ClientSize = new Size(240, 60);
- this.WindowState = FormWindowState.Maximized;
- knop = new Button();
- knop.Location = new Point(600, 350);
- knop.Size = new Size(200, 80);
- knop.Text = "Start";
- this.Controls.Add(knop);
- knop.Click += new EventHandler(eerste_click);
- punt = new Point(int.Parse(x.Next(600).ToString()), int.Parse(x.Next(700).ToString()));
- knop2 = new Button();
- knop2.Location = punt;
- knop2.Text = "Klik";
- knop2.Size = new Size(100, 100);
- knop2.Visible = false;
- this.Controls.Add(knop2);
- knop2.Click += new EventHandler(tweede_klick);
- }
- void eerste_click(object sender, EventArgs e)
- {
- this.BackColor = System.Drawing.Color.Azure;
- knop.Text = "Herhaal";
- knop.Visible = false;
- knop2.Visible = true;
- }
- void tweede_klick(object sender, EventArgs e)
- {
- this.BackColor = System.Drawing.Color.White;
- knop.Visible = true;
- knop2.Location = new Point(int.Parse(x.Next(1500).ToString()), int.Parse(x.Next(600).ToString()));
- knop2.Size = new Size(int.Parse(x.Next(40, 120).ToString()), int.Parse(x.Next(40, 120).ToString()));
- knop2.Visible = false;
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement