void Menu_Click(object sender, EventArgs e) { Program.TimerReset(); var MenuButton = sender as Button; menu = new BuildingMenu(); menu.Tag = MenuButton.Tag; menu.Parent = this; menu.Location = new Point(MenuButton.Location.X - 100, MenuButton.Location.Y + MenuButton.Height); mask = new Label(); mask.BackColor = this.BackColor; mask.Size = this.Size; //mask.Location = this.Location; mask.Parent = this; mask.BringToFront(); var nam = this.Controls[this.Controls.IndexOfKey("name" + menu.Tag.ToString())] as Button; var org = this.Controls[this.Controls.IndexOfKey("org" + menu.Tag.ToString())] as Label; nam.BringToFront(); org.BringToFront(); mask.Show(); var c = list[(int)menu.Tag]; nam.Enabled = false; menu.EditRecord += EditRecord_Click; menu.AddFamily += AddToFamily_Click; menu.CancelMenu += CancelMenu_Click; menu.Show(); menu.BringToFront(); }