diff --git a/IconGenerator.cs b/IconGenerator.cs index b09f2a6..0c4ea6f 100644 --- a/IconGenerator.cs +++ b/IconGenerator.cs @@ -93,23 +93,57 @@ namespace TimerApp int clockSize = size - margin * 2; Rectangle rect = new Rectangle(margin, margin, clockSize, clockSize); + // 定义轮廓颜色和宽度 + Color outlineColor = Color.FromArgb(64, 64, 64); + float mainWidth = Math.Max(2, size / 16f); + float outlineWidth = mainWidth + Math.Max(1, size / 32f); + float handWidth = Math.Max(2, size / 22f); + float handOutlineWidth = handWidth + Math.Max(1, size / 32f); + + // 1. 绘制耳朵 (先画轮廓) + using (Pen outlinePen = new Pen(outlineColor, Math.Max(1, size / 32f))) using (Brush earBrush = new SolidBrush(Color.White)) { + // 左耳 + g.DrawPie(outlinePen, 0, 0, size / 2, size / 2, 200, 50); g.FillPie(earBrush, 0, 0, size / 2, size / 2, 200, 50); + + // 右耳 + g.DrawPie(outlinePen, size / 2, 0, size / 2, size / 2, 290, 50); g.FillPie(earBrush, size / 2, 0, size / 2, size / 2, 290, 50); } - using (Pen pen = new Pen(Color.White, Math.Max(2, size / 16))) + // 2. 绘制表盘外圈 (先画轮廓) + using (Pen outlinePen = new Pen(outlineColor, outlineWidth)) + using (Pen pen = new Pen(Color.White, mainWidth)) + using (Brush bgBrush = new SolidBrush(Color.Black)) { + // 填充表盘背景,确保浅色模式下也能看清 + g.FillEllipse(bgBrush, rect); + g.DrawEllipse(outlinePen, rect); g.DrawEllipse(pen, rect); } + // 3. 绘制指针 (先画轮廓) Point center = new Point(size / 2, size / 2); - using (Pen handPen = new Pen(Color.LightGreen, Math.Max(2, size / 22))) + Point handEnd1 = new Point(center.X + Math.Max(2, size * 10 / 64), center.Y - Math.Max(2, size * 10 / 64)); + Point handEnd2 = new Point(center.X, center.Y - Math.Max(3, size * 18 / 64)); + + using (Pen outlinePen = new Pen(outlineColor, handOutlineWidth)) + using (Pen handPen = new Pen(Color.LightGreen, handWidth)) { + outlinePen.EndCap = LineCap.Round; + outlinePen.StartCap = LineCap.Round; handPen.EndCap = LineCap.Round; - g.DrawLine(handPen, center, new Point(center.X + Math.Max(2, size * 10 / 64), center.Y - Math.Max(2, size * 10 / 64))); - g.DrawLine(handPen, center, new Point(center.X, center.Y - Math.Max(3, size * 18 / 64))); + handPen.StartCap = LineCap.Round; + + // 指针1 + g.DrawLine(outlinePen, center, handEnd1); + g.DrawLine(handPen, center, handEnd1); + + // 指针2 + g.DrawLine(outlinePen, center, handEnd2); + g.DrawLine(handPen, center, handEnd2); } } } diff --git a/Properties/app.ico b/Properties/app.ico new file mode 100644 index 0000000..a5e8b8b Binary files /dev/null and b/Properties/app.ico differ diff --git a/TimerApp.csproj b/TimerApp.csproj index a3de757..8f4348c 100644 --- a/TimerApp.csproj +++ b/TimerApp.csproj @@ -6,6 +6,7 @@ enable true enable + Properties\app.ico