/// <summary> /// Called when the GameCreator loses focus. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GameCreator_Leave(object sender, EventArgs e) { if (Controls.Find("games_menu_game_creator", true).Length != 0) { GameCreator gc = (GameCreator)Controls.Find("games_menu_game_creator", true)[0]; gc.Dispose(); } }
/// <summary> /// Displays a custom box to create a game. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Display_create_game(Object sender, EventArgs e) { GameCreator gc; if (Controls.Find("games_menu_game_creator", true).Length == 0) { gc = new GameCreator(this); gc.Name = "games_menu_game_creator"; gc.Location = new Point(this.Width - gc.Width, this.Controls.Find("games_menu_pnl_topbar", true)[0].Height); gc.LostFocus += new EventHandler(GameCreator_Leave); this.Controls.Add(gc); gc.BringToFront(); } else { gc = (GameCreator)Controls.Find("games_menu_game_creator", true)[0]; gc.Dispose(); } Change_Theme(); }