initial commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user