private void ShowOtherCard(Card otherCard) { if (_otherCardView != null) { _otherCardView.Card = otherCard; return; } _otherCardView = new FormCard(); _otherCardView.FormClosed += OtherCardView_FormClosed; _otherCardView.Card = otherCard; _otherCardView.StartPosition = FormStartPosition.Manual; _otherCardView.Text = _otherCardView.Text + " (other card)"; _otherCardView.Move += OtherCardView_Move; if (_otherCardViewLocation.X != int.MinValue) { _otherCardView.Location = _otherCardViewLocation; } else { Point location = Location; location.Offset(0, Height); Screen screen = Screen.FromControl(this); if (location.Y > screen.WorkingArea.Height - 100) { location.Y = screen.WorkingArea.Height - 100; } _otherCardView.Location = location; } _otherCardView.Show(this); }
private void buttonCard_Click(object sender, EventArgs e) { if (_cardView == null) { _cardView = new FormCard(); _cardView.FormClosed += CardView_FormClosed; if (listBoxCardList.SelectedItem != null) { _cardView.Card = (Card)listBoxCardList.SelectedItem; } _cardView.Show(this); } else { _cardView.Close(); } }
private void CardView_FormClosed(object sender, FormClosedEventArgs e) { _cardView = null; }