Пример #1
0
        /// <summary>
        ///     技術画像を更新する
        /// </summary>
        /// <param name="item">技術アプリケーション</param>
        private void UpdateTechPicture(TechItem item)
        {
            // 画像ファイル名テキストボックスの値を更新する
            if (Game.Type == GameType.DarkestHour)
            {
                techPictureNameTextBox.Text = item.PictureName ?? "";
            }

            // 編集項目の色を更新する
            techPictureNameTextBox.ForeColor = item.IsDirty(TechItemId.PictureName)
                ? Color.Red
                : SystemColors.WindowText;

            Image prev = techPictureBox.Image;
            string name = !string.IsNullOrEmpty(item.PictureName) &&
                          (item.PictureName.IndexOfAny(Path.GetInvalidPathChars()) < 0)
                ? item.PictureName
                : IntHelper.ToString(item.Id);
            string fileName = Game.GetReadFileName(Game.TechPicturePathName, $"{name}.bmp");
            if (File.Exists(fileName))
            {
                // 技術画像を更新する
                Bitmap bitmap = new Bitmap(fileName);
                bitmap.MakeTransparent();
                techPictureBox.Image = bitmap;
            }
            else
            {
                techPictureBox.Image = null;
            }
            prev?.Dispose();
        }
Пример #2
0
        /// <summary>
        ///     技術タブの項目を更新する
        /// </summary>
        /// <param name="item">技術アプリケーション</param>
        private void UpdateTechItems(TechItem item)
        {
            // 編集項目の値を更新する
            techNameTextBox.Text = item.ToString();
            techShortNameTextBox.Text = item.GetShortName();
            techIdNumericUpDown.Value = item.Id;
            techYearNumericUpDown.Value = item.Year;
            UpdateTechPositionList(item);
            UpdateTechPicture(item);

            // 編集項目の色を更新する
            techNameTextBox.ForeColor = item.IsDirty(TechItemId.Name) ? Color.Red : SystemColors.WindowText;
            techShortNameTextBox.ForeColor = item.IsDirty(TechItemId.ShortName) ? Color.Red : SystemColors.WindowText;
            techIdNumericUpDown.ForeColor = item.IsDirty(TechItemId.Id) ? Color.Red : SystemColors.WindowText;
            techYearNumericUpDown.ForeColor = item.IsDirty(TechItemId.Year) ? Color.Red : SystemColors.WindowText;
            techPictureNameTextBox.ForeColor = item.IsDirty(TechItemId.PictureName)
                ? Color.Red
                : SystemColors.WindowText;
        }