[GUI] Fix compatibility with High Contrast modes

This commit is contained in:
VaDiM 2024-03-15 16:57:52 +03:00
parent d0d8a35f67
commit 770d7e7532
2 changed files with 28 additions and 25 deletions

View File

@ -115,7 +115,7 @@
this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.tabControl2 = new System.Windows.Forms.TabControl(); this.tabControl2 = new System.Windows.Forms.TabControl();
this.tabPage4 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage();
this.previewPanel = new System.Windows.Forms.Panel(); this.previewPanel = new System.Windows.Forms.PictureBox();
this.assetInfoLabel = new System.Windows.Forms.Label(); this.assetInfoLabel = new System.Windows.Forms.Label();
this.FMODpanel = new System.Windows.Forms.Panel(); this.FMODpanel = new System.Windows.Forms.Panel();
this.FMODcopyright = new System.Windows.Forms.Label(); this.FMODcopyright = new System.Windows.Forms.Label();
@ -170,6 +170,7 @@
this.progressbarPanel.SuspendLayout(); this.progressbarPanel.SuspendLayout();
this.tabControl2.SuspendLayout(); this.tabControl2.SuspendLayout();
this.tabPage4.SuspendLayout(); this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.previewPanel)).BeginInit();
this.previewPanel.SuspendLayout(); this.previewPanel.SuspendLayout();
this.FMODpanel.SuspendLayout(); this.FMODpanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).BeginInit();
@ -844,7 +845,7 @@
this.listSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.listSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.listSearch.BackColor = System.Drawing.Color.White; this.listSearch.BackColor = System.Drawing.SystemColors.Window;
this.listSearch.BorderStyle = System.Windows.Forms.BorderStyle.None; this.listSearch.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listSearch.DetectUrls = false; this.listSearch.DetectUrls = false;
this.listSearch.ForeColor = System.Drawing.SystemColors.GrayText; this.listSearch.ForeColor = System.Drawing.SystemColors.GrayText;
@ -974,8 +975,6 @@
// previewPanel // previewPanel
// //
this.previewPanel.BackColor = System.Drawing.SystemColors.ControlDark; this.previewPanel.BackColor = System.Drawing.SystemColors.ControlDark;
this.previewPanel.BackgroundImage = global::AssetStudioGUI.Properties.Resources.preview;
this.previewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.previewPanel.Controls.Add(this.assetInfoLabel); this.previewPanel.Controls.Add(this.assetInfoLabel);
this.previewPanel.Controls.Add(this.FMODpanel); this.previewPanel.Controls.Add(this.FMODpanel);
this.previewPanel.Controls.Add(this.fontPreviewBox); this.previewPanel.Controls.Add(this.fontPreviewBox);
@ -983,17 +982,20 @@
this.previewPanel.Controls.Add(this.textPreviewBox); this.previewPanel.Controls.Add(this.textPreviewBox);
this.previewPanel.Controls.Add(this.classTextBox); this.previewPanel.Controls.Add(this.classTextBox);
this.previewPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.previewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.previewPanel.Image = global::AssetStudioGUI.Properties.Resources.preview;
this.previewPanel.Location = new System.Drawing.Point(0, 0); this.previewPanel.Location = new System.Drawing.Point(0, 0);
this.previewPanel.Name = "previewPanel"; this.previewPanel.Name = "previewPanel";
this.previewPanel.Size = new System.Drawing.Size(768, 607); this.previewPanel.Size = new System.Drawing.Size(768, 607);
this.previewPanel.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.previewPanel.TabIndex = 1; this.previewPanel.TabIndex = 1;
this.previewPanel.TabStop = false;
this.previewPanel.Resize += new System.EventHandler(this.preview_Resize); this.previewPanel.Resize += new System.EventHandler(this.preview_Resize);
// //
// assetInfoLabel // assetInfoLabel
// //
this.assetInfoLabel.AutoSize = true; this.assetInfoLabel.AutoSize = true;
this.assetInfoLabel.BackColor = System.Drawing.Color.Transparent; this.assetInfoLabel.BackColor = System.Drawing.Color.Transparent;
this.assetInfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.assetInfoLabel.ForeColor = System.Drawing.Color.White;
this.assetInfoLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.assetInfoLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.assetInfoLabel.Location = new System.Drawing.Point(4, 8); this.assetInfoLabel.Location = new System.Drawing.Point(4, 8);
this.assetInfoLabel.Name = "assetInfoLabel"; this.assetInfoLabel.Name = "assetInfoLabel";
@ -1036,7 +1038,7 @@
// //
this.FMODinfoLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODinfoLabel.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.FMODinfoLabel.AutoSize = true; this.FMODinfoLabel.AutoSize = true;
this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.HighlightText;
this.FMODinfoLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODinfoLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.FMODinfoLabel.Location = new System.Drawing.Point(275, 255); this.FMODinfoLabel.Location = new System.Drawing.Point(275, 255);
this.FMODinfoLabel.Name = "FMODinfoLabel"; this.FMODinfoLabel.Name = "FMODinfoLabel";
@ -1047,7 +1049,7 @@
// //
this.FMODtimerLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODtimerLabel.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.FMODtimerLabel.AutoSize = true; this.FMODtimerLabel.AutoSize = true;
this.FMODtimerLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.FMODtimerLabel.ForeColor = System.Drawing.SystemColors.HighlightText;
this.FMODtimerLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODtimerLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.FMODtimerLabel.Location = new System.Drawing.Point(457, 253); this.FMODtimerLabel.Location = new System.Drawing.Point(457, 253);
this.FMODtimerLabel.Name = "FMODtimerLabel"; this.FMODtimerLabel.Name = "FMODtimerLabel";
@ -1059,7 +1061,7 @@
// //
this.FMODstatusLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODstatusLabel.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.FMODstatusLabel.AutoSize = true; this.FMODstatusLabel.AutoSize = true;
this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.HighlightText;
this.FMODstatusLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODstatusLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.FMODstatusLabel.Location = new System.Drawing.Point(214, 255); this.FMODstatusLabel.Location = new System.Drawing.Point(214, 255);
this.FMODstatusLabel.Name = "FMODstatusLabel"; this.FMODstatusLabel.Name = "FMODstatusLabel";
@ -1441,6 +1443,7 @@
this.progressbarPanel.ResumeLayout(false); this.progressbarPanel.ResumeLayout(false);
this.tabControl2.ResumeLayout(false); this.tabControl2.ResumeLayout(false);
this.tabPage4.ResumeLayout(false); this.tabPage4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.previewPanel)).EndInit();
this.previewPanel.ResumeLayout(false); this.previewPanel.ResumeLayout(false);
this.previewPanel.PerformLayout(); this.previewPanel.PerformLayout();
this.FMODpanel.ResumeLayout(false); this.FMODpanel.ResumeLayout(false);
@ -1475,7 +1478,7 @@
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportAllAssetsMenuItem; private System.Windows.Forms.ToolStripMenuItem exportAllAssetsMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSelectedAssetsMenuItem; private System.Windows.Forms.ToolStripMenuItem exportSelectedAssetsMenuItem;
private System.Windows.Forms.Panel previewPanel; private System.Windows.Forms.PictureBox previewPanel;
private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;

