More dark theme - thx Leon :)

Work on #7205
This commit is contained in:
niksedk 2023-08-17 08:27:12 +02:00
parent 040db8b667
commit 4c06f30c24
3 changed files with 22 additions and 2 deletions

View File

@ -381,6 +381,9 @@ namespace Nikse.SubtitleEdit.Controls
{
_listBox.BackColor = DarkTheme.BackColor;
_listBox.ForeColor = DarkTheme.ForeColor;
_listBox.HandleCreated += NikseListBoxHandleCreated;
DarkTheme.SetWindowThemeDark(_listBox);
DarkTheme.SetWindowThemeDark(this);
}
}
@ -390,7 +393,12 @@ namespace Nikse.SubtitleEdit.Controls
{
_listBox.BackColor = DefaultBackColor;
_listBox.ForeColor = DefaultForeColor;
_listBox.HandleCreated -= NikseListBoxHandleCreated;
DarkTheme.SetWindowThemeNormal(_listBox);
DarkTheme.SetWindowThemeNormal(this);
}
}
private static void NikseListBoxHandleCreated(object sender, EventArgs e) => DarkTheme.SetWindowThemeDark((Control)sender);
}
}

View File

@ -827,12 +827,17 @@ namespace Nikse.SubtitleEdit.Controls
{
_uiTextBox.BackColor = DarkTheme.BackColor;
_uiTextBox.ForeColor = DarkTheme.ForeColor;
_uiTextBox.HandleCreated += SeTextBoxBoxHandleCreated;
DarkTheme.SetWindowThemeDark(_uiTextBox);
}
if (_simpleTextBox != null)
{
_simpleTextBox.BackColor = DarkTheme.BackColor;
_simpleTextBox.ForeColor = DarkTheme.ForeColor;
_simpleTextBox.HandleCreated += SeTextBoxBoxHandleCreated;
DarkTheme.SetWindowThemeDark(_simpleTextBox);
}
DarkTheme.SetWindowThemeDark(this);
}
public void UndoDarkTheme()
@ -841,14 +846,21 @@ namespace Nikse.SubtitleEdit.Controls
{
_uiTextBox.BackColor = SystemColors.Window;
_uiTextBox.ForeColor = DefaultForeColor;
_uiTextBox.HandleCreated -= SeTextBoxBoxHandleCreated;
DarkTheme.SetWindowThemeNormal(_uiTextBox);
}
if (_simpleTextBox != null)
{
_simpleTextBox.BackColor = SystemColors.Window;
_simpleTextBox.ForeColor = DefaultForeColor;
_simpleTextBox.HandleCreated -= SeTextBoxBoxHandleCreated;
DarkTheme.SetWindowThemeNormal(this);
}
DarkTheme.SetWindowThemeNormal(_simpleTextBox);
}
private static void SeTextBoxBoxHandleCreated(object sender, EventArgs e) => DarkTheme.SetWindowThemeDark((Control)sender);
public void ScrollToCaret()
{
if (_uiTextBox != null)

View File

@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Logic
private static bool IsWindows10OrGreater(int build = -1) =>
Configuration.IsRunningOnWindows && Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build;
private static void SetWindowThemeDark(Control control)
public static void SetWindowThemeDark(Control control)
{
if (Configuration.IsRunningOnWindows)
{
@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Logic
}
}
private static void SetWindowThemeNormal(Control control)
public static void SetWindowThemeNormal(Control control)
{
if (Configuration.IsRunningOnWindows)
{