﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ObKlikuDodaj
{
    public partial class Form1 : Form
    {
        // Button btnAdd = new Button();

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Label[] tabOznak = new Label[5];
            for (int i = 0; i < tabOznak.Length; i++)
            {
                Label lab = new Label();
                lab.Text = "Oznaka" + i.ToString();
                lab.Location = new Point(i * (lab.Width + 5), 10);
                tabOznak[i] = lab;
                this.Controls.Add(tabOznak[i]);
            }
            

        }

        private void Form1_Click(object sender, EventArgs e)
        {
            Button btnAdd = new Button();
            btnAdd.BackColor = Color.Gray;
            btnAdd.Text = "Add";
            btnAdd.Location = new System.Drawing.Point(90, 55);
            btnAdd.Size = new System.Drawing.Size(50, 25);
            btnAdd.Tag = "gmb";
            this.Controls.Add(btnAdd);

        }

        private void Form1_DoubleClick(object sender, EventArgs e)
        {
            foreach (Control item in this.Controls)
            {
                if (item.Tag == "gmc")
                    this.Controls.Remove((Button)item);
            }
        }
    }
}
