/// <summary> /// Handles the Click event of the ButtonCancel control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void ButtonCancel_Click(object sender, EventArgs e) { this.SelectedHero = null; this.Hide(); }
/// <summary> /// Handles the SelectedIndexChanged event of the ComboBoxHeroName control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void ComboBoxHeroName_SelectedIndexChanged(object sender, EventArgs e) { // Highlight選取的圖片 foreach (Control control in this.FlowLayoutPanelHero.Controls) { if (control is PictureBox) { (control as PictureBox).BackColor = Color.Transparent; } if (this.ComboBoxHeroName.SelectedValue != null && control.Name == this.ComboBoxHeroName.SelectedValue.ToString()) { var itemPicture = control as PictureBox; itemPicture.BackColor = Color.Red; // 顯示詳細說明 this.SelectedHero = this.m_dataRepository.GetHeroByName(itemPicture.Name); } } }
/// <summary> /// Handles the Click event of the PictureBoxHero control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void PictureBoxHero_Click(object sender, EventArgs e) { this.m_heroPicker.ShowDialog(); this.SelectedHero = this.m_heroPicker.SelectedHero; this.DisplaySelectedHero(); this.ResetRecommandItem(); }