using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; namespace PokerGameSetup; internal sealed class CasinoStepper : Control { private int currentStep; private static readonly string[] StepTitles = new string[] { "Добро пожаловать", "Папка установки", "Компоненты", "Установка", "Готово к игре" }; private static readonly string[] StepSubtitles = new string[] { "Знакомство с казино", "Выбор директории", "Настройка и нейросеть", "Распаковка ресурсов", "Казино открыто" }; public int CurrentStep { get => currentStep; set { int clamped = Math.Max(0, Math.Min(4, value)); if (currentStep != clamped) { currentStep = clamped; Invalidate(); } } } public CasinoStepper() { SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); Height = 168; Width = 365; } protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; g.PixelOffsetMode = PixelOffsetMode.HighQuality; int stepCount = 5; int stepSpacing = 33; int startY = 12; int nodeX = 14; int nodeRadius = 9; // Diameter 18 // Draw connecting vertical rail line int lineTop = startY + nodeRadius; int lineBottom = startY + (stepCount - 1) * stepSpacing + nodeRadius; using (Pen railPen = new Pen(Color.FromArgb(48, 54, 58), 2f)) { g.DrawLine(railPen, nodeX, lineTop, nodeX, lineBottom); } // Draw completed rail portion if (currentStep > 0) { int completedBottom = startY + Math.Min(currentStep, stepCount - 1) * stepSpacing + nodeRadius; using (Pen completedRailPen = new Pen(Color.FromArgb(180, 145, 75), 2f)) { g.DrawLine(completedRailPen, nodeX, lineTop, nodeX, completedBottom); } } for (int i = 0; i < stepCount; i++) { int cy = startY + i * stepSpacing + nodeRadius; Rectangle nodeRect = new Rectangle(nodeX - nodeRadius, cy - nodeRadius, nodeRadius * 2, nodeRadius * 2); if (i < currentStep) { // Completed step: small gold badge with checkmark ✓ using (SolidBrush fillBrush = new SolidBrush(Color.FromArgb(160, 130, 68))) { g.FillEllipse(fillBrush, nodeRect); } using (Pen checkPen = new Pen(Color.FromArgb(20, 18, 12), 1.8f)) { checkPen.StartCap = LineCap.Round; checkPen.EndCap = LineCap.Round; g.DrawLines(checkPen, new Point[] { new Point(nodeX - 4, cy), new Point(nodeX - 1, cy + 3), new Point(nodeX + 4, cy - 3) }); } } else if (i == currentStep) { // Active step: glowing gold ring with active halo and step number Rectangle haloRect = new Rectangle(nodeRect.X - 3, nodeRect.Y - 3, nodeRect.Width + 6, nodeRect.Height + 6); using (SolidBrush haloBrush = new SolidBrush(Color.FromArgb(45, 229, 190, 112))) { g.FillEllipse(haloBrush, haloRect); } using (LinearGradientBrush activeBrush = new LinearGradientBrush( nodeRect, Color.FromArgb(250, 225, 150), Color.FromArgb(200, 160, 80), 90f)) { g.FillEllipse(activeBrush, nodeRect); } using (Pen activeBorder = new Pen(Color.FromArgb(255, 245, 200), 1.2f)) { g.DrawEllipse(activeBorder, nodeRect); } // Step number inside active node string numStr = (i + 1).ToString(); using (Font numFont = new Font("Segoe UI", 7.8f, FontStyle.Bold)) { TextRenderer.DrawText(g, numStr, numFont, nodeRect, Color.FromArgb(22, 18, 10), TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter); } // Left accent vertical pill on active step using (LinearGradientBrush barBrush = new LinearGradientBrush( new Rectangle(0, cy - 10, 3, 20), Color.FromArgb(255, 230, 150), Color.FromArgb(200, 150, 60), 90f)) { g.FillRectangle(barBrush, 0, cy - 10, 3, 20); } } else { // Future step: dark node with muted number using (SolidBrush futureBrush = new SolidBrush(Color.FromArgb(25, 28, 30))) { g.FillEllipse(futureBrush, nodeRect); } using (Pen futureBorder = new Pen(Color.FromArgb(60, 68, 72), 1.2f)) { g.DrawEllipse(futureBorder, nodeRect); } string numStr = (i + 1).ToString(); using (Font numFont = new Font("Segoe UI", 7.5f)) { TextRenderer.DrawText(g, numStr, numFont, nodeRect, Color.FromArgb(100, 110, 115), TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter); } } // Draw Step title & subtitle int textX = nodeX + nodeRadius + 12; Rectangle titleRect = new Rectangle(textX, cy - 11, Width - textX - 8, 22); if (i == currentStep) { using (Font titleFont = new Font("Segoe UI", 10.5f, FontStyle.Bold)) { TextRenderer.DrawText(g, StepTitles[i], titleFont, titleRect, InstallerForm.Gold, TextFormatFlags.Left | TextFormatFlags.VerticalCenter); } } else if (i < currentStep) { using (Font titleFont = new Font("Segoe UI", 10f)) { TextRenderer.DrawText(g, StepTitles[i], titleFont, titleRect, Color.FromArgb(170, 185, 180), TextFormatFlags.Left | TextFormatFlags.VerticalCenter); } } else { using (Font titleFont = new Font("Segoe UI", 10f)) { TextRenderer.DrawText(g, StepTitles[i], titleFont, titleRect, Color.FromArgb(105, 115, 118), TextFormatFlags.Left | TextFormatFlags.VerticalCenter); } } } } }