/// <summary> /// コピー/移動先コンボボックスの選択項目変更時の処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnDestComboBoxSelectedIndexChanged(object sender, EventArgs e) { if (destComboBox.SelectedIndex < 0) { return; } if (!copyRadioButton.Checked && !moveRadioButton.Checked) { copyRadioButton.Checked = true; } // 開始ID数値アップダウンの数値が変更されていなければ変更する if (!_idChanged) { idNumericUpDown.ValueChanged -= OnIdNumericUpDownValueChanged; idNumericUpDown.Value = Ministers.GetNewId(Countries.Tags[destComboBox.SelectedIndex]); idNumericUpDown.ValueChanged += OnIdNumericUpDownValueChanged; } }
/// <summary> /// フォーム読み込み時の処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnFormLoad(object sender, EventArgs e) { Graphics g = Graphics.FromHwnd(Handle); int margin = DeviceCaps.GetScaledWidth(2) + 1; // 対象国コンボボックス srcComboBox.BeginUpdate(); srcComboBox.Items.Clear(); int width = srcComboBox.Width; foreach (string s in Countries.Tags .Select(country => Countries.Strings[(int)country]) .Select(name => Config.ExistsKey(name) ? $"{name} {Config.GetText(name)}" : name)) { srcComboBox.Items.Add(s); width = Math.Max(width, (int)g.MeasureString(s, srcComboBox.Font).Width + SystemInformation.VerticalScrollBarWidth + margin); } srcComboBox.DropDownWidth = width; srcComboBox.EndUpdate(); if (srcComboBox.Items.Count > 0) { srcComboBox.SelectedIndex = Countries.Tags.ToList().IndexOf(_args.TargetCountries[0]); } srcComboBox.SelectedIndexChanged += OnSrcComboBoxSelectedIndexChanged; // 閣僚地位 hosCheckBox.Text = Config.GetText(TextId.MinisterHeadOfState); hogCheckBox.Text = Config.GetText(TextId.MinisterHeadOfGovernment); mofCheckBox.Text = Config.GetText(TextId.MinisterForeignMinister); moaCheckBox.Text = Config.GetText(TextId.MinisterArmamentMinister); mosCheckBox.Text = Config.GetText(TextId.MinisterMinisterOfSecurity); moiCheckBox.Text = Config.GetText(TextId.MinisterMinisterOfIntelligence); cosCheckBox.Text = Config.GetText(TextId.MinisterChiefOfStaff); coaCheckBox.Text = Config.GetText(TextId.MinisterChiefOfArmy); conCheckBox.Text = Config.GetText(TextId.MinisterChiefOfNavy); coafCheckBox.Text = Config.GetText(TextId.MinisterChiefOfAir); // コピー/移動先コンボボックス destComboBox.BeginUpdate(); destComboBox.Items.Clear(); width = destComboBox.Width; foreach (string s in Countries.Tags .Select(country => Countries.Strings[(int)country]) .Select(name => Config.ExistsKey(name) ? $"{name} {Config.GetText(name)}" : name)) { destComboBox.Items.Add(s); width = Math.Max(width, (int)g.MeasureString(s, destComboBox.Font).Width + SystemInformation.VerticalScrollBarWidth + margin); } destComboBox.DropDownWidth = width; destComboBox.EndUpdate(); if (destComboBox.Items.Count > 0) { destComboBox.SelectedIndex = Countries.Tags.ToList().IndexOf(_args.TargetCountries[0]); } destComboBox.SelectedIndexChanged += OnDestComboBoxSelectedIndexChanged; // 開始ID if (_args.TargetCountries.Count > 0) { idNumericUpDown.Value = Ministers.GetNewId(_args.TargetCountries[0]); } idNumericUpDown.ValueChanged += OnIdNumericUpDownValueChanged; // 終了年 if (Game.Type != GameType.DarkestHour) { endYearCheckBox.Enabled = false; endYearNumericUpDown.Enabled = false; endYearNumericUpDown.ResetText(); } // 引退年 if ((Game.Type != GameType.DarkestHour) || (Game.Version < 103)) { retirementYearCheckBox.Enabled = false; retirementYearNumericUpDown.Enabled = false; retirementYearNumericUpDown.ResetText(); } // イデオロギーコンボボックス ideologyComboBox.BeginUpdate(); ideologyComboBox.Items.Clear(); width = ideologyComboBox.Width; foreach (string s in Ministers.IdeologyNames.Where(id => id != TextId.Empty).Select(Config.GetText)) { ideologyComboBox.Items.Add(s); width = Math.Max(width, (int)g.MeasureString(s, ideologyComboBox.Font).Width + margin); } ideologyComboBox.DropDownWidth = width; ideologyComboBox.EndUpdate(); if (ideologyComboBox.Items.Count > 0) { ideologyComboBox.SelectedIndex = 0; } ideologyComboBox.SelectedIndexChanged += OnIdeologyComboBoxSelectedIndexChanged; // 忠誠度コンボボックス loyaltyComboBox.BeginUpdate(); loyaltyComboBox.Items.Clear(); width = loyaltyComboBox.Width; foreach (string s in Ministers.LoyaltyNames.Where(name => !string.IsNullOrEmpty(name))) { loyaltyComboBox.Items.Add(s); width = Math.Max(width, (int)g.MeasureString(s, loyaltyComboBox.Font).Width + margin); } loyaltyComboBox.DropDownWidth = width; loyaltyComboBox.EndUpdate(); if (loyaltyComboBox.Items.Count > 0) { loyaltyComboBox.SelectedIndex = 0; } loyaltyComboBox.SelectedIndexChanged += OnLoyaltyComboBoxSelectedIndexChanged; }