Files
PulsarK-main/Pulsar.Server/Controls/Line.cs
T
i2p 773d05f8f1
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run
initial commit
2026-08-27 10:57:58 -06:00

52 lines
1.3 KiB
C#

using Pulsar.Server.Models;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Pulsar.Server.Controls
{
public class Line : Control
{
public enum Alignment
{
Horizontal,
Vertical
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Alignment LineAlignment { get; set; }
public Line()
{
this.TabStop = false;
this.BackColor = GetBackgroundColor();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.LightGray)), new Point(5, 5),
LineAlignment == Alignment.Horizontal ? new Point(500, 5) : new Point(5, 500));
}
protected override void OnPaintBackground(PaintEventArgs e)
{
using (var brush = new SolidBrush(GetBackgroundColor()))
{
e.Graphics.FillRectangle(brush, ClientRectangle);
}
}
private Color GetBackgroundColor()
{
if (Settings.DarkMode)
{
return Color.FromArgb(43, 43, 43);
}
else
{
return this.BackColor;
}
}
}
}