Skip to content

Commit 3f2d657

Browse files
committed
[Dark Mode] Marker in ItemView are now easier to see
Markers like the resize column marker & the drag markers while reordering pages/books are now white when using Dark Mode. - Added ResizeMarker/DragMarker to ThemePens - Added ItemView.Marker to ThemeColors (same entry for both Pens) - Added ItemViewMarker to ThemeColorTable/DarkThemeColorTable
1 parent a3059ca commit 3f2d657

File tree

5 files changed

+39
-24
lines changed

5 files changed

+39
-24
lines changed

cYo.Common.Windows/Forms/ItemView.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,7 +3262,7 @@ protected virtual void DrawMarker(Graphics gr, Rectangle bounds)
32623262
using (Brush brush = new SolidBrush(color))
32633263
{
32643264
gr.FillRectangle(brush, bounds);
3265-
gr.DrawRectangle(Pens.Black, bounds);
3265+
gr.DrawRectangle(ThemePens.ItemView.DragMarker, bounds);
32663266
}
32673267
}
32683268

@@ -3485,11 +3485,7 @@ protected override void OnPaint(PaintEventArgs e)
34853485
{
34863486
Rectangle viewRectangle = ViewRectangle;
34873487
viewRectangle.X = GetColumnHeaderRectangle(resizeColumn).Right - base.ScrollPositionX;
3488-
using (Pen pen = new Pen(Color.Black))
3489-
{
3490-
pen.DashStyle = DashStyle.DashDot;
3491-
graphics.DrawLine(pen, viewRectangle.Location, new Point(viewRectangle.X, viewRectangle.Bottom));
3492-
}
3488+
graphics.DrawLine(ThemePens.ItemView.ResizeMarker, viewRectangle.Location, new Point(viewRectangle.X, viewRectangle.Bottom));
34933489
}
34943490
if (dragHeader != null)
34953491
{

cYo.Common.Windows/Forms/Theme/DarkMode/DarkThemeColorTable.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ internal class DarkThemeColorTable : ThemeColorTable
7171
public override Color ItemViewDefaultBack => SystemColors.Window;
7272
public override Color ItemViewGroupText => Color.LightSkyBlue;
7373
public override Color ItemViewGroupSeparator => SystemColors.InactiveCaptionText; // Color.FromArgb(190, 190, 190);
74+
public override Color ItemViewMarker => Color.White;
7475

75-
// CoverViewItem
76-
public override Color DetailRowHighlight => Color.FromArgb(72, 72, 72); // This drawn on top of ItemViewMainBack blending at alpha 96 giving "#2F2F2F"
76+
// CoverViewItem
77+
public override Color DetailRowHighlight => Color.FromArgb(72, 72, 72); // This drawn on top of ItemViewMainBack blending at alpha 96 giving "#2F2F2F"
7778

7879
// NiceTreeSkin
7980
public override Color NiceTreeSkinDragSeparator => SystemColors.InactiveCaptionText; // Color.FromArgb(190, 190, 190);

cYo.Common.Windows/Forms/Theme/Internal/ThemeColorTable.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ internal class ThemeColorTable
7474
public virtual Color ItemViewDefaultBack => System.Drawing.SystemColors.Window;
7575
public virtual Color ItemViewGroupText => Color.DarkBlue;
7676
public virtual Color ItemViewGroupSeparator => System.Drawing.SystemColors.ControlDark;
77+
public virtual Color ItemViewMarker => Color.Black;
7778

78-
// CoverViewItem
79-
public virtual Color DetailRowHighlight => Color.LightGray;
79+
// CoverViewItem
80+
public virtual Color DetailRowHighlight => Color.LightGray;
8081

8182
// ItemDrawInformation
8283
public virtual Color ItemDrawInfoText => Color.Black;
@@ -135,18 +136,18 @@ internal class ThemeColorTable
135136
public virtual Color StackBorder => Color.Black;
136137

137138

138-
// ControlStyleColorTable
139-
//public virtual Color ControlStyleColorTableBorder => Color.Black;
139+
// ControlStyleColorTable
140+
//public virtual Color ControlStyleColorTableBorder => Color.Black;
140141

141-
// MainForm
142-
//public virtual Color MainFormToolStripBack => Color.Transparent;
142+
// MainForm
143+
//public virtual Color MainFormToolStripBack => Color.Transparent;
143144

144-
// MainView
145-
//public virtual Color MainViewBack => Color.Transparent;
146-
//public virtual Color MainViewToolStripBack => Color.Transparent;
145+
// MainView
146+
//public virtual Color MainViewBack => Color.Transparent;
147+
//public virtual Color MainViewToolStripBack => Color.Transparent;
147148

148-
//public virtual Color MatcherGroupEditor => System.Drawing.SystemColors.Control;
149+
//public virtual Color MatcherGroupEditor => System.Drawing.SystemColors.Control;
149150

150-
// SimpleScrollbarPanel
151-
//public virtual Color ScrollbarPanelBorder => Color.LightGray;
151+
// SimpleScrollbarPanel
152+
//public virtual Color ScrollbarPanelBorder => Color.LightGray;
152153
}

cYo.Common.Windows/Forms/Theme/Resources/ThemeColors.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public static class ItemView
107107
public static Color MainBack => ColorTable.ItemViewMainBack;
108108
public static Color GroupText => ColorTable.ItemViewGroupText;
109109
public static Color GroupSeparator => ColorTable.ItemViewGroupSeparator;
110+
public static Color Marker => ColorTable.ItemViewMarker;
110111
}
111112

112113
public static class NiceTreeSkin

cYo.Common.Windows/Forms/Theme/Resources/ThemePens.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Drawing;
3+
using System.Drawing.Drawing2D;
34

45
namespace cYo.Common.Windows.Forms.Theme.Resources;
56

@@ -36,10 +37,25 @@ public static class ThumbnailViewItem
3637
public static Pen Border => FromThemeColor(ThemeColors.ThumbnailViewItem.Border);
3738
}
3839

39-
/// <summary>
40-
/// Returns a <see cref="Pen"/> with the specified <paramref name="color"/>.
41-
/// </summary>
42-
public static Pen FromThemeColor(Color color)
40+
public static class ItemView
41+
{
42+
public static Pen ResizeMarker
43+
{
44+
get
45+
{
46+
Pen pen = FromThemeColor(ThemeColors.ItemView.Marker);
47+
pen.DashStyle = DashStyle.DashDot;
48+
return pen;
49+
}
50+
}
51+
52+
public static Pen DragMarker => FromThemeColor(ThemeColors.ItemView.Marker);
53+
}
54+
55+
/// <summary>
56+
/// Returns a <see cref="Pen"/> with the specified <paramref name="color"/>.
57+
/// </summary>
58+
public static Pen FromThemeColor(Color color)
4359
{
4460
if (!cache.TryGetValue(color, out var pen))
4561
{

0 commit comments

Comments
 (0)