Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- StreamReader sr = new StreamReader("kulonbsegek.txt");
- while (!sr.EndOfStream)
- {
- int x = int.Parse(sr.ReadLine());
- int y = int.Parse(sr.ReadLine());
- int szelesseg = int.Parse(sr.ReadLine());
- int magassag = int.Parse(sr.ReadLine());
- Kocka k = new Kocka();
- k.Top = y;
- k.Left = x;
- k.Width = szelesseg;
- k.Height = magassag;
- this.Controls.Add(k);
- k.Click += K_Click;
- }
- }
- private void K_Click(object sender, EventArgs e)
- {
- int darab = 0;
- foreach (Kocka k in this.Controls)
- {
- if (k.BackColor == Color.Red)
- {
- darab++;
- }
- }
- if (darab == 15)
- {
- MessageBox.Show("Nyertél");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement