Support light theme in thumbnail view

This commit is contained in:
Jaex 2019-05-23 16:55:49 +03:00
parent fa75500b8d
commit 60ee08f04e
4 changed files with 52 additions and 8 deletions

View file

@ -195,7 +195,11 @@ private void DrawText(Graphics g)
tff |= TextFormatFlags.EndEllipsis;
}
TextRenderer.DrawText(g, Text, Font, ClientRectangle.LocationOffset(0, 1), TextShadowColor, tff);
if (TextShadowColor.A > 0)
{
TextRenderer.DrawText(g, Text, Font, ClientRectangle.LocationOffset(0, 1), TextShadowColor, tff);
}
TextRenderer.DrawText(g, Text, Font, ClientRectangle, ForeColor, tff);
}
}

View file

@ -137,13 +137,29 @@ public bool ProgressVisible
public TaskPanel(WorkerTask task)
{
InitializeComponent();
lblFilename.ForeColor = ShareXResources.DarkTextColor;
Task = task;
InitializeComponent();
UpdateTheme();
UpdateFilename();
}
public void UpdateTheme()
{
if (ShareXResources.UseDarkTheme)
{
lblFilename.ForeColor = ShareXResources.DarkTextColor;
lblFilename.TextShadowColor = Color.Black;
pThumbnail.PanelColor = ShareXResources.DarkBorderColor;
}
else
{
lblFilename.ForeColor = SystemColors.WindowText;
lblFilename.TextShadowColor = Color.Transparent;
pThumbnail.PanelColor = SystemColors.ControlLight;
}
}
public void ChangeThumbnailSize(Size size)
{
ThumbnailSize = size;

View file

@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
@ -41,9 +42,10 @@ public partial class TaskView : UserControl
public TaskView()
{
InitializeComponent();
TaskPanels = new List<TaskPanel>();
InitializeComponent();
UpdateTheme();
}
protected override Point ScrollToControl(Control activeControl)
@ -51,6 +53,23 @@ protected override Point ScrollToControl(Control activeControl)
return AutoScrollPosition;
}
public void UpdateTheme()
{
if (ShareXResources.UseDarkTheme)
{
BackColor = ShareXResources.DarkBackgroundColor;
}
else
{
BackColor = SystemColors.Window;
}
foreach (TaskPanel panel in TaskPanels)
{
panel.UpdateTheme();
}
}
public TaskPanel FindPanel(WorkerTask task)
{
return TaskPanels.FirstOrDefault(x => x.Task == task);

View file

@ -779,7 +779,8 @@ private void UpdateTheme()
lblListViewTip.ForeColor = ShareXResources.DarkTextColor;
scMain.SplitterColor = ShareXResources.DarkBackgroundColor;
scMain.SplitterLineColor = ShareXResources.DarkBorderColor;
pbPreview.UpdateCheckers(true);
pThumbnailView.BackColor = ShareXResources.DarkBackgroundColor;
lblThumbnailViewTip.ForeColor = ShareXResources.DarkTextColor;
flpCommunity.BackColor = ShareXResources.DarkBackgroundColor;
}
else
@ -793,9 +794,13 @@ private void UpdateTheme()
lblListViewTip.ForeColor = Color.Silver;
scMain.SplitterColor = Color.White;
scMain.SplitterLineColor = ProfessionalColors.SeparatorDark;
pbPreview.UpdateCheckers(true);
pThumbnailView.BackColor = SystemColors.Window;
lblThumbnailViewTip.ForeColor = Color.Silver;
flpCommunity.BackColor = SystemColors.Window;
}
pbPreview.UpdateCheckers(true);
ucTaskView.UpdateTheme();
}
private void CleanCustomClipboardFormats()