View File

@ -441,12 +441,12 @@ namespace AssetStudioGUI
{ {
if (enablePreview.Checked && imageTexture != null) if (enablePreview.Checked && imageTexture != null)
{ {
previewPanel.BackgroundImage = imageTexture.Bitmap; previewPanel.Image = imageTexture.Bitmap;
} }
else else
{ {
previewPanel.BackgroundImage = Properties.Resources.preview; previewPanel.Image = Properties.Resources.preview;
previewPanel.BackgroundImageLayout = ImageLayout.Center; previewPanel.SizeMode = PictureBoxSizeMode.CenterImage;
} }
} }
break; break;
@ -644,7 +644,7 @@ namespace AssetStudioGUI
enableFiltering = false; enableFiltering = false;
listSearch.Text = " Filter "; listSearch.Text = " Filter ";
listSearch.ForeColor = SystemColors.GrayText; listSearch.ForeColor = SystemColors.GrayText;
listSearch.BackColor = System.Drawing.Color.White; listSearch.BackColor = SystemColors.Window;
} }
} }
@ -743,8 +743,8 @@ namespace AssetStudioGUI
private void selectAsset(object sender, ListViewItemSelectionChangedEventArgs e) private void selectAsset(object sender, ListViewItemSelectionChangedEventArgs e)
{ {
previewPanel.BackgroundImage = Properties.Resources.preview; previewPanel.Image = Properties.Resources.preview;
previewPanel.BackgroundImageLayout = ImageLayout.Center; previewPanel.SizeMode = PictureBoxSizeMode.CenterImage;
classTextBox.Visible = false; classTextBox.Visible = false;
assetInfoLabel.Visible = false; assetInfoLabel.Visible = false;
assetInfoLabel.Text = null; assetInfoLabel.Text = null;
@ -1354,11 +1354,11 @@ namespace AssetStudioGUI
{ {
imageTexture?.Dispose(); imageTexture?.Dispose();
imageTexture = bitmap; imageTexture = bitmap;
previewPanel.BackgroundImage = imageTexture.Bitmap; previewPanel.Image = imageTexture.Bitmap;
if (imageTexture.Width > previewPanel.Width || imageTexture.Height > previewPanel.Height) if (imageTexture.Width > previewPanel.Width || imageTexture.Height > previewPanel.Height)
previewPanel.BackgroundImageLayout = ImageLayout.Zoom; previewPanel.SizeMode = PictureBoxSizeMode.Zoom;
else else
previewPanel.BackgroundImageLayout = ImageLayout.Center; previewPanel.SizeMode = PictureBoxSizeMode.CenterImage;
} }
private void PreviewText(string text) private void PreviewText(string text)
@ -1421,10 +1421,10 @@ namespace AssetStudioGUI
selectedAnimationAssetsList.Clear(); selectedAnimationAssetsList.Clear();
selectedIndicesPrevList.Clear(); selectedIndicesPrevList.Clear();
cubismMocList.Clear(); cubismMocList.Clear();
previewPanel.BackgroundImage = Properties.Resources.preview; previewPanel.Image = Properties.Resources.preview;
previewPanel.SizeMode = PictureBoxSizeMode.CenterImage;
imageTexture?.Dispose(); imageTexture?.Dispose();
imageTexture = null; imageTexture = null;
previewPanel.BackgroundImageLayout = ImageLayout.Center;
assetInfoLabel.Visible = false; assetInfoLabel.Visible = false;
assetInfoLabel.Text = null; assetInfoLabel.Text = null;
textPreviewBox.Visible = false; textPreviewBox.Visible = false;
@ -1436,7 +1436,7 @@ namespace AssetStudioGUI
enableFiltering = false; enableFiltering = false;
listSearch.Text = " Filter "; listSearch.Text = " Filter ";
listSearch.ForeColor = SystemColors.GrayText; listSearch.ForeColor = SystemColors.GrayText;
listSearch.BackColor = System.Drawing.Color.White; listSearch.BackColor = SystemColors.Window;
if (tabControl1.SelectedIndex == 1) if (tabControl1.SelectedIndex == 1)
assetListView.Select(); assetListView.Select();
@ -1854,16 +1854,16 @@ namespace AssetStudioGUI
{ {
visibleAssets = visibleAssets.FindAll(x => Regex.IsMatch(x.SubItems[1].Text, pattern, regexOptions)); visibleAssets = visibleAssets.FindAll(x => Regex.IsMatch(x.SubItems[1].Text, pattern, regexOptions));
} }
listSearch.BackColor = System.Drawing.Color.PaleGreen; listSearch.BackColor = SystemInformation.HighContrast ? listSearch.BackColor : System.Drawing.Color.PaleGreen;
} }
catch (ArgumentException e) catch (ArgumentException e)
{ {
listSearch.BackColor = System.Drawing.Color.FromArgb(255, 160, 160); listSearch.BackColor = SystemInformation.HighContrast ? listSearch.BackColor : System.Drawing.Color.FromArgb(255, 160, 160);
StatusStripUpdate($"Regex error: {e.Message}"); StatusStripUpdate($"Regex error: {e.Message}");
} }
catch (RegexMatchTimeoutException) catch (RegexMatchTimeoutException)
{ {
listSearch.BackColor = System.Drawing.Color.FromArgb(255, 160, 160); listSearch.BackColor = SystemInformation.HighContrast ? listSearch.BackColor : System.Drawing.Color.FromArgb(255, 160, 160);
StatusStripUpdate($"Timeout error"); StatusStripUpdate($"Timeout error");
} }
break; break;
@ -2020,7 +2020,7 @@ namespace AssetStudioGUI
private void listSearchFilterMode_SelectedIndexChanged(object sender, EventArgs e) private void listSearchFilterMode_SelectedIndexChanged(object sender, EventArgs e)
{ {
listSearch.BackColor = System.Drawing.Color.White; listSearch.BackColor = SystemColors.Window;
if (listSearch.Text != " Filter ") if (listSearch.Text != " Filter ")
{ {
FilterAssetList(); FilterAssetList();