mirror of
https://github.com/waynebian01/Shigure.git
synced 2026-09-03 07:15:24 +08:00
- Updated ModuleEditorControl to utilize UiCardPanel for sidebar and footer layouts, enhancing visual coherence. - Introduced UiPillTab for tab navigation, providing a more modern and responsive design. - Adjusted padding, margins, and background colors across various controls for a cleaner appearance. - Implemented new methods for handling button styles and actions, including a new OpenModuleFolder method for better user experience. - Refined StatusForm layout, integrating UiCardPanel for information display and adjusting component arrangements for clarity. - Removed redundant graphics path creation methods, centralizing functionality in UiTheme. - Enhanced overall code readability and maintainability through consistent styling and structure.
86 lines
2.2 KiB
C#
86 lines
2.2 KiB
C#
using System.ComponentModel;
|
|
using System.Drawing.Drawing2D;
|
|
|
|
namespace Shigure;
|
|
|
|
internal sealed class UiCardPanel : TableLayoutPanel
|
|
{
|
|
private Color _fillColor = UiTheme.SurfaceRaised;
|
|
private int _cornerRadius = 10;
|
|
|
|
public UiCardPanel()
|
|
{
|
|
SetStyle(
|
|
ControlStyles.AllPaintingInWmPaint
|
|
| ControlStyles.OptimizedDoubleBuffer
|
|
| ControlStyles.ResizeRedraw
|
|
| ControlStyles.SupportsTransparentBackColor,
|
|
true);
|
|
BackColor = Color.Transparent;
|
|
}
|
|
|
|
[Browsable(false)]
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
public Color FillColor
|
|
{
|
|
get => _fillColor;
|
|
set
|
|
{
|
|
if (_fillColor == value)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_fillColor = value;
|
|
Invalidate();
|
|
}
|
|
}
|
|
|
|
[Browsable(false)]
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
public int CornerRadius
|
|
{
|
|
get => _cornerRadius;
|
|
set
|
|
{
|
|
var next = Math.Max(0, value);
|
|
if (_cornerRadius == next)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_cornerRadius = next;
|
|
Invalidate();
|
|
}
|
|
}
|
|
|
|
protected override void OnPaintBackground(PaintEventArgs e)
|
|
{
|
|
base.OnPaintBackground(e);
|
|
if (ClientSize.Width <= 1 || ClientSize.Height <= 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
using var path = UiTheme.CreateRoundedRectanglePath(ClientRectangle, UiTheme.Scale(this, CornerRadius));
|
|
using var fill = new SolidBrush(FillColor);
|
|
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
|
e.Graphics.FillPath(fill, path);
|
|
}
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
{
|
|
base.OnPaint(e);
|
|
if (ClientSize.Width <= 1 || ClientSize.Height <= 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var bounds = Rectangle.Inflate(ClientRectangle, -1, -1);
|
|
using var path = UiTheme.CreateRoundedRectanglePath(bounds, UiTheme.Scale(this, CornerRadius));
|
|
using var outline = new Pen(UiTheme.Border);
|
|
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
|
e.Graphics.DrawPath(outline, path);
|
|
}
|
|
}
|