Skip to content

Commit 7de337e

Browse files
committed
Initial commit of Zenith Fan Utility v1.0.0
1 parent 32cae4f commit 7de337e

File tree

5 files changed

+130
-323
lines changed

5 files changed

+130
-323
lines changed

ZenithFanUtility/DarkTheme.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
using System.Drawing;
33
using System.Drawing.Drawing2D;
44
using System.Windows.Forms;
5-
6-
// --- Part 1: Define the color palette for our dark theme ---
75
public class DarkColorTable : ProfessionalColorTable
86
{
97
private Color backColor = Color.FromArgb(38, 38, 38);
@@ -26,38 +24,31 @@ public class DarkColorTable : ProfessionalColorTable
2624
public override Color MenuItemSelectedGradientEnd => selectedColor;
2725
}
2826

29-
// --- Part 2: Create the renderer that uses the dark palette and fixes checkboxes ---
3027
public class DarkMenuRenderer : ToolStripProfessionalRenderer
3128
{
3229
public DarkMenuRenderer() : base(new DarkColorTable()) { }
3330

34-
// Fix text color
3531
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
3632
{
3733
e.TextColor = Color.White;
3834
base.OnRenderItemText(e);
3935
}
4036

41-
// --- THIS IS THE NEW, FINAL VERSION ---
42-
// It draws a bigger, sharper, and correctly scaled checkmark.
4337
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
4438
{
45-
// We only want to draw if the item is actually checked.
4639
if (e.Item is ToolStripMenuItem tsmi && tsmi.Checked)
4740
{
4841
var g = e.Graphics;
4942
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
5043

51-
// Get the area available for the checkmark and add some padding
5244
var rect = e.ImageRectangle;
5345
rect.Inflate(-4, -4); // 4px padding looks clean
5446

55-
// Define the 3 points for a sharp "V" shape, relative to the padded area
5647
var p1 = new Point(rect.Left, rect.Top + rect.Height / 2);
5748
var p2 = new Point(rect.Left + rect.Width / 3, rect.Bottom);
5849
var p3 = new Point(rect.Right, rect.Top);
5950

60-
// Draw the checkmark with a 2px thick, rounded pen
51+
// draw the checkmark with a 2px thick, rounded pen
6152
using (var pen = new Pen(Color.WhiteSmoke, 2f))
6253
{
6354
pen.StartCap = LineCap.Round;

ZenithFanUtility/DoubleBufferedPictureBox.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
using System.Windows.Forms;
22

3-
namespace ZenithFanUtility // Make sure this namespace matches your project
3+
namespace ZenithFanUtility
44
{
55
public class DoubleBufferedPictureBox : PictureBox
66
{
77
public DoubleBufferedPictureBox()
88
{
9-
// Set the double buffer styles to prevent flicker and lag
109
this.DoubleBuffered = true;
1110
this.SetStyle(ControlStyles.UserPaint |
1211
ControlStyles.AllPaintingInWmPaint |

0 commit comments

Comments
 (0)