private void historyToolStripMenuItem_Click(object sender, EventArgs e) { if (_historyForm != null) { _historyForm.Activate(); return; } _historyForm = new HistoryForm(); _historyForm.FormClosed += history_Closed; _historyForm.Top = this.Top; _historyForm.Left = this.Right; _historyForm.SelectedPlyChanged += historyForm_SelectedPlyChanged; var screenBounds = Screen.GetBounds(this._boardView); if (_historyForm.Right >= screenBounds.Right) { _historyForm.Left = this.Left - _historyForm.Width; } if (_historyForm.Left < 0) { _historyForm.Left = 0; } _historyForm.Owner = this; foreach (var move in _gameRecord.MoveNotations) { _historyForm.AddPly(move.Text); } _historyForm.Show(); }
private void history_Closed(object sender, FormClosedEventArgs e) { _historyForm.FormClosed -= history_Closed; _historyForm.Dispose(); _historyForm = null; }