Enhance StartupDialog with transparency, rounded corners, and CRT effects for improved retro UI experience

This commit is contained in:
2026-01-07 11:59:38 +11:00
parent 1dc54e9a72
commit bc077d8a8d

View File

@@ -43,6 +43,7 @@ public class StartupDialog : Form
FormBorderStyle = FormBorderStyle.None;
StartPosition = FormStartPosition.CenterScreen;
BackColor = BackgroundDark;
Opacity = 0.86;
var itemHeight = 44;
var headerHeight = 60;
@@ -53,6 +54,9 @@ public class StartupDialog : Form
var contentHeight = headerHeight + (_apps.Count * itemHeight) + footerHeight;
ClientSize = new Size(contentWidth, contentHeight);
// Set the window region to rounded rectangle for transparent corners
UpdateWindowRegion();
var yPos = headerHeight;
foreach (var app in _apps)
@@ -132,17 +136,75 @@ public class StartupDialog : Form
var g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;
// Apply subtle bulge transformation
var centerX = Width / 2f;
var centerY = Height / 2f;
var bulgeStrength = 0.08f;
// Create a slight perspective transform for CRT bulge
var scaleX = 1.0f - bulgeStrength;
var scaleY = 1.0f - bulgeStrength;
g.TranslateTransform(centerX, centerY);
g.ScaleTransform(scaleX + bulgeStrength, scaleY + bulgeStrength);
g.TranslateTransform(-centerX, -centerY);
using var backgroundBrush = new SolidBrush(Color.FromArgb(240, BackgroundDark));
g.FillRectangle(backgroundBrush, 0, 0, Width, Height);
var glowAlpha = (int)(180 + _glowPulse);
var pulsingCyan = Color.FromArgb(Math.Min(255, glowAlpha), 0, 255, 255);
// Inner content
DrawContent(g, pulsingCyan);
// Reset transform for effects
g.ResetTransform();
// CRT bezel effect - subtle outer shadow
using var bezelBrush = new LinearGradientBrush(
new Rectangle(0, 0, Width, Height),
Color.FromArgb(60, 0, 0, 0),
Color.Transparent,
LinearGradientMode.Vertical);
var screenRect = new Rectangle(3, 3, Width - 6, Height - 6);
using var screenPath = CreateRoundedRectangle(screenRect, 12);
var bezelRect = new Rectangle(0, 0, Width, Height);
using var outerPath = CreateRoundedRectangle(bezelRect, 16);
using var innerPath = CreateRoundedRectangle(new Rectangle(4, 4, Width - 8, Height - 8), 10);
var bezelRegion = new Region(outerPath);
bezelRegion.Exclude(innerPath);
g.FillRegion(bezelBrush, bezelRegion);
// Outer glow
using var outerGlow = new Pen(Color.FromArgb((int)(20 + _glowPulse / 2), AccentCyan), 3);
g.DrawPath(outerGlow, CreateRoundedRectangle(new Rectangle(1, 1, Width - 2, Height - 2), 14));
// Main border
using var borderPen = new Pen(pulsingCyan, 2);
g.DrawRectangle(borderPen, 1, 1, Width - 3, Height - 3);
g.DrawPath(borderPen, screenPath);
using var outerGlow = new Pen(Color.FromArgb((int)(20 + _glowPulse / 2), AccentCyan), 6);
g.DrawRectangle(outerGlow, -2, -2, Width + 3, Height + 3);
// Corner reflections for glass effect
DrawCRTReflections(g);
}
using var innerBorder = new Pen(BorderColor, 1);
g.DrawRectangle(innerBorder, 4, 4, Width - 9, Height - 9);
private void UpdateWindowRegion()
{
using var path = CreateRoundedRectangle(new Rectangle(0, 0, Width, Height), 16);
Region = new Region(path);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdateWindowRegion();
}
private void DrawContent(Graphics g, Color pulsingCyan)
{
using var headerBrush = new LinearGradientBrush(
new Rectangle(0, 0, Width, 60),
@@ -189,6 +251,41 @@ public class StartupDialog : Form
}
}
private GraphicsPath CreateRoundedRectangle(Rectangle rect, int radius)
{
var path = new GraphicsPath();
var diameter = radius * 2;
path.AddArc(rect.X, rect.Y, diameter, diameter, 180, 90);
path.AddArc(rect.Right - diameter, rect.Y, diameter, diameter, 270, 90);
path.AddArc(rect.Right - diameter, rect.Bottom - diameter, diameter, diameter, 0, 90);
path.AddArc(rect.X, rect.Bottom - diameter, diameter, diameter, 90, 90);
path.CloseFigure();
return path;
}
private void DrawCRTReflections(Graphics g)
{
// Top-left corner reflection
using var reflection1 = new LinearGradientBrush(
new Rectangle(8, 8, 60, 40),
Color.FromArgb(25, 255, 255, 255),
Color.Transparent,
45f);
using var reflectPath1 = CreateRoundedRectangle(new Rectangle(8, 8, 60, 40), 8);
g.FillPath(reflection1, reflectPath1);
// Subtle center highlight
using var reflection2 = new LinearGradientBrush(
new Rectangle(Width / 4, 15, Width / 2, 25),
Color.FromArgb(8, 255, 255, 255),
Color.Transparent,
LinearGradientMode.Vertical);
using var reflectPath2 = CreateRoundedRectangle(new Rectangle(Width / 4, 15, Width / 2, 25), 4);
g.FillPath(reflection2, reflectPath2);
}
private void LaunchSelectedApps()
{
foreach (var checkbox in _checkboxes)
@@ -295,7 +392,7 @@ public class RetroCheckBox : Control
var g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;
var bgColor = _hovering ? Color.FromArgb(40, 40, 56) : Color.FromArgb(28, 28, 40);
var bgColor = _hovering ? Color.FromArgb(200, 40, 40, 56) : Color.FromArgb(180, 28, 28, 40);
using var bgBrush = new SolidBrush(bgColor);
g.FillRectangle(bgBrush, 0, 0, Width, Height);
@@ -386,15 +483,15 @@ public class RetroButton : Control
Color bgColor;
if (_pressing)
{
bgColor = Color.FromArgb(60, accentColor);
bgColor = Color.FromArgb(200, Color.FromArgb(60, accentColor));
}
else if (_hovering)
{
bgColor = Color.FromArgb(30, accentColor);
bgColor = Color.FromArgb(180, Color.FromArgb(30, accentColor));
}
else
{
bgColor = Color.FromArgb(10, accentColor);
bgColor = Color.FromArgb(140, Color.FromArgb(10, accentColor));
}
using var bgBrush = new SolidBrush(bgColor);