/// <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 = Leaders.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 (_args.TargetCountries.Count > 0) { srcComboBox.SelectedIndex = Countries.Tags.ToList().IndexOf(_args.TargetCountries[0]); } srcComboBox.SelectedIndexChanged += OnSrcComboBoxSelectedIndexChanged; // 兵科 armyCheckBox.Text = Config.GetText(TextId.BranchArmy); navyCheckBox.Text = Config.GetText(TextId.BranchNavy); airforceCheckBox.Text = Config.GetText(TextId.BranchAirForce); // コピー/移動先コンボボックス 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, srcComboBox.Font).Width + SystemInformation.VerticalScrollBarWidth + margin); } destComboBox.DropDownWidth = width; destComboBox.EndUpdate(); if (_args.TargetCountries.Count > 0) { destComboBox.SelectedIndex = Countries.Tags.ToList().IndexOf(_args.TargetCountries[0]); } destComboBox.SelectedIndexChanged += OnDestComboBoxSelectedIndexChanged; // 開始ID if (_args.TargetCountries.Count > 0) { idNumericUpDown.Value = Leaders.GetNewId(_args.TargetCountries[0]); } idNumericUpDown.ValueChanged += OnIdNumericUpDownValueChanged; // 理想階級コンボボックス idealRankComboBox.BeginUpdate(); idealRankComboBox.Items.Clear(); width = idealRankComboBox.Width; foreach (string s in Leaders.RankNames.Where(name => !string.IsNullOrEmpty(name))) { idealRankComboBox.Items.Add(s); width = Math.Max(width, (int)g.MeasureString(s, idealRankComboBox.Font).Width + margin); } idealRankComboBox.DropDownWidth = width; idealRankComboBox.EndUpdate(); if (idealRankComboBox.Items.Count > 0) { idealRankComboBox.SelectedIndex = 0; } idealRankComboBox.SelectedIndexChanged += OnIdealRankComboBoxSelectedIndexChanged; // 引退年 if ((Game.Type != GameType.DarkestHour) || (Game.Version < 103)) { retirementYearCheckBox.Enabled = false; retirementYearNumericUpDown.Enabled = false; retirementYearNumericUpDown.ResetText(); } }