加几个控件

This commit is contained in:
2026-03-26 20:13:29 +08:00
parent 2c2f93c982
commit 2c2ee0f1de
8 changed files with 427 additions and 4 deletions

51
Gui/UILib/Separator.cs Normal file
View File

@@ -0,0 +1,51 @@
using System.Drawing;
namespace CMLeonOS.Gui.UILib
{
internal class Separator : Control
{
internal enum SeparatorOrientation
{
Horizontal,
Vertical
}
public Separator(Window parent, int x, int y, int width, int height) : base(parent, x, y, width, height)
{
}
private Color _background = UITheme.Surface;
internal Color Background
{
get { return _background; }
set { _background = value; Render(); }
}
private Color _foreground = UITheme.SurfaceBorder;
internal Color Foreground
{
get { return _foreground; }
set { _foreground = value; Render(); }
}
internal SeparatorOrientation Orientation { get; set; } = SeparatorOrientation.Horizontal;
internal override void Render()
{
Clear(Background);
if (Orientation == SeparatorOrientation.Horizontal)
{
int y = Height / 2;
DrawHorizontalLine(Width, 0, y, Foreground);
}
else
{
int x = Width / 2;
DrawVerticalLine(Height, x, 0, Foreground);
}
WM.Update(this);
}
}
}