mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-12 14:51:57 +00:00
Remove "Themes" folder
This commit is contained in:
@@ -1,128 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Badge
|
||||
|
||||
public class CrEaTiiOn_Badge : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
private int _Value = 0;
|
||||
private int _Maximum = 99;
|
||||
private Color _BorderColor = Color.FromArgb(250, 36, 38);
|
||||
private Color _BGColorA = Color.FromArgb(15, 15, 15);
|
||||
private Color _BGColorB = Color.FromArgb(15, 15, 15);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public int Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Value == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > _Maximum)
|
||||
{
|
||||
value = _Maximum;
|
||||
}
|
||||
|
||||
_Value = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public int Maximum
|
||||
{
|
||||
get => _Maximum;
|
||||
set
|
||||
{
|
||||
if (value < _Value)
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
|
||||
_Maximum = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color BorderColor
|
||||
{
|
||||
get => _BorderColor;
|
||||
set { _BorderColor = value; Invalidate(); }
|
||||
}
|
||||
|
||||
public Color BGColorA
|
||||
{
|
||||
get => _BGColorA;
|
||||
set { _BGColorA = value; Invalidate(); }
|
||||
}
|
||||
|
||||
public Color BGColorB
|
||||
{
|
||||
get => _BGColorB;
|
||||
set { _BGColorB = value; Invalidate(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_Badge()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
|
||||
Text = null;
|
||||
DoubleBuffered = true;
|
||||
ForeColor = Color.White;
|
||||
Font = new("Segoe UI", 8, FontStyle.Bold);
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = 20;
|
||||
Width = 20;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Graphics _G = e.Graphics;
|
||||
string myString = _Value.ToString();
|
||||
_G.Clear(BackColor);
|
||||
_G.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
LinearGradientBrush LGB = new(new Rectangle(new Point(0, 0), new Size(18, 20)), _BGColorA, _BGColorB, 90f);
|
||||
|
||||
// Fills the body with LGB gradient
|
||||
_G.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(18, 18)));
|
||||
// Draw border
|
||||
_G.DrawEllipse(new(_BorderColor), new Rectangle(new Point(0, 0), new Size(18, 18)));
|
||||
_G.DrawString(myString, Font, new SolidBrush(ForeColor), new Rectangle(0, 0, Width - 2, Height), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Center,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
e.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Banner
|
||||
|
||||
public class CrEaTiiOn_Banner : Control
|
||||
{
|
||||
public CrEaTiiOn_Banner()
|
||||
{
|
||||
base.Size = new Size(100, 20);
|
||||
base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
BackColor = Color.Transparent;
|
||||
Text = base.Name;
|
||||
ForeColor = Color.White;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The banner border color")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get => borderColor;
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The color of the banner")]
|
||||
public Color BannerColor
|
||||
{
|
||||
get => bannerColor;
|
||||
set
|
||||
{
|
||||
bannerColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private PixelOffsetMode _PixelOffsetType = PixelOffsetMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public PixelOffsetMode PixelOffsetType
|
||||
{
|
||||
get => _PixelOffsetType;
|
||||
set
|
||||
{
|
||||
_PixelOffsetType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
List<Point> list = new();
|
||||
List<PointF> list2 = new();
|
||||
list.Add(new Point(0, base.Height / 10 * 5));
|
||||
list.Add(new Point(base.Height / 10, base.Height / 10 * 4));
|
||||
list.Add(new Point(base.Height / 10 * 2, base.Height / 10 * 3));
|
||||
list.Add(new Point(base.Height / 10 * 3, base.Height / 10 * 2));
|
||||
list.Add(new Point(base.Height / 10 * 4, base.Height / 10));
|
||||
list.Add(new Point(base.Height / 10 * 5, 0));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 5, 0));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 4, base.Height / 10));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 3, base.Height / 10 * 2));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 2, base.Height / 10 * 3));
|
||||
list.Add(new Point(base.Width - base.Height / 10, base.Height / 10 * 4));
|
||||
list.Add(new Point(base.Width, base.Height / 10 * 5));
|
||||
list.Add(new Point(base.Width - base.Height / 10, base.Height / 10 * 6));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 2, base.Height / 10 * 7));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 3, base.Height / 10 * 8));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 4, base.Height / 10 * 9));
|
||||
list.Add(new Point(base.Width - base.Height / 10 * 5, base.Height / 10 * 10));
|
||||
list.Add(new Point(base.Height / 10 * 5, base.Height / 10 * 10));
|
||||
list.Add(new Point(base.Height / 10 * 4, base.Height / 10 * 9));
|
||||
list.Add(new Point(base.Height / 10 * 3, base.Height / 10 * 8));
|
||||
list.Add(new Point(base.Height / 10 * 2, base.Height / 10 * 7));
|
||||
list.Add(new Point(base.Height / 10, base.Height / 10 * 6));
|
||||
list.Add(new Point(0, base.Height / 10 * 5));
|
||||
SolidBrush brush = new(bannerColor);
|
||||
e.Graphics.FillPolygon(brush, list.ToArray());
|
||||
list2.Add(new Point(0, base.Height / 10 * 5));
|
||||
list2.Add(new Point(base.Height / 10, base.Height / 10 * 4));
|
||||
list2.Add(new Point(base.Height / 10 * 2, base.Height / 10 * 3));
|
||||
list2.Add(new Point(base.Height / 10 * 3, base.Height / 10 * 2));
|
||||
list2.Add(new Point(base.Height / 10 * 4, base.Height / 10));
|
||||
list2.Add(new Point(base.Height / 10 * 5, 0));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 5 - 1, 0));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 4 - 1, base.Height / 10));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 3 - 1, base.Height / 10 * 2));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 2 - 1, base.Height / 10 * 3));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 - 1, base.Height / 10 * 4));
|
||||
list2.Add(new Point(base.Width - 1, base.Height / 10 * 5));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 - 1, base.Height / 10 * 6));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 2 - 1, base.Height / 10 * 7));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 3 - 1, base.Height / 10 * 8));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 4 - 1, base.Height / 10 * 9));
|
||||
list2.Add(new Point(base.Width - base.Height / 10 * 5, base.Height / 10 * 10 - 1));
|
||||
list2.Add(new Point(base.Height / 10 * 5 - 1, base.Height / 10 * 10 - 1));
|
||||
list2.Add(new Point(base.Height / 10 * 4, base.Height / 10 * 9));
|
||||
list2.Add(new Point(base.Height / 10 * 3, base.Height / 10 * 8));
|
||||
list2.Add(new Point(base.Height / 10 * 2, base.Height / 10 * 7));
|
||||
list2.Add(new Point(base.Height / 10, base.Height / 10 * 6));
|
||||
list2.Add(new Point(0, base.Height / 10 * 5));
|
||||
Pen pen = new Pen(borderColor, 1f);
|
||||
e.Graphics.DrawPolygon(pen, list2.ToArray());
|
||||
StringFormat stringFormat = new()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
};
|
||||
SolidBrush brush2 = new(ForeColor);
|
||||
RectangleF layoutRectangle = new(0f, 0f, Width, Height);
|
||||
e.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
e.Graphics.TextRenderingHint = TextRenderingType;
|
||||
e.Graphics.DrawString(Text, Font, brush2, layoutRectangle, stringFormat);
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
private Color borderColor = Color.FromArgb(250, 36, 38);
|
||||
|
||||
private Color bannerColor = Color.FromArgb(15, 15, 15);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ChatBubbleLeft
|
||||
|
||||
public class CrEaTiiOn_ChatBubbleLeft : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
private GraphicsPath Shape;
|
||||
private Color _TextColor = Color.White;
|
||||
private Color _BubbleColor = Color.FromArgb(250, 36, 38);
|
||||
private bool _DrawBubbleArrow = true;
|
||||
private bool _SizeAuto = true;
|
||||
private bool _SizeAutoW = true;
|
||||
private bool _SizeAutoH = true;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public override Color ForeColor
|
||||
{
|
||||
get => _TextColor;
|
||||
set
|
||||
{
|
||||
_TextColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color BubbleColor
|
||||
{
|
||||
get => _BubbleColor;
|
||||
set
|
||||
{
|
||||
_BubbleColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool DrawBubbleArrow
|
||||
{
|
||||
get => _DrawBubbleArrow;
|
||||
set
|
||||
{
|
||||
_DrawBubbleArrow = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool SizeAuto
|
||||
{
|
||||
get => _SizeAuto;
|
||||
set
|
||||
{
|
||||
_SizeAuto = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool SizeAutoW
|
||||
{
|
||||
get => _SizeAutoW;
|
||||
set
|
||||
{
|
||||
_SizeAutoW = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool SizeAutoH
|
||||
{
|
||||
get => _SizeAutoH;
|
||||
set
|
||||
{
|
||||
_SizeAutoH = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_ChatBubbleLeft()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
|
||||
DoubleBuffered = true;
|
||||
Size = new(120, 40);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
Font = new("Segoe UI", 10);
|
||||
}
|
||||
|
||||
protected override void OnResize(System.EventArgs e)
|
||||
{
|
||||
Shape = new();
|
||||
|
||||
GraphicsPath _Shape = Shape;
|
||||
_Shape.AddArc(9, 0, 10, 10, 180, 90);
|
||||
_Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
|
||||
_Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
|
||||
_Shape.AddArc(9, Height - 11, 10, 10, 90, 90);
|
||||
_Shape.CloseAllFigures();
|
||||
|
||||
Invalidate();
|
||||
base.OnResize(e);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (_SizeAuto)
|
||||
{
|
||||
if (_SizeAutoW && _SizeAutoH)
|
||||
{
|
||||
Width = TextRenderer.MeasureText(Text, Font).Width + 15;
|
||||
Height = TextRenderer.MeasureText(Text, Font).Height + 15;
|
||||
}
|
||||
else if (_SizeAutoW)
|
||||
{
|
||||
Width = TextRenderer.MeasureText(Text, Font).Width + 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
Height = TextRenderer.MeasureText(Text, Font).Height + 15;
|
||||
}
|
||||
}
|
||||
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
|
||||
Graphics _G = G;
|
||||
_G.SmoothingMode = SmoothingMode.HighQuality;
|
||||
_G.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
_G.Clear(BackColor);
|
||||
|
||||
// Fill the body of the bubble with the specified color
|
||||
_G.FillPath(new SolidBrush(_BubbleColor), Shape);
|
||||
// Draw the string specified in 'Text' property
|
||||
_G.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(15, 7, Width - 17, Height - 5));
|
||||
|
||||
// Draw a polygon on the right side of the bubble
|
||||
if (_DrawBubbleArrow == true)
|
||||
{
|
||||
Point[] p =
|
||||
{
|
||||
new Point(9, Height - 19),
|
||||
new Point(0, Height - 25),
|
||||
new Point(9, Height - 30)
|
||||
};
|
||||
_G.FillPolygon(new SolidBrush(_BubbleColor), p);
|
||||
_G.DrawPolygon(new(new SolidBrush(_BubbleColor)), p);
|
||||
}
|
||||
G.Dispose();
|
||||
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
e.Graphics.DrawImageUnscaled(B, 0, 0);
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ChatBubbleRight
|
||||
|
||||
public class CrEaTiiOn_ChatBubbleRight : Control
|
||||
{
|
||||
|
||||
#region Variables
|
||||
|
||||
private GraphicsPath Shape;
|
||||
private Color _TextColor = Color.White;
|
||||
private Color _BubbleColor = Color.FromArgb(250, 36, 38);
|
||||
private bool _DrawBubbleArrow = true;
|
||||
private bool _SizeAuto = true;
|
||||
private bool _SizeAutoW = true;
|
||||
private bool _SizeAutoH = true;
|
||||
private bool _SizeWidthLeft = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public override Color ForeColor
|
||||
{
|
||||
get => _TextColor;
|
||||
set
|
||||
{
|
||||
_TextColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color BubbleColor
|
||||
{
|
||||
get => _BubbleColor;
|
||||
set
|
||||
{
|
||||
_BubbleColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool DrawBubbleArrow
|
||||
{
|
||||
get => _DrawBubbleArrow;
|
||||
set
|
||||
{
|
||||
_DrawBubbleArrow = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool SizeAuto
|
||||
{
|
||||
get => _SizeAuto;
|
||||
set
|
||||
{
|
||||
_SizeAuto = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool SizeAutoW
|
||||
{
|
||||
get => _SizeAutoW;
|
||||
set
|
||||
{
|
||||
_SizeAutoW = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool SizeAutoH
|
||||
{
|
||||
get => _SizeAutoH;
|
||||
set
|
||||
{
|
||||
_SizeAutoH = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool SizeWidthLeft
|
||||
{
|
||||
get => _SizeWidthLeft;
|
||||
set
|
||||
{
|
||||
_SizeWidthLeft = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_ChatBubbleRight()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
|
||||
DoubleBuffered = true;
|
||||
Size = new(130, 40);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
Font = new("Segoe UI", 10);
|
||||
}
|
||||
|
||||
protected override void OnResize(System.EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Shape = new();
|
||||
|
||||
GraphicsPath _with1 = Shape;
|
||||
_with1.AddArc(0, 0, 10, 10, 180, 90);
|
||||
_with1.AddArc(Width - 18, 0, 10, 10, -90, 90);
|
||||
_with1.AddArc(Width - 18, Height - 11, 10, 10, 0, 90);
|
||||
_with1.AddArc(0, Height - 11, 10, 10, 90, 90);
|
||||
_with1.CloseAllFigures();
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (_SizeAuto)
|
||||
{
|
||||
int WW = Width;
|
||||
if (_SizeAutoW && _SizeAutoH)
|
||||
{
|
||||
Width = TextRenderer.MeasureText(Text, Font).Width + 15;
|
||||
Height = TextRenderer.MeasureText(Text, Font).Height + 15;
|
||||
if (_SizeWidthLeft)
|
||||
{
|
||||
Location = new(Location.X - (Width - WW), Location.Y);
|
||||
}
|
||||
}
|
||||
else if (_SizeAutoW)
|
||||
{
|
||||
Width = TextRenderer.MeasureText(Text, Font).Width + 15;
|
||||
if (_SizeWidthLeft)
|
||||
{
|
||||
Location = new(Location.X - (Width - WW), Location.Y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Height = TextRenderer.MeasureText(Text, Font).Height + 15;
|
||||
}
|
||||
}
|
||||
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
|
||||
Graphics _G = G;
|
||||
_G.SmoothingMode = SmoothingMode.HighQuality;
|
||||
_G.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
_G.Clear(BackColor);
|
||||
|
||||
// Fill the body of the bubble with the specified color
|
||||
_G.FillPath(new SolidBrush(_BubbleColor), Shape);
|
||||
// Draw the string specified in 'Text' property
|
||||
_G.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(6, 7, Width - 15, Height));
|
||||
|
||||
// Draw a polygon on the right side of the bubble
|
||||
if (_DrawBubbleArrow == true)
|
||||
{
|
||||
Point[] p =
|
||||
{
|
||||
new Point(Width - 8, Height - 19),
|
||||
new Point(Width, Height - 25),
|
||||
new Point(Width - 8, Height - 30)
|
||||
};
|
||||
_G.FillPolygon(new SolidBrush(_BubbleColor), p);
|
||||
_G.DrawPolygon(new(new SolidBrush(_BubbleColor)), p);
|
||||
}
|
||||
|
||||
G.Dispose();
|
||||
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
e.Graphics.DrawImageUnscaled(B, 0, 0);
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Button
|
||||
|
||||
public class CrEaTiiOn_Button : Button
|
||||
{
|
||||
//Fields
|
||||
private int borderSize = 2;
|
||||
private int borderRadius = 3;
|
||||
private Color borderColor = Color.FromArgb(250, 36, 38);
|
||||
|
||||
//Properties
|
||||
[Category("CrEaTiiOn")]
|
||||
public int BorderSize
|
||||
{
|
||||
get { return borderSize; }
|
||||
set
|
||||
{
|
||||
borderSize = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public int BorderRadius
|
||||
{
|
||||
get { return borderRadius; }
|
||||
set
|
||||
{
|
||||
borderRadius = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public Color BackgroundColor
|
||||
{
|
||||
get { return this.BackColor; }
|
||||
set { this.BackColor = value; }
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public Color TextColor
|
||||
{
|
||||
get { return this.ForeColor; }
|
||||
set { this.ForeColor = value; }
|
||||
}
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_Button()
|
||||
{
|
||||
this.FlatStyle = FlatStyle.Flat;
|
||||
this.FlatAppearance.BorderSize = 0;
|
||||
this.Size = new Size(150, 40);
|
||||
this.BackColor = Color.FromArgb(15, 15, 15);
|
||||
this.ForeColor = Color.White;
|
||||
this.Resize += new EventHandler(Button_Resize);
|
||||
}
|
||||
|
||||
//Methods
|
||||
private GraphicsPath GetFigurePath(Rectangle rect, int radius)
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
float curveSize = radius * 2F;
|
||||
|
||||
path.StartFigure();
|
||||
path.AddArc(rect.X, rect.Y, curveSize, curveSize, 180, 90);
|
||||
path.AddArc(rect.Right - curveSize, rect.Y, curveSize, curveSize, 270, 90);
|
||||
path.AddArc(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize, 0, 90);
|
||||
path.AddArc(rect.X, rect.Bottom - curveSize, curveSize, curveSize, 90, 90);
|
||||
path.CloseFigure();
|
||||
return path;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pevent)
|
||||
{
|
||||
base.OnPaint(pevent);
|
||||
|
||||
|
||||
Rectangle rectSurface = this.ClientRectangle;
|
||||
Rectangle rectBorder = Rectangle.Inflate(rectSurface, -borderSize, -borderSize);
|
||||
int smoothSize = 2;
|
||||
if (borderSize > 0)
|
||||
smoothSize = borderSize;
|
||||
|
||||
if (borderRadius > 2) //Rounded button
|
||||
{
|
||||
using (GraphicsPath pathSurface = GetFigurePath(rectSurface, borderRadius))
|
||||
using (GraphicsPath pathBorder = GetFigurePath(rectBorder, borderRadius - borderSize))
|
||||
using (Pen penSurface = new Pen(this.Parent.BackColor, smoothSize))
|
||||
using (Pen penBorder = new Pen(borderColor, borderSize))
|
||||
{
|
||||
pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
//Button surface
|
||||
this.Region = new Region(pathSurface);
|
||||
//Draw surface border for HD result
|
||||
pevent.Graphics.DrawPath(penSurface, pathSurface);
|
||||
|
||||
//Button border
|
||||
if (borderSize >= 1)
|
||||
//Draw control border
|
||||
pevent.Graphics.DrawPath(penBorder, pathBorder);
|
||||
}
|
||||
}
|
||||
else //Normal button
|
||||
{
|
||||
pevent.Graphics.SmoothingMode = SmoothingMode.None;
|
||||
//Button surface
|
||||
this.Region = new Region(rectSurface);
|
||||
//Button border
|
||||
if (borderSize >= 1)
|
||||
{
|
||||
using (Pen penBorder = new Pen(borderColor, borderSize))
|
||||
{
|
||||
penBorder.Alignment = PenAlignment.Inset;
|
||||
pevent.Graphics.DrawRectangle(penBorder, 0, 0, this.Width - 1, this.Height - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
this.Parent.BackColorChanged += new EventHandler(Container_BackColorChanged);
|
||||
}
|
||||
|
||||
private void Container_BackColorChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.Invalidate();
|
||||
}
|
||||
private void Button_Resize(object sender, EventArgs e)
|
||||
{
|
||||
if (borderRadius > this.Height)
|
||||
borderRadius = this.Height;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_DescriptiveButton : Control
|
||||
{
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
g.Clear(Parent.BackColor);
|
||||
|
||||
DrawingHelper dh = new DrawingHelper();
|
||||
MultiLineHandler mlh = new MultiLineHandler();
|
||||
int slope = Adjustments.Roundness;
|
||||
|
||||
Rectangle mainRect = new Rectangle(0, 0, Width - 1, Height - 1);
|
||||
GraphicsPath mainPath = dh.RoundRect(mainRect, slope);
|
||||
|
||||
ColorBlend backCB = new ColorBlend(3);
|
||||
backCB.Colors = new[] { Color.FromArgb(15, 15, 15), Color.FromArgb(15, 15, 15), Color.FromArgb(15, 15, 15) };
|
||||
backCB.Positions = new[] { 0.0f, 0.75f, 1.0f };
|
||||
LinearGradientBrush backLGB = new LinearGradientBrush(mainRect, Color.Black, Color.Black, 90.0F);
|
||||
backLGB.InterpolationColors = backCB;
|
||||
g.FillPath(backLGB, mainPath);
|
||||
|
||||
SolidBrush textBrush = new SolidBrush(Color.White);
|
||||
|
||||
if (_image != null)
|
||||
{
|
||||
Rectangle imageRect = new Rectangle(12, 12, 48, 48);
|
||||
g.DrawImage(_image, imageRect);
|
||||
g.DrawString(_title, _titleFont, textBrush, new Point(12 + 48 + 4, (int)(12 + (48 / 2.0) - (g.MeasureString(_title, _titleFont).Height / 2.0))));
|
||||
}
|
||||
else
|
||||
{
|
||||
g.DrawString(_title, _titleFont, textBrush, new Point(12, (int)(12 + (48 / 2.0) - (g.MeasureString(_title, _titleFont).Height / 2.0))));
|
||||
}
|
||||
|
||||
int descY = 12 + 48 + 14;
|
||||
textBrush = new SolidBrush(Color.FromArgb(120, 120, 120));
|
||||
|
||||
foreach (string line in mlh.GetLines(g, Text, Font, Width - 24))
|
||||
{
|
||||
g.DrawString(line, Font, textBrush, new Point(12, descY));
|
||||
descY += 13;
|
||||
}
|
||||
|
||||
if (state == MouseState.Over)
|
||||
{
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(10, Color.Black)), mainPath);
|
||||
}
|
||||
else if (state == MouseState.Down)
|
||||
{
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(18, Color.Black)), mainPath);
|
||||
}
|
||||
|
||||
LinearGradientBrush borderLGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(250, 36, 38), Color.FromArgb(250, 36, 38), 90.0F);
|
||||
g.DrawPath(new Pen(borderLGB), mainPath);
|
||||
|
||||
}
|
||||
|
||||
public CrEaTiiOn_DescriptiveButton()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
|
||||
Font = new Font(Adjustments.DefaultFontFamily, 8);
|
||||
Size = new Size(200, 130);
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
private Image _image;
|
||||
public Image Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return _image;
|
||||
}
|
||||
set
|
||||
{
|
||||
_image = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private string _title = "Title";
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
set
|
||||
{
|
||||
_title = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Font _titleFont = new Font(Adjustments.DefaultFontFamily, 14);
|
||||
public Font TitleFont
|
||||
{
|
||||
get
|
||||
{
|
||||
return _titleFont;
|
||||
}
|
||||
set
|
||||
{
|
||||
_titleFont = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public enum MouseState
|
||||
{
|
||||
None,
|
||||
Over,
|
||||
Down
|
||||
}
|
||||
|
||||
private MouseState state = MouseState.None;
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
base.OnMouseEnter(e);
|
||||
state = MouseState.Over;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
state = MouseState.None;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
state = MouseState.Down;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
state = MouseState.Over;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
{
|
||||
base.OnFontChanged(e);
|
||||
Font = new Font(Font.FontFamily, 8);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,363 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_FlatButton
|
||||
|
||||
public class CrEaTiiOn_FlatButton : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
private int MouseState;
|
||||
private GraphicsPath Shape;
|
||||
private LinearGradientBrush InactiveGB;
|
||||
private Color _InactiveColor = Color.FromArgb(15, 15, 15);
|
||||
private LinearGradientBrush PressedGB;
|
||||
private Color _PressedColor = Color.FromArgb(20, 20, 20);
|
||||
private LinearGradientBrush EnteredGB;
|
||||
private Color _EnteredColor = Color.FromArgb(25, 25, 25);
|
||||
private Rectangle R1;
|
||||
private readonly Pen P1;
|
||||
private readonly Pen P3;
|
||||
private Image _Image;
|
||||
private Size _ImageSize;
|
||||
private StringAlignment _TextAlignment = StringAlignment.Center;
|
||||
private Color _TextColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
|
||||
private ContentAlignment _ImageAlign = ContentAlignment.MiddleLeft;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Image Designer
|
||||
|
||||
private static PointF ImageLocation(StringFormat SF, SizeF Area, SizeF ImageArea)
|
||||
{
|
||||
PointF MyPoint = new();
|
||||
switch (SF.Alignment)
|
||||
{
|
||||
case StringAlignment.Center:
|
||||
MyPoint.X = (float)((Area.Width - ImageArea.Width) / 2);
|
||||
break;
|
||||
case StringAlignment.Near:
|
||||
MyPoint.X = 2;
|
||||
break;
|
||||
case StringAlignment.Far:
|
||||
MyPoint.X = Area.Width - ImageArea.Width - 2;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
switch (SF.LineAlignment)
|
||||
{
|
||||
case StringAlignment.Center:
|
||||
MyPoint.Y = (float)((Area.Height - ImageArea.Height) / 2);
|
||||
break;
|
||||
case StringAlignment.Near:
|
||||
MyPoint.Y = 2;
|
||||
break;
|
||||
case StringAlignment.Far:
|
||||
MyPoint.Y = Area.Height - ImageArea.Height - 2;
|
||||
break;
|
||||
}
|
||||
return MyPoint;
|
||||
}
|
||||
|
||||
private StringFormat GetStringFormat(ContentAlignment _ContentAlignment)
|
||||
{
|
||||
StringFormat SF = new();
|
||||
switch (_ContentAlignment)
|
||||
{
|
||||
case ContentAlignment.MiddleCenter:
|
||||
SF.LineAlignment = StringAlignment.Center;
|
||||
SF.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
case ContentAlignment.MiddleLeft:
|
||||
SF.LineAlignment = StringAlignment.Center;
|
||||
SF.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
case ContentAlignment.MiddleRight:
|
||||
SF.LineAlignment = StringAlignment.Center;
|
||||
SF.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
case ContentAlignment.TopCenter:
|
||||
SF.LineAlignment = StringAlignment.Near;
|
||||
SF.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
case ContentAlignment.TopLeft:
|
||||
SF.LineAlignment = StringAlignment.Near;
|
||||
SF.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
case ContentAlignment.TopRight:
|
||||
SF.LineAlignment = StringAlignment.Near;
|
||||
SF.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
case ContentAlignment.BottomCenter:
|
||||
SF.LineAlignment = StringAlignment.Far;
|
||||
SF.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
case ContentAlignment.BottomLeft:
|
||||
SF.LineAlignment = StringAlignment.Far;
|
||||
SF.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
case ContentAlignment.BottomRight:
|
||||
SF.LineAlignment = StringAlignment.Far;
|
||||
SF.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
return SF;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public Image Image
|
||||
{
|
||||
get => _Image;
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
_ImageSize = Size.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ImageSize = value.Size;
|
||||
}
|
||||
|
||||
_Image = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected Size ImageSize => _ImageSize;
|
||||
|
||||
public ContentAlignment ImageAlign
|
||||
{
|
||||
get => _ImageAlign;
|
||||
set
|
||||
{
|
||||
_ImageAlign = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public StringAlignment TextAlignment
|
||||
{
|
||||
get => _TextAlignment;
|
||||
set
|
||||
{
|
||||
_TextAlignment = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public override Color ForeColor
|
||||
{
|
||||
get => _TextColor;
|
||||
set
|
||||
{
|
||||
_TextColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color InactiveColor
|
||||
{
|
||||
get => _InactiveColor;
|
||||
set => _InactiveColor = value;
|
||||
}
|
||||
|
||||
public Color PressedColor
|
||||
{
|
||||
get => _PressedColor;
|
||||
set => _PressedColor = value;
|
||||
}
|
||||
|
||||
public Color EnteredColor
|
||||
{
|
||||
get => _EnteredColor;
|
||||
set => _EnteredColor = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
MouseState = 2;
|
||||
Invalidate();
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
/*protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
if (Enabled == true)
|
||||
Cursor = Cursors.Hand;
|
||||
else
|
||||
Cursor = Cursors.No;
|
||||
base.OnMouseMove(e);
|
||||
}*/
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
MouseState = 2;
|
||||
Invalidate();
|
||||
base.OnMouseEnter(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
MouseState = 1;
|
||||
Focus();
|
||||
Invalidate();
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
MouseState = 0;
|
||||
Invalidate();
|
||||
base.OnMouseLeave(e);
|
||||
}
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_FlatButton()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
|
||||
|
||||
BackColor = Color.Transparent;
|
||||
Cursor = Cursors.Hand;
|
||||
DoubleBuffered = true;
|
||||
Font = new("Segoe UI", 12);
|
||||
ForeColor = Color.White;
|
||||
Size = new(120, 40);
|
||||
_TextAlignment = StringAlignment.Center;
|
||||
P1 = new(Color.FromArgb(250, 36, 38)); // P1 = Border color
|
||||
P3 = new(Color.FromArgb(250, 36, 38)); // P3 = Border color when pressed
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
if (Width > 0 && Height > 0)
|
||||
{
|
||||
Shape = new();
|
||||
R1 = new(0, 0, Width, Height);
|
||||
|
||||
InactiveGB = new(new Rectangle(0, 0, Width, Height), _InactiveColor, _InactiveColor, 90.0F);
|
||||
PressedGB = new(new Rectangle(0, 0, Width, Height), _PressedColor, _PressedColor, 90.0F);
|
||||
EnteredGB = new(new Rectangle(0, 0, Width, Height), _EnteredColor, _EnteredColor, 90.0F);
|
||||
}
|
||||
|
||||
Shape.AddArc(0, 0, 10, 10, 180, 90);
|
||||
Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
|
||||
Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
|
||||
Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
|
||||
Shape.CloseAllFigures();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Graphics G = e.Graphics;
|
||||
G.SmoothingMode = SmoothingMode.HighQuality;
|
||||
PointF ipt = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize);
|
||||
|
||||
switch (MouseState)
|
||||
{
|
||||
case 0:
|
||||
//Inactive
|
||||
G.FillPath(InactiveGB, Shape);
|
||||
// Fill button body with InactiveGB color gradient
|
||||
G.DrawPath(P1, Shape);
|
||||
// Draw button border [InactiveGB]
|
||||
if ((Image == null))
|
||||
{
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
|
||||
{
|
||||
Alignment = _TextAlignment,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
|
||||
{
|
||||
Alignment = _TextAlignment,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//Pressed
|
||||
G.FillPath(PressedGB, Shape);
|
||||
// Fill button body with PressedGB color gradient
|
||||
G.DrawPath(P3, Shape);
|
||||
// Draw button border [PressedGB]
|
||||
|
||||
if ((Image == null))
|
||||
{
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
|
||||
{
|
||||
Alignment = _TextAlignment,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
|
||||
{
|
||||
Alignment = _TextAlignment,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//Entered
|
||||
G.FillPath(EnteredGB, Shape);
|
||||
// Fill button body with EnteredGB color gradient
|
||||
G.DrawPath(P3, Shape);
|
||||
// Draw button border [EnteredGB]
|
||||
|
||||
if ((Image == null))
|
||||
{
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
|
||||
{
|
||||
Alignment = _TextAlignment,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
|
||||
{
|
||||
Alignment = _TextAlignment,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
base.OnPaint(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_LightButton : Control
|
||||
{
|
||||
|
||||
#region "CreateRound"
|
||||
private GraphicsPath CreateRoundPath;
|
||||
|
||||
private Rectangle CreateRoundRectangle;
|
||||
public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
|
||||
{
|
||||
CreateRoundRectangle = new Rectangle(x, y, width, height);
|
||||
return CreateRound(CreateRoundRectangle, slope);
|
||||
}
|
||||
|
||||
public GraphicsPath CreateRound(Rectangle r, int slope)
|
||||
{
|
||||
CreateRoundPath = new GraphicsPath(FillMode.Winding);
|
||||
CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
|
||||
CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
|
||||
CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
|
||||
CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
|
||||
CreateRoundPath.CloseFigure();
|
||||
return CreateRoundPath;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "Mouse states"
|
||||
private MouseStates State;
|
||||
public enum MouseStates
|
||||
{
|
||||
None = 0,
|
||||
Over = 1,
|
||||
Down = 2
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
State = MouseStates.Over;
|
||||
Invalidate();
|
||||
base.OnMouseEnter(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
State = MouseStates.None;
|
||||
Invalidate();
|
||||
base.OnMouseEnter(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
State = MouseStates.Down;
|
||||
Invalidate();
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
State = MouseStates.Over;
|
||||
Invalidate();
|
||||
if (e.Button == MouseButtons.Left)
|
||||
base.OnClick(null);
|
||||
//This fixes some fucked up lag you get...
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
//Do nothing here or it fires twice
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "Properties"
|
||||
|
||||
public enum ImageAlignments
|
||||
{
|
||||
Left = 0,
|
||||
Center = 1,
|
||||
Right = 2
|
||||
}
|
||||
|
||||
ImageAlignments _ImageAlignment = ImageAlignments.Left;
|
||||
public ImageAlignments ImageAlignment
|
||||
{
|
||||
get { return _ImageAlignment; }
|
||||
set
|
||||
{
|
||||
_ImageAlignment = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
Image _Image;
|
||||
public Image Image
|
||||
{
|
||||
get { return _Image; }
|
||||
set
|
||||
{
|
||||
_Image = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_LightButton()
|
||||
{
|
||||
Size = new Size(120, 31);
|
||||
DoubleBuffered = true;
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
|
||||
BackColor = Color.FromArgb(250, 36, 38);
|
||||
Font = new Font("Segoe UI", 9);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
|
||||
Brush LGB = default(Brush);
|
||||
|
||||
switch (State)
|
||||
{
|
||||
case MouseStates.None:
|
||||
LGB = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(20, 20, 20), Color.FromArgb(25, 25, 25), 90f);
|
||||
break;
|
||||
case MouseStates.Over:
|
||||
LGB = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(20, 20, 20), Color.FromArgb(25, 25, 25), 90f);
|
||||
break;
|
||||
default:
|
||||
LGB = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(20, 20, 20), Color.FromArgb(18, 18, 18), 90f);
|
||||
break;
|
||||
}
|
||||
if (!Enabled)
|
||||
{
|
||||
LGB = new SolidBrush(Color.FromArgb(20, 20, 20));
|
||||
}
|
||||
e.Graphics.FillPath(LGB, CreateRound(0, 0, Width - 1, Height - 1, 6));
|
||||
|
||||
if ((_Image == null))
|
||||
{
|
||||
e.Graphics.DrawString(Text, Font, Brushes.White, new Rectangle(3, 2, Width - 7, Height - 5), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Center,
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Trimming = StringTrimming.EllipsisCharacter
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
switch (_ImageAlignment)
|
||||
{
|
||||
case ImageAlignments.Left:
|
||||
Rectangle ImageRect = new Rectangle(9, 6, Height - 13, Height - 13);
|
||||
e.Graphics.DrawImage(_Image, ImageRect);
|
||||
e.Graphics.DrawString(Text, Font, Brushes.White, new Rectangle(ImageRect.X + ImageRect.Width + 6, 2, Width - ImageRect.Width - 22, Height - 5), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Center,
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Trimming = StringTrimming.EllipsisCharacter
|
||||
});
|
||||
break;
|
||||
case ImageAlignments.Center:
|
||||
Rectangle ImageRect1 = new Rectangle(((Width - 1) / 2) - (Height - 13) / 2, 6, Height - 13, Height - 13);
|
||||
e.Graphics.DrawImage(_Image, ImageRect1);
|
||||
break;
|
||||
case ImageAlignments.Right:
|
||||
Rectangle ImageRect2 = new Rectangle(Width - Height + 3, 6, Height - 13, Height - 13);
|
||||
e.Graphics.DrawImage(_Image, ImageRect2);
|
||||
e.Graphics.DrawString(Text, Font, Brushes.White, new Rectangle(3, 2, Width - ImageRect2.Width - 22, Height - 5), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Center,
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Trimming = StringTrimming.EllipsisCharacter
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
public void PerformClick()
|
||||
{
|
||||
base.OnClick(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ModernButton
|
||||
|
||||
public class CrEaTiiOn_ModernButton : Button
|
||||
{
|
||||
private Graphics G;
|
||||
|
||||
private Helpers.MouseState State;
|
||||
|
||||
private Schemes SchemeClone = Schemes.Black;
|
||||
public Schemes Scheme
|
||||
{
|
||||
get { return SchemeClone; }
|
||||
set
|
||||
{
|
||||
SchemeClone = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public enum Schemes : byte
|
||||
{
|
||||
Black = 0,
|
||||
Green = 1,
|
||||
Red = 2,
|
||||
Blue = 3
|
||||
}
|
||||
|
||||
public CrEaTiiOn_ModernButton()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
base.OnPaint(e);
|
||||
|
||||
G.Clear(Parent.BackColor);
|
||||
|
||||
switch (Scheme)
|
||||
{
|
||||
|
||||
case Schemes.Black:
|
||||
|
||||
|
||||
if (Enabled)
|
||||
{
|
||||
|
||||
if (State == Helpers.MouseState.None)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(20, 20, 20)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(250, 36, 38)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Over)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(58, 58, 57)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(46, 46, 45)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Down)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(50, 50, 49)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(38, 38, 37)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(40, 40, 39)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(38, 38, 37)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case Schemes.Green:
|
||||
|
||||
|
||||
if (State == Helpers.MouseState.None)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(123, 164, 93)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(119, 160, 89)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Over)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(127, 168, 97)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(123, 164, 93)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Down)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(119, 160, 93)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(115, 156, 85)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case Schemes.Red:
|
||||
|
||||
|
||||
if (State == Helpers.MouseState.None)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(164, 93, 93)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(160, 89, 89)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Over)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(168, 97, 97)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(164, 93, 93)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Down)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(160, 89, 89)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(156, 85, 85)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case Schemes.Blue:
|
||||
|
||||
|
||||
if (State == Helpers.MouseState.None)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(93, 154, 164)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(89, 150, 160)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Over)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(97, 160, 168)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(93, 154, 164)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (State == Helpers.MouseState.Down)
|
||||
{
|
||||
using (SolidBrush Background = new SolidBrush(Color.FromArgb(89, 150, 160)))
|
||||
{
|
||||
using (Pen Border = new Pen(Color.FromArgb(85, 146, 156)))
|
||||
{
|
||||
G.FillPath(Background, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (Scheme == Schemes.Black)
|
||||
{
|
||||
if (Enabled)
|
||||
{
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.FromArgb(220, 220, 219)))
|
||||
{
|
||||
using (Font TextFont = new Font("Segoe UI", 9))
|
||||
{
|
||||
using (StringFormat SF = new StringFormat { Alignment = StringAlignment.Center })
|
||||
{
|
||||
G.DrawString(Text, TextFont, TextBrush, new Rectangle(0, Height / 2 - 9, Width, Height), SF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.FromArgb(140, 140, 139)))
|
||||
{
|
||||
using (Font TextFont = new Font("Segoe UI", 9))
|
||||
{
|
||||
using (StringFormat SF = new StringFormat { Alignment = StringAlignment.Center })
|
||||
{
|
||||
G.DrawString(Text, TextFont, TextBrush, new Rectangle(0, Height / 2 - 9, Width, Height), SF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Enabled)
|
||||
{
|
||||
Scheme = Schemes.Black;
|
||||
}
|
||||
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.FromArgb(250, 250, 249)))
|
||||
{
|
||||
using (Font TextFont = new Font("Segoe UI", 9))
|
||||
{
|
||||
using (StringFormat SF = new StringFormat { Alignment = StringAlignment.Center })
|
||||
{
|
||||
G.DrawString(Text, TextFont, TextBrush, new Rectangle(0, Height / 2 - 9, Width, Height), SF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
State = Helpers.MouseState.Over;
|
||||
Invalidate();
|
||||
base.OnMouseEnter(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
State = Helpers.MouseState.None;
|
||||
Invalidate();
|
||||
base.OnMouseLeave(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
State = Helpers.MouseState.Over;
|
||||
Invalidate();
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
State = Helpers.MouseState.Down;
|
||||
Invalidate();
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,315 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_PillButton
|
||||
|
||||
[Description("Text")]
|
||||
public class CrEaTiiOn_PillButton : Control, IButtonControl
|
||||
{
|
||||
#region Variables
|
||||
int radius;
|
||||
bool transparency;
|
||||
MouseState state;
|
||||
RoundedRectangleF roundedRect;
|
||||
Color inactive1, inactive2, active1, active2;
|
||||
private Color strokeColor;
|
||||
private bool stroke;
|
||||
|
||||
public bool Stroke
|
||||
{
|
||||
get { return stroke; }
|
||||
set
|
||||
{
|
||||
stroke = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color StrokeColor
|
||||
{
|
||||
get { return strokeColor; }
|
||||
set
|
||||
{
|
||||
strokeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region AltoButton
|
||||
public CrEaTiiOn_PillButton()
|
||||
{
|
||||
Width = 65;
|
||||
Height = 30;
|
||||
stroke = false;
|
||||
strokeColor = Color.Gray;
|
||||
inactive1 = Color.FromArgb(250, 36, 38);
|
||||
inactive2 = Color.FromArgb(250, 36, 38);
|
||||
active1 = Color.FromArgb(230, 16, 18);
|
||||
active2 = Color.FromArgb(230, 16, 18);
|
||||
|
||||
radius = 10;
|
||||
roundedRect = new RoundedRectangleF(Width, Height, radius);
|
||||
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer |
|
||||
ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor |
|
||||
ControlStyles.UserPaint, true);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
Font = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
|
||||
state = MouseState.Leave;
|
||||
transparency = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
#region Transparency
|
||||
if (transparency)
|
||||
Transparenter.MakeTransparent(this, e.Graphics);
|
||||
#endregion
|
||||
|
||||
#region Drawing
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
roundedRect = new RoundedRectangleF(Width, Height, radius);
|
||||
e.Graphics.FillRectangle(Brushes.Transparent, this.ClientRectangle);
|
||||
|
||||
int R1 = (active1.R + inactive1.R) / 2;
|
||||
int G1 = (active1.G + inactive1.G) / 2;
|
||||
int B1 = (active1.B + inactive1.B) / 2;
|
||||
|
||||
int R2 = (active2.R + inactive2.R) / 2;
|
||||
int G2 = (active2.G + inactive2.G) / 2;
|
||||
int B2 = (active2.B + inactive2.B) / 2;
|
||||
|
||||
Rectangle rect = new Rectangle(0, 0, Width, Height);
|
||||
|
||||
if (this.Enabled)
|
||||
{
|
||||
if (state == MouseState.Leave)
|
||||
using (LinearGradientBrush inactiveGB = new LinearGradientBrush(rect, inactive1, inactive2, 90f))
|
||||
e.Graphics.FillPath(inactiveGB, roundedRect.Path);
|
||||
else if (state == MouseState.Enter)
|
||||
using (LinearGradientBrush activeGB = new LinearGradientBrush(rect, active1, active2, 90f))
|
||||
e.Graphics.FillPath(activeGB, roundedRect.Path);
|
||||
else if (state == MouseState.Down)
|
||||
using (LinearGradientBrush downGB = new LinearGradientBrush(rect, Color.FromArgb(R1, G1, B1), Color.FromArgb(R2, G2, B2), 90f))
|
||||
e.Graphics.FillPath(downGB, roundedRect.Path);
|
||||
if (stroke)
|
||||
using (Pen pen = new Pen(strokeColor, 1))
|
||||
using (GraphicsPath path = new RoundedRectangleF(Width - (radius > 0 ? 0 : 1), Height - (radius > 0 ? 0 : 1), radius).Path)
|
||||
e.Graphics.DrawPath(pen, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color linear1 = Color.FromArgb(190, 190, 190);
|
||||
Color linear2 = Color.FromArgb(210, 210, 210);
|
||||
using (LinearGradientBrush inactiveGB = new LinearGradientBrush(rect, linear1, linear2, 90f))
|
||||
{
|
||||
e.Graphics.FillPath(inactiveGB, roundedRect.Path);
|
||||
e.Graphics.DrawPath(new Pen(inactiveGB), roundedRect.Path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Text Drawing
|
||||
using (StringFormat sf = new StringFormat()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
})
|
||||
using (Brush brush = new SolidBrush(ForeColor))
|
||||
e.Graphics.DrawString(Text, Font, brush, this.ClientRectangle, sf);
|
||||
#endregion
|
||||
base.OnPaint(e);
|
||||
}
|
||||
protected override void OnMouseDoubleClick(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDoubleClick(e);
|
||||
base.OnClick(e);
|
||||
}
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
base.OnClick(e);
|
||||
}
|
||||
protected override void OnEnabledChanged(EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnEnabledChanged(e);
|
||||
}
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnResize(e);
|
||||
}
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
state = MouseState.Enter;
|
||||
base.OnMouseEnter(e);
|
||||
Invalidate();
|
||||
}
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
state = MouseState.Leave;
|
||||
base.OnMouseLeave(e);
|
||||
Invalidate();
|
||||
}
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
Capture = false;
|
||||
state = MouseState.Down;
|
||||
base.OnMouseDown(e);
|
||||
Invalidate();
|
||||
}
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
if (state != MouseState.Leave)
|
||||
state = MouseState.Enter;
|
||||
base.OnMouseUp(e);
|
||||
Invalidate();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
|
||||
public int Radius
|
||||
{
|
||||
get
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
set
|
||||
{
|
||||
radius = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public Color Inactive1
|
||||
{
|
||||
get
|
||||
{
|
||||
return inactive1;
|
||||
}
|
||||
set
|
||||
{
|
||||
inactive1 = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public Color Inactive2
|
||||
{
|
||||
get
|
||||
{
|
||||
return inactive2;
|
||||
}
|
||||
set
|
||||
{
|
||||
inactive2 = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public Color Active1
|
||||
{
|
||||
get
|
||||
{
|
||||
return active1;
|
||||
}
|
||||
set
|
||||
{
|
||||
active1 = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public Color Active2
|
||||
{
|
||||
get
|
||||
{
|
||||
return active2;
|
||||
}
|
||||
set
|
||||
{
|
||||
active2 = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public bool Transparency
|
||||
{
|
||||
get
|
||||
{
|
||||
return transparency;
|
||||
}
|
||||
set
|
||||
{
|
||||
transparency = value;
|
||||
}
|
||||
}
|
||||
public override string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Text = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public override Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.ForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public DialogResult DialogResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyDefault(bool value)
|
||||
{
|
||||
}
|
||||
|
||||
public void PerformClick()
|
||||
{
|
||||
OnClick(EventArgs.Empty);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public enum MouseState
|
||||
{
|
||||
Enter,
|
||||
Leave,
|
||||
Down,
|
||||
Up,
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_GradientCard
|
||||
|
||||
public class CrEaTiiOn_GradientCard : Control
|
||||
{
|
||||
public CrEaTiiOn_GradientCard()
|
||||
{
|
||||
base.SetStyle(ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
|
||||
base.Size = new Size(320, 170);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The 1st half color of he gradient")]
|
||||
public Color Color1
|
||||
{
|
||||
get => color1;
|
||||
set
|
||||
{
|
||||
color1 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The 2nd half color of he gradient")]
|
||||
public Color Color2
|
||||
{
|
||||
get => color2;
|
||||
set
|
||||
{
|
||||
color2 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The 1st text")]
|
||||
public string Text1
|
||||
{
|
||||
get => text1;
|
||||
set
|
||||
{
|
||||
text1 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The 2nd text")]
|
||||
public string Text2
|
||||
{
|
||||
get => text2;
|
||||
set
|
||||
{
|
||||
text2 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The 3rd text")]
|
||||
public string Text3
|
||||
{
|
||||
get => text3;
|
||||
set
|
||||
{
|
||||
text3 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private PixelOffsetMode _PixelOffsetType = PixelOffsetMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public PixelOffsetMode PixelOffsetType
|
||||
{
|
||||
get => _PixelOffsetType;
|
||||
set
|
||||
{
|
||||
_PixelOffsetType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
e.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
|
||||
if (base.Width > base.Height)
|
||||
{
|
||||
int width = base.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
int height = base.Height;
|
||||
}
|
||||
Brush brush = new LinearGradientBrush(base.ClientRectangle, color1, color2, 135f);
|
||||
using (GraphicsPath graphicsPath = new())
|
||||
{
|
||||
graphicsPath.AddArc(base.Width - 10 - 2, 0, 10, 10, 250f, 90f);
|
||||
graphicsPath.AddArc(base.Width - 10 - 2, base.Height - 10, 10, 8, 0f, 90f);
|
||||
graphicsPath.AddArc(0, base.Height - 10 - 2, 8, 10, 90f, 90f);
|
||||
graphicsPath.AddArc(0, 0, 10, 10, 180f, 90f);
|
||||
graphicsPath.CloseFigure();
|
||||
e.Graphics.FillPath(brush, graphicsPath);
|
||||
}
|
||||
StringFormat stringFormat = new()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Near
|
||||
};
|
||||
e.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
e.Graphics.TextRenderingHint = TextRenderingType;
|
||||
Rectangle r = new Rectangle(2, 6, base.Width - 4, 26);
|
||||
e.Graphics.DrawString(text1, new Font(Font.FontFamily, Font.Size + 4f), new SolidBrush(ForeColor), r, stringFormat);
|
||||
stringFormat.Alignment = StringAlignment.Near;
|
||||
r = new Rectangle(2, base.Height / 2, base.Width - 4, base.Height / 4);
|
||||
e.Graphics.DrawString(text2, new Font(Font.FontFamily, Font.Size * 2f + 2f), new SolidBrush(ForeColor), r, stringFormat);
|
||||
stringFormat.Alignment = StringAlignment.Near;
|
||||
r = new Rectangle(2, base.Height / 2 + base.Height / 4, base.Width - 4, base.Height / 4);
|
||||
e.Graphics.DrawString(text3, new Font(Font.FontFamily, Font.Size + 2f), new SolidBrush(ForeColor), r, stringFormat);
|
||||
}
|
||||
|
||||
private Color color1 = Color.FromArgb(20, 20, 20);
|
||||
|
||||
private Color color2 = Color.FromArgb(250, 36, 38);
|
||||
|
||||
private string text1 = "CrEaTiiOn Brotherhood";
|
||||
|
||||
private string text2 = "Enter a message";
|
||||
|
||||
private string text3 = "Theme by EternalModz";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_CheckBox : CheckBox
|
||||
{
|
||||
private Graphics G;
|
||||
public CrEaTiiOn_CheckBox()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
Font = new Font("Segoe UI", 9);
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
base.OnPaint(e);
|
||||
|
||||
G.Clear(Parent.BackColor);
|
||||
|
||||
if (Enabled)
|
||||
{
|
||||
using (SolidBrush Back = new SolidBrush(Color.Transparent))
|
||||
{
|
||||
G.FillPath(Back, Helpers.RoundRect(new Rectangle(0, 0, 16, 16), 1));
|
||||
}
|
||||
|
||||
using (Pen Border = new Pen(Color.FromArgb(250, 36, 38)))
|
||||
{
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, 16, 16), 1));
|
||||
}
|
||||
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.White))
|
||||
{
|
||||
using (Font TextFont = new Font("Segoe UI", 9))
|
||||
{
|
||||
G.DrawString(Text, TextFont, TextBrush, new Point(22, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (Checked)
|
||||
{
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.FromArgb(20, 20, 20)))
|
||||
{
|
||||
using (Font TextFont = new Font("Marlett", 12))
|
||||
{
|
||||
G.DrawString("b", TextFont, TextBrush, new Point(-2, 1));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
using (SolidBrush Back = new SolidBrush(Color.FromArgb(20, 20, 20)))
|
||||
{
|
||||
G.FillPath(Back, Helpers.RoundRect(new Rectangle(0, 0, 16, 16), 1));
|
||||
}
|
||||
|
||||
using (Pen Border = new Pen(Color.FromArgb(36, 36, 35)))
|
||||
{
|
||||
G.DrawPath(Border, Helpers.RoundRect(new Rectangle(0, 0, 16, 16), 1));
|
||||
}
|
||||
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.FromArgb(20, 20, 20)))
|
||||
{
|
||||
using (Font TextFont = new Font("Segoe UI", 9))
|
||||
{
|
||||
G.DrawString(Text, TextFont, TextBrush, new Point(22, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (Checked)
|
||||
{
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.FromArgb(20, 20, 20)))
|
||||
{
|
||||
using (Font TextFont = new Font("Marlett", 12))
|
||||
{
|
||||
G.DrawString("b", TextFont, TextBrush, new Point(-2, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_CheckBox
|
||||
|
||||
public class CrEaTiiOn_CustomCheckBox : Control
|
||||
{
|
||||
public CrEaTiiOn_CustomCheckBox()
|
||||
{
|
||||
base.Size = new Size(100, 20);
|
||||
Text = base.Name;
|
||||
ForeColor = Color.White;
|
||||
currentColor = checkboxColor;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Checked or unchecked")]
|
||||
public bool Checked
|
||||
{
|
||||
get => isChecked;
|
||||
set
|
||||
{
|
||||
isChecked = value;
|
||||
OnCheckedStateChanged();
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Thickness of the tick when checked")]
|
||||
public int TickThickness
|
||||
{
|
||||
get => tickThickness;
|
||||
set
|
||||
{
|
||||
tickThickness = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Checkbox color")]
|
||||
public Color CheckboxColor
|
||||
{
|
||||
get => checkboxColor;
|
||||
set
|
||||
{
|
||||
checkboxColor = value;
|
||||
currentColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Checkbox color")]
|
||||
public Color CheckboxCheckColor
|
||||
{
|
||||
get => checkboxCheckColor;
|
||||
set
|
||||
{
|
||||
checkboxCheckColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Checkbox ios border color")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get => borderColor;
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Checkbox ios badge color")]
|
||||
public Color BadgeColor
|
||||
{
|
||||
get => badgeColor;
|
||||
set
|
||||
{
|
||||
badgeColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Checkbox color when hovering")]
|
||||
public Color CheckboxHoverColor
|
||||
{
|
||||
get => checkboxHoverColor;
|
||||
set
|
||||
{
|
||||
checkboxHoverColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The Checkbox style")]
|
||||
public Style CheckboxStyle
|
||||
{
|
||||
get => checkboxStyle;
|
||||
set
|
||||
{
|
||||
checkboxStyle = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private PixelOffsetMode _PixelOffsetType = PixelOffsetMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public PixelOffsetMode PixelOffsetType
|
||||
{
|
||||
get => _PixelOffsetType;
|
||||
set
|
||||
{
|
||||
_PixelOffsetType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler CheckedStateChanged;
|
||||
|
||||
protected virtual void OnCheckedStateChanged()
|
||||
{
|
||||
CheckedStateChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
base.OnMouseEnter(e);
|
||||
currentColor = checkboxHoverColor;
|
||||
base.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
currentColor = checkboxColor;
|
||||
base.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
base.OnClick(e);
|
||||
if (!Checked)
|
||||
{
|
||||
Checked = true;
|
||||
return;
|
||||
}
|
||||
Checked = false;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingType;
|
||||
if (checkboxStyle == Style.Material)
|
||||
{
|
||||
e.Graphics.FillRectangle(new SolidBrush(currentColor), 1, 1, base.Height - 2, base.Height - 2);
|
||||
if (isChecked)
|
||||
{
|
||||
e.Graphics.DrawLine(new Pen(checkboxCheckColor, tickThickness), 2, base.Height / 3 * 2, base.Height / 2, base.Height - 2);
|
||||
e.Graphics.DrawLine(new Pen(checkboxCheckColor, tickThickness), base.Height / 2, base.Height - 2, base.Height - 2, 1);
|
||||
}
|
||||
}
|
||||
if (checkboxStyle == Style.iOS)
|
||||
{
|
||||
if (!isChecked)
|
||||
{
|
||||
e.Graphics.DrawEllipse(new Pen(BorderColor), 2, 2, base.Height - 4, base.Height - 4);
|
||||
}
|
||||
if (isChecked)
|
||||
{
|
||||
e.Graphics.FillEllipse(new SolidBrush(BadgeColor), 1, 1, base.Height - 2, base.Height - 2);
|
||||
e.Graphics.DrawLine(new Pen(checkboxCheckColor, tickThickness), base.Height / 5, base.Height / 2, base.Height / 2, base.Height / 4 * 3);
|
||||
e.Graphics.DrawLine(new Pen(checkboxCheckColor, tickThickness), base.Height / 2, base.Height / 4 * 3, base.Height / 5 * 4, base.Height / 4);
|
||||
}
|
||||
}
|
||||
StringFormat stringFormat = new()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Near
|
||||
};
|
||||
SolidBrush brush = new(ForeColor);
|
||||
RectangleF layoutRectangle = new(base.Height + 3, 0f, base.Width - base.Height - 2, Height);
|
||||
e.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
e.Graphics.TextRenderingHint = TextRenderingType;
|
||||
e.Graphics.DrawString(Text, Font, brush, layoutRectangle, stringFormat);
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
private bool isChecked;
|
||||
|
||||
private int tickThickness = 2;
|
||||
|
||||
private Color checkboxColor = Color.FromArgb(15, 15, 15);
|
||||
|
||||
private Color checkboxCheckColor = Color.FromArgb(250, 36, 38);
|
||||
|
||||
private Color checkboxHoverColor = Color.FromArgb(155, 41, 43);
|
||||
|
||||
private Style checkboxStyle = Style.Material;
|
||||
|
||||
private Color currentColor;
|
||||
|
||||
private Color borderColor = Color.FromArgb(20, 20, 20);
|
||||
|
||||
private Color badgeColor = Color.FromArgb(10, 10, 10);
|
||||
|
||||
public enum Style
|
||||
{
|
||||
iOS,
|
||||
Material
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_FlatCheckBox
|
||||
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_FlatCheckBox : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
private int X;
|
||||
private bool _Enable = true;
|
||||
private bool _Checked = false;
|
||||
private GraphicsPath Shape;
|
||||
private Color _CheckedEnabledColor = Color.FromArgb(250, 36, 38);
|
||||
private Color _CheckedDisabledColor = Color.Gray;
|
||||
private Color _CheckedBorderColor = Color.FromArgb(250, 36, 38);
|
||||
private Color _CheckedBackColor = Color.FromArgb(20, 20, 20);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get => _Checked;
|
||||
set
|
||||
{
|
||||
_Checked = value;
|
||||
CheckedChangedEvent?.Invoke(this);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Enable
|
||||
{
|
||||
get => _Enable;
|
||||
set
|
||||
{
|
||||
_Enable = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color CheckedEnabledColor
|
||||
{
|
||||
get => _CheckedEnabledColor;
|
||||
set => _CheckedEnabledColor = value;
|
||||
}
|
||||
|
||||
public Color CheckedDisabledColor
|
||||
{
|
||||
get => _CheckedDisabledColor;
|
||||
set => _CheckedDisabledColor = value;
|
||||
}
|
||||
|
||||
public Color CheckedBorderColor
|
||||
{
|
||||
get => _CheckedBorderColor;
|
||||
set => _CheckedBorderColor = value;
|
||||
}
|
||||
|
||||
public Color CheckedBackColor
|
||||
{
|
||||
get => _CheckedBackColor;
|
||||
set => _CheckedBackColor = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
private CheckedChangedEventHandler CheckedChangedEvent;
|
||||
|
||||
public event CheckedChangedEventHandler CheckedChanged
|
||||
{
|
||||
add => CheckedChangedEvent = (CheckedChangedEventHandler)Delegate.Combine(CheckedChangedEvent, value);
|
||||
remove => CheckedChangedEvent = (CheckedChangedEventHandler)Delegate.Remove(CheckedChangedEvent, value);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
X = e.Location.X;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
if (_Enable)
|
||||
{
|
||||
Checked = !Checked;
|
||||
Focus();
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
Height = 16;
|
||||
|
||||
Shape = new();
|
||||
Shape.AddArc(0, 0, 10, 10, 180, 90);
|
||||
Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
|
||||
Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
|
||||
Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
|
||||
Shape.CloseAllFigures();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_FlatCheckBox()
|
||||
{
|
||||
Width = 85;
|
||||
Height = 16;
|
||||
Font = new("Segoe UI", 9);
|
||||
DoubleBuffered = true;
|
||||
Cursor = Cursors.Hand;
|
||||
ForeColor = Color.White;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Graphics G = e.Graphics;
|
||||
G.Clear(BackColor);
|
||||
|
||||
if (_Checked)
|
||||
{
|
||||
G.FillRectangle(new SolidBrush(_CheckedBorderColor), new Rectangle(0, 0, 16, 16));
|
||||
G.FillRectangle(new SolidBrush(_CheckedBackColor), new Rectangle(1, 1, 16 - 2, 16 - 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
G.FillRectangle(new SolidBrush(_CheckedBorderColor), new Rectangle(0, 0, 16, 16));
|
||||
G.FillRectangle(new SolidBrush(_CheckedBackColor), new Rectangle(1, 1, 16 - 2, 16 - 2));
|
||||
}
|
||||
|
||||
if (_Enable)
|
||||
{
|
||||
if (_Checked)
|
||||
{
|
||||
G.DrawString("a", new Font("Marlett", 16), new SolidBrush(_CheckedEnabledColor), new Point(-5, -3));
|
||||
}
|
||||
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_Checked)
|
||||
{
|
||||
G.DrawString("a", new Font("Marlett", 16), new SolidBrush(_CheckedDisabledColor), new Point(-5, -3));
|
||||
}
|
||||
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), new Point(20, 0));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_LightCheckBox : Control
|
||||
{
|
||||
|
||||
#region "CreateRound"
|
||||
private GraphicsPath CreateRoundPath;
|
||||
|
||||
private Rectangle CreateRoundRectangle;
|
||||
public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
|
||||
{
|
||||
CreateRoundRectangle = new Rectangle(x, y, width, height);
|
||||
return CreateRound(CreateRoundRectangle, slope);
|
||||
}
|
||||
|
||||
public GraphicsPath CreateRound(Rectangle r, int slope)
|
||||
{
|
||||
CreateRoundPath = new GraphicsPath(FillMode.Winding);
|
||||
CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
|
||||
CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
|
||||
CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
|
||||
CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
|
||||
CreateRoundPath.CloseFigure();
|
||||
return CreateRoundPath;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "Mouse states"
|
||||
private MouseStates State;
|
||||
private int X;
|
||||
public enum MouseStates
|
||||
{
|
||||
None = 0,
|
||||
Over = 1,
|
||||
Down = 2
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
State = MouseStates.Over;
|
||||
Invalidate();
|
||||
base.OnMouseEnter(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
State = MouseStates.None;
|
||||
X = -1;
|
||||
Invalidate();
|
||||
base.OnMouseEnter(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
State = MouseStates.Down;
|
||||
Invalidate();
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
X = e.X;
|
||||
Invalidate();
|
||||
base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
State = MouseStates.Over;
|
||||
Invalidate();
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
base.OnClick(null);
|
||||
_Checked = !_Checked;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
//Do nothing here or it fires twice
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "Properties"
|
||||
|
||||
public event CheckedChangedEventHandler CheckedChanged;
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
|
||||
private bool _Checked;
|
||||
public bool Checked
|
||||
{
|
||||
get { return _Checked; }
|
||||
set
|
||||
{
|
||||
_Checked = value;
|
||||
if (CheckedChanged != null)
|
||||
{
|
||||
CheckedChanged(this);
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public enum SliderLocations
|
||||
{
|
||||
Left = 0,
|
||||
Right = 1
|
||||
}
|
||||
|
||||
private SliderLocations _SliderLocation = SliderLocations.Right;
|
||||
public SliderLocations SliderLocation
|
||||
{
|
||||
get { return _SliderLocation; }
|
||||
set
|
||||
{
|
||||
_SliderLocation = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_LightCheckBox()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
|
||||
Font = new Font("Segoe UI", 9);
|
||||
ForeColor = Color.White;
|
||||
BackColor = Color.Transparent;
|
||||
Size = new Size(150, 21);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
|
||||
Brush LGB = default(Brush);
|
||||
|
||||
if (X >= 0 & X < 17)
|
||||
{
|
||||
switch (State)
|
||||
{
|
||||
case MouseStates.None:
|
||||
LGB = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(20, 20, 20), Color.FromArgb(25, 25, 25), 90f);
|
||||
break;
|
||||
case MouseStates.Over:
|
||||
LGB = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(20, 20, 20), Color.FromArgb(25, 25, 25), 90f);
|
||||
break;
|
||||
default:
|
||||
LGB = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(20, 20, 20), Color.FromArgb(10, 10, 10), 90f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LGB = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(20, 20, 20), Color.FromArgb(25, 25, 25), 90f);
|
||||
}
|
||||
e.Graphics.FillPath(LGB, CreateRound(1, 2, 15, 15, 7));
|
||||
|
||||
if (_Checked)
|
||||
{
|
||||
e.Graphics.DrawString("a", new Font("Marlett", 13), Brushes.Red, new Point(-2, 1));
|
||||
}
|
||||
|
||||
e.Graphics.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(20, 0, Width - 21, Height - 1), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Near,
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Trimming = StringTrimming.EllipsisCharacter
|
||||
});
|
||||
base.OnPaint(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_MetroCheckBox
|
||||
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_MetroCheckBox : Control
|
||||
{
|
||||
|
||||
#region " Control Help - MouseState & Flicker Control"
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
private bool _Checked = false;
|
||||
public bool Checked
|
||||
{
|
||||
get => _Checked;
|
||||
set
|
||||
{
|
||||
_Checked = value;
|
||||
CheckedChangedEvent?.Invoke(this);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private CompositingQuality _CompositingQualityType = CompositingQuality.HighQuality;
|
||||
public CompositingQuality CompositingQualityType
|
||||
{
|
||||
get => _CompositingQualityType;
|
||||
set
|
||||
{
|
||||
_CompositingQualityType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.AntiAliasGridFit;
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _BaseColor = Color.Transparent;
|
||||
public Color BaseColor
|
||||
{
|
||||
get => _BaseColor;
|
||||
set
|
||||
{
|
||||
_BaseColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckedColor = Color.FromArgb(250, 36, 38);
|
||||
public Color CheckedColor
|
||||
{
|
||||
get => _CheckedColor;
|
||||
set
|
||||
{
|
||||
_CheckedColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckBorderColorA = Color.FromArgb(20, 20, 20);
|
||||
public Color CheckBorderColorA
|
||||
{
|
||||
get => _CheckBorderColorA;
|
||||
set
|
||||
{
|
||||
_CheckBorderColorA = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckBorderColorB = Color.FromArgb(20, 20, 20);
|
||||
public Color CheckBorderColorB
|
||||
{
|
||||
get => _CheckBorderColorB;
|
||||
set
|
||||
{
|
||||
_CheckBorderColorB = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckBackColorA = Color.Transparent;
|
||||
public Color CheckBackColorA
|
||||
{
|
||||
get => _CheckBackColorA;
|
||||
set
|
||||
{
|
||||
_CheckBackColorA = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckBackColorB = Color.Transparent;
|
||||
public Color CheckBackColorB
|
||||
{
|
||||
get => _CheckBackColorB;
|
||||
set
|
||||
{
|
||||
_CheckBackColorB = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = 14;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
Checked = !Checked;
|
||||
Focus();
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
private CheckedChangedEventHandler CheckedChangedEvent;
|
||||
|
||||
public event CheckedChangedEventHandler CheckedChanged
|
||||
{
|
||||
add => CheckedChangedEvent = (CheckedChangedEventHandler)Delegate.Combine(CheckedChangedEvent, value);
|
||||
remove => CheckedChangedEvent = (CheckedChangedEventHandler)Delegate.Remove(CheckedChangedEvent, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_MetroCheckBox() : base()
|
||||
{
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
Size = new(120, 16);
|
||||
DoubleBuffered = true;
|
||||
Font = new("Segoe UI", 8, FontStyle.Bold);
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
Rectangle checkBoxRectangle = new(0, 0, Height, Height - 1);
|
||||
Rectangle Inner = new(1, 1, Height - 2, Height - 3);
|
||||
|
||||
G.SmoothingMode = SmoothingType;
|
||||
G.CompositingQuality = CompositingQualityType;
|
||||
G.TextRenderingHint = TextRenderingType;
|
||||
|
||||
G.Clear(BaseColor);
|
||||
|
||||
LinearGradientBrush bodyGrad = new(checkBoxRectangle, CheckBackColorA, CheckBackColorB, 90);
|
||||
G.FillRectangle(bodyGrad, bodyGrad.Rectangle);
|
||||
G.DrawRectangle(new(CheckBorderColorA), checkBoxRectangle);
|
||||
G.DrawRectangle(new(CheckBorderColorB), Inner);
|
||||
|
||||
if (Checked)
|
||||
{
|
||||
Font t = new("Marlett", 10, FontStyle.Regular);
|
||||
G.DrawString("a", t, new SolidBrush(CheckedColor), -1.5F, 0F);
|
||||
}
|
||||
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), new Point(18, 7), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Near,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
|
||||
e.Graphics.DrawImage(B, 0, 0);
|
||||
G.Dispose();
|
||||
B.Dispose();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ModernCheckBox
|
||||
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_ModernCheckBox : Control
|
||||
{
|
||||
|
||||
#region Variables
|
||||
|
||||
private GraphicsPath Shape;
|
||||
private LinearGradientBrush GB;
|
||||
private Rectangle R1;
|
||||
private Rectangle R2;
|
||||
private bool _Checked;
|
||||
private Color _CheckedColor = Color.FromArgb(250, 36, 38);
|
||||
private Color _CheckedBackColorA = Color.FromArgb(20, 20, 20);
|
||||
private Color _CheckedBackColorB = Color.FromArgb(15, 15, 15);
|
||||
private Color _CheckedBorderColor = Color.FromArgb(250, 36, 38);
|
||||
public event CheckedChangedEventHandler CheckedChanged;
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get => _Checked;
|
||||
set
|
||||
{
|
||||
_Checked = value;
|
||||
CheckedChanged?.Invoke(this);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color CheckedColor
|
||||
{
|
||||
get => _CheckedColor;
|
||||
set => _CheckedColor = value;
|
||||
}
|
||||
|
||||
public Color CheckedBackColorA
|
||||
{
|
||||
get => _CheckedBackColorA;
|
||||
set => _CheckedBackColorA = value;
|
||||
}
|
||||
|
||||
public Color CheckedBackColorB
|
||||
{
|
||||
get => _CheckedBackColorB;
|
||||
set => _CheckedBackColorB = value;
|
||||
}
|
||||
|
||||
public Color CheckedBorderColor
|
||||
{
|
||||
get => _CheckedBorderColor;
|
||||
set => _CheckedBorderColor = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_ModernCheckBox()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
|
||||
|
||||
BackColor = Color.Transparent;
|
||||
DoubleBuffered = true;
|
||||
// Reduce control flicker
|
||||
Font = new("Segoe UI", 12);
|
||||
Size = new(160, 26);
|
||||
ForeColor = Color.White;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
_Checked = !_Checked;
|
||||
CheckedChanged?.Invoke(this);
|
||||
Focus();
|
||||
Invalidate();
|
||||
base.OnClick(e);
|
||||
}
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
if (Width > 0 && Height > 0)
|
||||
{
|
||||
Shape = new();
|
||||
|
||||
R1 = new(17, 0, Width, Height + 1);
|
||||
R2 = new(0, 0, Width, Height);
|
||||
GB = new(new Rectangle(0, 0, 25, 25), _CheckedBackColorA, _CheckedBackColorB, 90);
|
||||
|
||||
GraphicsPath MyDrawer = Shape;
|
||||
MyDrawer.AddArc(0, 0, 7, 7, 180, 90);
|
||||
MyDrawer.AddArc(7, 0, 7, 7, -90, 90);
|
||||
MyDrawer.AddArc(7, 7, 7, 7, 0, 90);
|
||||
MyDrawer.AddArc(0, 7, 7, 7, 90, 90);
|
||||
MyDrawer.CloseAllFigures();
|
||||
Height = 15;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
base.OnResize(e);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics MyDrawer = e.Graphics;
|
||||
MyDrawer.Clear(BackColor);
|
||||
MyDrawer.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
MyDrawer.FillPath(GB, Shape);
|
||||
// Fill the body of the CheckBox
|
||||
MyDrawer.DrawPath(new(_CheckedBorderColor), Shape);
|
||||
// Draw the border
|
||||
|
||||
MyDrawer.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(17, 0, Width, Height - 1), new StringFormat { LineAlignment = StringAlignment.Center });
|
||||
|
||||
if (Checked)
|
||||
{
|
||||
MyDrawer.DrawString("ü", new Font("Wingdings", 12), new SolidBrush(_CheckedColor), new Rectangle(-2, 1, Width, Height + 2), new StringFormat { LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
e.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_RoundCheckBox : Control
|
||||
{
|
||||
|
||||
public event CheckedChangedEventHandler CheckedChanged;
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
|
||||
private bool _checked;
|
||||
public bool Checked {
|
||||
get { return _checked; }
|
||||
set {
|
||||
_checked = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_RoundCheckBox()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.ResizeRedraw, true);
|
||||
Size = new Size(120, 17);
|
||||
Font = new Font("Segoe UI", 9);
|
||||
}
|
||||
|
||||
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics G = e.Graphics;
|
||||
G.SmoothingMode = SmoothingMode.HighQuality;
|
||||
G.Clear(Parent.BackColor);
|
||||
|
||||
Height = 17;
|
||||
|
||||
Rectangle boxRect = new Rectangle(1, 1, Height - 3, Height - 3);
|
||||
G.DrawEllipse(new Pen(Color.FromArgb(250, 36, 38), 2), boxRect);
|
||||
|
||||
int textY = ((Height - 1) / 2) - Convert.ToInt32((G.MeasureString(Text, Font).Height / 2));
|
||||
G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(160, 160, 160)), new Point((Height - 1) + 4, textY));
|
||||
|
||||
if (_checked)
|
||||
G.DrawString("a", new Font("Marlett", 17), new SolidBrush(Color.FromArgb(120, 180, 255)), new Point(-3, -5));
|
||||
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
|
||||
if (_checked) {
|
||||
_checked = false;
|
||||
} else {
|
||||
_checked = true;
|
||||
}
|
||||
|
||||
if (CheckedChanged != null) {
|
||||
CheckedChanged(this);
|
||||
}
|
||||
Invalidate();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,383 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
[DefaultEvent("OnSelectedIndexChanged")]
|
||||
public class CrEaTiiOn_ComboBox : UserControl
|
||||
{
|
||||
//Fields
|
||||
private Color backColor = Color.FromArgb(20, 20, 20);
|
||||
private Color iconColor = Color.FromArgb(250, 36, 38);
|
||||
private Color listBackColor = Color.FromArgb(15, 15, 15);
|
||||
private Color listTextColor = Color.Silver;
|
||||
private Color borderColor = Color.FromArgb(250, 36, 38);
|
||||
private int borderSize = 1;
|
||||
|
||||
//Items
|
||||
private System.Windows.Forms.ComboBox cmbList;
|
||||
private System.Windows.Forms.Label lblText;
|
||||
private Button btnIcon;
|
||||
|
||||
//Events
|
||||
public event EventHandler OnSelectedIndexChanged;//Default event
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_ComboBox()
|
||||
{
|
||||
cmbList = new System.Windows.Forms.ComboBox();
|
||||
lblText = new System.Windows.Forms.Label();
|
||||
btnIcon = new Button();
|
||||
this.SuspendLayout();
|
||||
|
||||
//ComboBox: Dropdown list
|
||||
cmbList.BackColor = listBackColor;
|
||||
cmbList.Font = new Font(this.Font.Name, 10F);
|
||||
cmbList.ForeColor = listTextColor;
|
||||
cmbList.SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);//Default event
|
||||
cmbList.TextChanged += new EventHandler(ComboBox_TextChanged);//Refresh text
|
||||
|
||||
//Button: Icon
|
||||
btnIcon.Dock = DockStyle.Right;
|
||||
btnIcon.FlatStyle = FlatStyle.Flat;
|
||||
btnIcon.FlatAppearance.BorderSize = 0;
|
||||
btnIcon.BackColor = backColor;
|
||||
btnIcon.Size = new Size(30, 30);
|
||||
btnIcon.Cursor = Cursors.Hand;
|
||||
btnIcon.Click += new EventHandler(Icon_Click);//Open dropdown list
|
||||
btnIcon.Paint += new PaintEventHandler(Icon_Paint);//Draw icon
|
||||
|
||||
//Label: Text
|
||||
lblText.Dock = DockStyle.Fill;
|
||||
lblText.AutoSize = false;
|
||||
lblText.BackColor = backColor;
|
||||
lblText.TextAlign = ContentAlignment.MiddleLeft;
|
||||
lblText.Padding = new Padding(8, 0, 0, 0);
|
||||
lblText.Font = new Font(this.Font.Name, 10F);
|
||||
//->Attach label events to user control event
|
||||
lblText.Click += new EventHandler(Surface_Click);//Select combo box
|
||||
lblText.MouseEnter += new EventHandler(Surface_MouseEnter);
|
||||
lblText.MouseLeave += new EventHandler(Surface_MouseLeave);
|
||||
|
||||
//User Control
|
||||
this.Controls.Add(lblText);//2
|
||||
this.Controls.Add(btnIcon);//1
|
||||
this.Controls.Add(cmbList);//0
|
||||
this.MinimumSize = new Size(200, 30);
|
||||
this.Size = new Size(200, 30);
|
||||
this.ForeColor = Color.DimGray;
|
||||
this.Padding = new Padding(borderSize);//Border Size
|
||||
this.Font = new Font(this.Font.Name, 10F);
|
||||
base.BackColor = borderColor; //Border Color
|
||||
this.ResumeLayout();
|
||||
AdjustComboBoxDimensions();
|
||||
}
|
||||
|
||||
//Properties
|
||||
//-> Appearance
|
||||
[Category("CrEaTiiOn")]
|
||||
public new Color BackColor
|
||||
{
|
||||
get { return backColor; }
|
||||
set
|
||||
{
|
||||
backColor = value;
|
||||
lblText.BackColor = backColor;
|
||||
btnIcon.BackColor = backColor;
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public Color IconColor
|
||||
{
|
||||
get { return iconColor; }
|
||||
set
|
||||
{
|
||||
iconColor = value;
|
||||
btnIcon.Invalidate();//Redraw icon
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public Color ListBackColor
|
||||
{
|
||||
get { return listBackColor; }
|
||||
set
|
||||
{
|
||||
listBackColor = value;
|
||||
cmbList.BackColor = listBackColor;
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public Color ListTextColor
|
||||
{
|
||||
get { return listTextColor; }
|
||||
set
|
||||
{
|
||||
listTextColor = value;
|
||||
cmbList.ForeColor = listTextColor;
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
base.BackColor = borderColor; //Border Color
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public int BorderSize
|
||||
{
|
||||
get { return borderSize; }
|
||||
set
|
||||
{
|
||||
borderSize = value;
|
||||
this.Padding = new Padding(borderSize);//Border Size
|
||||
AdjustComboBoxDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public override Color ForeColor
|
||||
{
|
||||
get { return base.ForeColor; }
|
||||
set
|
||||
{
|
||||
base.ForeColor = value;
|
||||
lblText.ForeColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public override Font Font
|
||||
{
|
||||
get { return base.Font; }
|
||||
set
|
||||
{
|
||||
base.Font = value;
|
||||
lblText.Font = value;
|
||||
cmbList.Font = value;//Optional
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public string Texts
|
||||
{
|
||||
get { return lblText.Text; }
|
||||
set { lblText.Text = value; }
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
public ComboBoxStyle DropDownStyle
|
||||
{
|
||||
get { return cmbList.DropDownStyle; }
|
||||
set
|
||||
{
|
||||
if (cmbList.DropDownStyle != ComboBoxStyle.Simple)
|
||||
cmbList.DropDownStyle = value;
|
||||
}
|
||||
}
|
||||
//Properties
|
||||
//-> Data
|
||||
[Category("RJ Code - Data")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||
[Localizable(true)]
|
||||
[MergableProperty(false)]
|
||||
public System.Windows.Forms.ComboBox.ObjectCollection Items
|
||||
{
|
||||
get { return cmbList.Items; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[AttributeProvider(typeof(IListSource))]
|
||||
[DefaultValue(null)]
|
||||
public object DataSource
|
||||
{
|
||||
get { return cmbList.DataSource; }
|
||||
set { cmbList.DataSource = value; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
[Localizable(true)]
|
||||
public AutoCompleteStringCollection AutoCompleteCustomSource
|
||||
{
|
||||
get { return cmbList.AutoCompleteCustomSource; }
|
||||
set { cmbList.AutoCompleteCustomSource = value; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[Browsable(true)]
|
||||
[DefaultValue(AutoCompleteSource.None)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
public AutoCompleteSource AutoCompleteSource
|
||||
{
|
||||
get { return cmbList.AutoCompleteSource; }
|
||||
set { cmbList.AutoCompleteSource = value; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[Browsable(true)]
|
||||
[DefaultValue(AutoCompleteMode.None)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
public AutoCompleteMode AutoCompleteMode
|
||||
{
|
||||
get { return cmbList.AutoCompleteMode; }
|
||||
set { cmbList.AutoCompleteMode = value; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[Bindable(true)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public object SelectedItem
|
||||
{
|
||||
get { return cmbList.SelectedItem; }
|
||||
set { cmbList.SelectedItem = value; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int SelectedIndex
|
||||
{
|
||||
get { return cmbList.SelectedIndex; }
|
||||
set { cmbList.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[DefaultValue("")]
|
||||
[Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||
[TypeConverter("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
|
||||
public string DisplayMember
|
||||
{
|
||||
get { return cmbList.DisplayMember; }
|
||||
set { cmbList.DisplayMember = value; }
|
||||
}
|
||||
|
||||
[Category("RJ Code - Data")]
|
||||
[DefaultValue("")]
|
||||
[Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||
public string ValueMember
|
||||
{
|
||||
get { return cmbList.ValueMember; }
|
||||
set { cmbList.ValueMember = value; }
|
||||
}
|
||||
|
||||
//Private methods
|
||||
private void AdjustComboBoxDimensions()
|
||||
{
|
||||
cmbList.Width = lblText.Width;
|
||||
cmbList.Location = new Point()
|
||||
{
|
||||
X = this.Width - this.Padding.Right - cmbList.Width,
|
||||
Y = lblText.Bottom - cmbList.Height
|
||||
};
|
||||
}
|
||||
|
||||
//Event methods
|
||||
|
||||
//-> Default event
|
||||
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (OnSelectedIndexChanged != null)
|
||||
OnSelectedIndexChanged.Invoke(sender, e);
|
||||
//Refresh text
|
||||
lblText.Text = cmbList.Text;
|
||||
}
|
||||
|
||||
//-> Draw icon
|
||||
private void Icon_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
//Fields
|
||||
int iconWidht = 14;
|
||||
int iconHeight = 6;
|
||||
var rectIcon = new Rectangle((btnIcon.Width - iconWidht) / 2, (btnIcon.Height - iconHeight) / 2, iconWidht, iconHeight);
|
||||
Graphics graph = e.Graphics;
|
||||
|
||||
//Draw arrow down icon
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
using (Pen pen = new Pen(iconColor, 2))
|
||||
{
|
||||
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
path.AddLine(rectIcon.X, rectIcon.Y, rectIcon.X + (iconWidht / 2), rectIcon.Bottom);
|
||||
path.AddLine(rectIcon.X + (iconWidht / 2), rectIcon.Bottom, rectIcon.Right, rectIcon.Y);
|
||||
graph.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
|
||||
//-> Items actions
|
||||
private void Icon_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Open dropdown list
|
||||
cmbList.Select();
|
||||
cmbList.DroppedDown = true;
|
||||
}
|
||||
private void Surface_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Attach label click to user control click
|
||||
this.OnClick(e);
|
||||
//Select combo box
|
||||
cmbList.Select();
|
||||
if (cmbList.DropDownStyle == ComboBoxStyle.DropDownList)
|
||||
cmbList.DroppedDown = true;//Open dropdown list
|
||||
}
|
||||
private void ComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//Refresh text
|
||||
lblText.Text = cmbList.Text;
|
||||
}
|
||||
|
||||
//->Attach label events to user control event
|
||||
private void Surface_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
this.OnMouseLeave(e);
|
||||
}
|
||||
|
||||
private void Surface_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
this.OnMouseEnter(e);
|
||||
}
|
||||
//::::+
|
||||
|
||||
//Overridden methods
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
AdjustComboBoxDimensions();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ComboBox
|
||||
//
|
||||
this.Name = "ComboBox";
|
||||
this.Load += new System.EventHandler(this.ComboBox_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
private void ComboBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,338 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ControlBox
|
||||
|
||||
public class CrEaTiiOn_ControlBox : Control
|
||||
{
|
||||
#region Enums
|
||||
|
||||
public enum ButtonHoverState
|
||||
{
|
||||
Minimize,
|
||||
Maximize,
|
||||
Close,
|
||||
None
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Variables
|
||||
|
||||
private ButtonHoverState ButtonHState = ButtonHoverState.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
private bool _DefaultLocation = true;
|
||||
public bool DefaultLocation
|
||||
{
|
||||
get => _DefaultLocation;
|
||||
set
|
||||
{
|
||||
_DefaultLocation = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _EnableMaximize = true;
|
||||
public bool EnableMaximizeButton
|
||||
{
|
||||
get => _EnableMaximize;
|
||||
set
|
||||
{
|
||||
_EnableMaximize = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _EnableMinimize = true;
|
||||
public bool EnableMinimizeButton
|
||||
{
|
||||
get => _EnableMinimize;
|
||||
set
|
||||
{
|
||||
_EnableMinimize = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _EnableHoverHighlight = false;
|
||||
public bool EnableHoverHighlight
|
||||
{
|
||||
get => _EnableHoverHighlight;
|
||||
set
|
||||
{
|
||||
_EnableHoverHighlight = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _MinimizeHoverColor = Color.FromArgb(63, 63, 65);
|
||||
public Color MinimizeHoverColor
|
||||
{
|
||||
get => _MinimizeHoverColor;
|
||||
set => _MinimizeHoverColor = value;
|
||||
}
|
||||
|
||||
private Color _MaximizeHoverColor = Color.FromArgb(74, 74, 74);
|
||||
public Color MaximizeHoverColor
|
||||
{
|
||||
get => _MaximizeHoverColor;
|
||||
set => _MaximizeHoverColor = value;
|
||||
}
|
||||
|
||||
private Color _CloseHoverColor = Color.FromArgb(230, 17, 35);
|
||||
public Color CloseHoverColor
|
||||
{
|
||||
get => _CloseHoverColor;
|
||||
set => _CloseHoverColor = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Size = new(90, 25);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
int X = e.Location.X;
|
||||
int Y = e.Location.Y;
|
||||
if (Y > 0 && Y < Height)
|
||||
{
|
||||
if (X >= 0 && X <= 30)
|
||||
{
|
||||
ButtonHState = ButtonHoverState.Minimize;
|
||||
if (_EnableMinimize == true)
|
||||
{
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor = Cursors.No;
|
||||
}
|
||||
}
|
||||
else if (X > 30 && X <= 60)
|
||||
{
|
||||
ButtonHState = ButtonHoverState.Maximize;
|
||||
if (_EnableMaximize == true)
|
||||
{
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor = Cursors.No;
|
||||
}
|
||||
}
|
||||
else if (X > 60 && X < Width)
|
||||
{
|
||||
ButtonHState = ButtonHoverState.Close;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
else
|
||||
{
|
||||
ButtonHState = ButtonHoverState.None;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ButtonHState = ButtonHoverState.None;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
switch (ButtonHState)
|
||||
{
|
||||
case ButtonHoverState.Close:
|
||||
Parent.FindForm().Close();
|
||||
break;
|
||||
case ButtonHoverState.Minimize:
|
||||
if (_EnableMinimize == true)
|
||||
{
|
||||
Parent.FindForm().WindowState = FormWindowState.Minimized;
|
||||
/*foreach (Form Form in Application.OpenForms)
|
||||
Form.WindowState = FormWindowState.Minimized;*/
|
||||
}
|
||||
break;
|
||||
case ButtonHoverState.Maximize:
|
||||
if (_EnableMaximize == true)
|
||||
{
|
||||
if (Parent.FindForm().WindowState == FormWindowState.Normal)
|
||||
{
|
||||
Parent.FindForm().WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
Parent.FindForm().WindowState = FormWindowState.Normal;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
ButtonHState = ButtonHoverState.None;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
Focus();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_ControlBox() : base()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
EnableHoverHighlight = true;
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
Cursor = Cursors.Hand;
|
||||
BackColor = Color.FromArgb(15, 15, 15);
|
||||
ForeColor = Color.FromArgb(155, 155, 155);
|
||||
}
|
||||
|
||||
protected override void OnCreateControl()
|
||||
{
|
||||
base.OnCreateControl();
|
||||
try
|
||||
{
|
||||
if (DefaultLocation)
|
||||
{
|
||||
Location = new(Parent.Width - 100, 18);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Graphics G = e.Graphics;
|
||||
G.Clear(base.BackColor);
|
||||
|
||||
//Close
|
||||
G.DrawString("r", new Font("Marlett", 12), new SolidBrush(base.ForeColor), new Point(75, 5), new StringFormat { Alignment = StringAlignment.Center });
|
||||
|
||||
//Maximize
|
||||
switch (Parent.FindForm().WindowState)
|
||||
{
|
||||
case FormWindowState.Maximized:
|
||||
if (_EnableMaximize == true)
|
||||
{
|
||||
G.DrawString("2", new Font("Marlett", 12), new SolidBrush(base.ForeColor), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString("2", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(55, 60, 50)), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
break;
|
||||
case FormWindowState.Normal:
|
||||
if (_EnableMaximize == true)
|
||||
{
|
||||
G.DrawString("1", new Font("Marlett", 12), new SolidBrush(base.ForeColor), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString("1", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(55, 60, 50)), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//Minimize
|
||||
if (_EnableMinimize == true)
|
||||
{
|
||||
G.DrawString("0", new Font("Marlett", 12), new SolidBrush(base.ForeColor), new Point(17, 0), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString("0", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(55, 60, 50)), new Point(17, 0), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
if (_EnableHoverHighlight == true)
|
||||
{
|
||||
switch (ButtonHState)
|
||||
{
|
||||
/*case ButtonHoverState.None:
|
||||
G.Clear(base.BackColor);
|
||||
break;*/
|
||||
case ButtonHoverState.Minimize:
|
||||
if (_EnableMinimize == true)
|
||||
{
|
||||
G.FillRectangle(new SolidBrush(_MinimizeHoverColor), new Rectangle(0, 0, 30, Height));
|
||||
G.DrawString("0", new Font("Marlett", 12), new SolidBrush(Color.White), new Point(17, 0), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString("0", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(55, 60, 50)), new Point(17, 0), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
break;
|
||||
case ButtonHoverState.Maximize:
|
||||
switch (Parent.FindForm().WindowState)
|
||||
{
|
||||
case FormWindowState.Maximized:
|
||||
if (_EnableMaximize == true)
|
||||
{
|
||||
G.FillRectangle(new SolidBrush(_MaximizeHoverColor), new Rectangle(30, 0, 30, Height));
|
||||
G.DrawString("2", new Font("Marlett", 12), new SolidBrush(Color.White), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString("2", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(55, 60, 50)), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
break;
|
||||
case FormWindowState.Normal:
|
||||
if (_EnableMaximize == true)
|
||||
{
|
||||
G.FillRectangle(new SolidBrush(_MaximizeHoverColor), new Rectangle(30, 0, 30, Height));
|
||||
G.DrawString("1", new Font("Marlett", 12), new SolidBrush(Color.White), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString("1", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(55, 60, 50)), new Point(46, 4), new StringFormat { Alignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ButtonHoverState.Close:
|
||||
G.FillRectangle(new SolidBrush(_CloseHoverColor), new Rectangle(60, 0, 30, Height));
|
||||
G.DrawString("r", new Font("Marlett", 12), new SolidBrush(Color.White), new Point(75, 5), new StringFormat { Alignment = StringAlignment.Center });
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace Zeroit.CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatControlBox : Control
|
||||
{
|
||||
public enum ColorSchemes
|
||||
{
|
||||
Dark
|
||||
}
|
||||
public event ColorSchemeChangedEventHandler ColorSchemeChanged;
|
||||
public delegate void ColorSchemeChangedEventHandler();
|
||||
private ColorSchemes _ColorScheme;
|
||||
public ColorSchemes ColorScheme
|
||||
{
|
||||
get { return _ColorScheme; }
|
||||
set
|
||||
{
|
||||
_ColorScheme = value;
|
||||
if (ColorSchemeChanged != null)
|
||||
{
|
||||
ColorSchemeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void OnColorSchemeChanged()
|
||||
{
|
||||
Invalidate();
|
||||
switch (ColorScheme)
|
||||
{
|
||||
case ColorSchemes.Dark:
|
||||
BackColor = Color.FromArgb(15, 15, 15);
|
||||
ForeColor = Color.White;
|
||||
AccentColor = Color.FromArgb(60, 60, 60);
|
||||
break;
|
||||
}
|
||||
}
|
||||
private Color _AccentColor;
|
||||
public Color AccentColor
|
||||
{
|
||||
get { return _AccentColor; }
|
||||
set
|
||||
{
|
||||
_AccentColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_FlatControlBox() : base()
|
||||
{
|
||||
ColorSchemeChanged += OnColorSchemeChanged;
|
||||
DoubleBuffered = true;
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
ForeColor = Color.FromArgb(50, 50, 50);
|
||||
BackColor = Color.FromArgb(15, 15, 15);
|
||||
AccentColor = Color.FromArgb(250, 36, 38);
|
||||
ColorScheme = ColorSchemes.Dark;
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
}
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Size = new Size(100, 25);
|
||||
}
|
||||
public enum ButtonHover
|
||||
{
|
||||
Minimize,
|
||||
Maximize,
|
||||
Close,
|
||||
None
|
||||
}
|
||||
ButtonHover ButtonState = ButtonHover.None;
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
int X = e.Location.X;
|
||||
int Y = e.Location.Y;
|
||||
if (Y > 0 && Y < (Height - 2))
|
||||
{
|
||||
if (X > 0 && X < 34)
|
||||
{
|
||||
ButtonState = ButtonHover.Minimize;
|
||||
}
|
||||
else if (X > 33 && X < 65)
|
||||
{
|
||||
ButtonState = ButtonHover.Maximize;
|
||||
}
|
||||
else if (X > 64 && X < Width)
|
||||
{
|
||||
ButtonState = ButtonHover.Close;
|
||||
}
|
||||
else
|
||||
{
|
||||
ButtonState = ButtonHover.None;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ButtonState = ButtonHover.None;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Bitmap B = new Bitmap(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
base.OnPaint(e);
|
||||
|
||||
G.Clear(BackColor);
|
||||
switch (ButtonState)
|
||||
{
|
||||
case ButtonHover.None:
|
||||
G.Clear(BackColor);
|
||||
break;
|
||||
case ButtonHover.Minimize:
|
||||
G.FillRectangle(new SolidBrush(_AccentColor), new Rectangle(3, 0, 30, Height));
|
||||
break;
|
||||
case ButtonHover.Maximize:
|
||||
G.FillRectangle(new SolidBrush(_AccentColor), new Rectangle(34, 0, 30, Height));
|
||||
break;
|
||||
case ButtonHover.Close:
|
||||
G.FillRectangle(new SolidBrush(_AccentColor), new Rectangle(65, 0, 35, Height));
|
||||
break;
|
||||
}
|
||||
|
||||
Font ButtonFont = new Font("Marlett", 9.75f);
|
||||
//Close
|
||||
G.DrawString("r", ButtonFont, new SolidBrush(Color.FromArgb(210, 210, 210)), new Point(Width - 16, 7), new StringFormat { Alignment = StringAlignment.Center });
|
||||
//Maximize
|
||||
switch (Parent.FindForm().WindowState)
|
||||
{
|
||||
case FormWindowState.Maximized:
|
||||
G.DrawString("2", ButtonFont, new SolidBrush(Color.FromArgb(210, 210, 210)), new Point(51, 7), new StringFormat { Alignment = StringAlignment.Center });
|
||||
break;
|
||||
case FormWindowState.Normal:
|
||||
G.DrawString("1", ButtonFont, new SolidBrush(Color.FromArgb(210, 210, 210)), new Point(51, 7), new StringFormat { Alignment = StringAlignment.Center });
|
||||
break;
|
||||
}
|
||||
//Minimize
|
||||
G.DrawString("0", ButtonFont, new SolidBrush(Color.FromArgb(210, 210, 210)), new Point(20, 7), new StringFormat { Alignment = StringAlignment.Center });
|
||||
|
||||
|
||||
e.Graphics.DrawImage(B, new Point(0, 0));
|
||||
G.Dispose();
|
||||
B.Dispose();
|
||||
}
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
switch (ButtonState)
|
||||
{
|
||||
case ButtonHover.Close:
|
||||
Parent.FindForm().Close();
|
||||
break;
|
||||
case ButtonHover.Minimize:
|
||||
Parent.FindForm().WindowState = FormWindowState.Minimized;
|
||||
break;
|
||||
case ButtonHover.Maximize:
|
||||
if (Parent.FindForm().WindowState == FormWindowState.Normal)
|
||||
{
|
||||
Parent.FindForm().WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
Parent.FindForm().WindowState = FormWindowState.Normal;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
ButtonState = ButtonHover.None;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,451 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ModernControlBox
|
||||
|
||||
public class CrEaTiiOn_ModernControlBox : Control
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private bool hover_min, hover_max, hover_close;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Custom Properties
|
||||
|
||||
private bool _EnableMaximize = true;
|
||||
[Browsable(true)]
|
||||
[Description("Determines whether the control should enable the use of the maximize button.")]
|
||||
public bool EnableMaximizeButton
|
||||
{
|
||||
get => _EnableMaximize;
|
||||
set
|
||||
{
|
||||
_EnableMaximize = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _EnableMinimize = true;
|
||||
[Browsable(true)]
|
||||
[Description("Determines whether the control should enable the use of the minimize button.")]
|
||||
public bool EnableMinimizeButton
|
||||
{
|
||||
get => _EnableMinimize;
|
||||
set
|
||||
{
|
||||
_EnableMinimize = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _DefaultLocation = true;
|
||||
[Browsable(true)]
|
||||
[Description("ControlBox set location to default.")]
|
||||
public bool DefaultLocation
|
||||
{
|
||||
get => _DefaultLocation;
|
||||
set
|
||||
{
|
||||
_DefaultLocation = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _EnableMinimizeColor = ColorTranslator.FromHtml("#A0A0A0");
|
||||
[Browsable(true)]
|
||||
[Description("Enabled is Minimize ForeColor.")]
|
||||
public Color EnableMinimizeColor
|
||||
{
|
||||
get => _EnableMinimizeColor;
|
||||
set
|
||||
{
|
||||
_EnableMinimizeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _DisableMinimizeColor = ColorTranslator.FromHtml("#696969");
|
||||
[Browsable(true)]
|
||||
[Description("Disabled is Minimize ForeColor.")]
|
||||
public Color DisableMinimizeColor
|
||||
{
|
||||
get => _DisableMinimizeColor;
|
||||
set
|
||||
{
|
||||
_DisableMinimizeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _MinimizeHoverColor = Color.FromArgb(15, Color.White);
|
||||
[Browsable(true)]
|
||||
[Description("Minimize is HoverColor.")]
|
||||
public Color MinimizeHoverColor
|
||||
{
|
||||
get => _MinimizeHoverColor;
|
||||
set
|
||||
{
|
||||
_MinimizeHoverColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _MinimizeHoverForeColor = Color.White;
|
||||
[Browsable(true)]
|
||||
[Description("Minimize is HoverForeColor.")]
|
||||
public Color MinimizeHoverForeColor
|
||||
{
|
||||
get => _MinimizeHoverForeColor;
|
||||
set
|
||||
{
|
||||
_MinimizeHoverForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _EnableMaximizeColor = ColorTranslator.FromHtml("#A0A0A0");
|
||||
[Browsable(true)]
|
||||
[Description("Enabled is Maximize ForeColor.")]
|
||||
public Color EnableMaximizeColor
|
||||
{
|
||||
get => _EnableMaximizeColor;
|
||||
set
|
||||
{
|
||||
_EnableMaximizeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _DisableMaximizeColor = ColorTranslator.FromHtml("#696969");
|
||||
[Browsable(true)]
|
||||
[Description("Disabled is Maximize ForeColor.")]
|
||||
public Color DisableMaximizeColor
|
||||
{
|
||||
get => _DisableMaximizeColor;
|
||||
set
|
||||
{
|
||||
_DisableMaximizeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _MaximizeHoverColor = Color.FromArgb(15, Color.White);
|
||||
[Browsable(true)]
|
||||
[Description("Maximize is HoverColor.")]
|
||||
public Color MaximizeHoverColor
|
||||
{
|
||||
get => _MaximizeHoverColor;
|
||||
set
|
||||
{
|
||||
_MaximizeHoverColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _MaximizeHoverForeColor = Color.White;
|
||||
[Browsable(true)]
|
||||
[Description("Maximize is HoverForeColor.")]
|
||||
public Color MaximizeHoverForeColor
|
||||
{
|
||||
get => _MaximizeHoverForeColor;
|
||||
set
|
||||
{
|
||||
_MaximizeHoverForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _EnableCloseColor = ColorTranslator.FromHtml("#A0A0A0");
|
||||
[Browsable(true)]
|
||||
[Description("Enabled is Close ForeColor.")]
|
||||
public Color EnableCloseColor
|
||||
{
|
||||
get => _EnableCloseColor;
|
||||
set
|
||||
{
|
||||
_EnableCloseColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CloseHoverColor = ColorTranslator.FromHtml("#C75050");
|
||||
[Browsable(true)]
|
||||
[Description("Close is HoverColor.")]
|
||||
public Color CloseHoverColor
|
||||
{
|
||||
get => _CloseHoverColor;
|
||||
set
|
||||
{
|
||||
_CloseHoverColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CloseHoverForeColor = Color.White;
|
||||
[Browsable(true)]
|
||||
[Description("Close is HoverForeColor.")]
|
||||
public Color CloseHoverForeColor
|
||||
{
|
||||
get => _CloseHoverForeColor;
|
||||
set
|
||||
{
|
||||
_CloseHoverForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hidden Properties
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Color ForeColor { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new ImageLayout BackgroundImageLayout { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Image BackgroundImage { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new RightToLeft RightToLeft { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new System.Windows.Forms.ContextMenuStrip ContextMenuStrip { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Size MinimumSize { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Size MaximumSize { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Font Font { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Padding Padding { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Padding Margin { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new string Tag { get; set; }
|
||||
|
||||
[Bindable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new string Text { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Size = new(139, 31);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if (e.X > 0 && e.X < 47 && e.Y > 0 && e.Y < 31)
|
||||
{
|
||||
hover_min = true;
|
||||
hover_max = false;
|
||||
hover_close = false;
|
||||
}
|
||||
else if (e.X > 46 && e.X < 94 && e.Y > 0 && e.Y < 31)
|
||||
{
|
||||
hover_min = false;
|
||||
hover_max = true;
|
||||
hover_close = false;
|
||||
}
|
||||
else if (e.X > 93 && e.X < 150 && e.Y > 0 && e.Y < 31)
|
||||
{
|
||||
hover_min = false;
|
||||
hover_max = false;
|
||||
hover_close = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hover_min = false;
|
||||
hover_max = false;
|
||||
hover_close = false;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
hover_min = false;
|
||||
hover_max = false;
|
||||
hover_close = false;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
Focus();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
|
||||
// Parent form
|
||||
Form pf = FindForm();
|
||||
|
||||
if (_EnableMaximize)
|
||||
{
|
||||
if (hover_max & e.Button == MouseButtons.Left)
|
||||
{
|
||||
switch (pf.WindowState)
|
||||
{
|
||||
case FormWindowState.Normal:
|
||||
pf.WindowState = FormWindowState.Maximized;
|
||||
break;
|
||||
case FormWindowState.Maximized:
|
||||
pf.WindowState = FormWindowState.Normal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_EnableMinimize)
|
||||
{
|
||||
if (hover_min & e.Button == MouseButtons.Left)
|
||||
{
|
||||
pf.WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
}
|
||||
|
||||
if (hover_close & e.Button == MouseButtons.Left)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_ModernControlBox()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
BackColor = Color.Transparent;
|
||||
DoubleBuffered = true;
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
protected override void OnCreateControl()
|
||||
{
|
||||
base.OnCreateControl();
|
||||
try
|
||||
{
|
||||
if (DefaultLocation)
|
||||
{
|
||||
Location = new(Parent.Width - 139, 0); //Location = new(FindForm().Width - 139, 0);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
// This defines the size of the background that is drawn when
|
||||
// the mouse moves over one of the three ControlBox buttons
|
||||
Size btnBackgroundSize = new(46, Height);
|
||||
|
||||
// Minimize button
|
||||
Font minimizeBtnFont = new("Tahoma", 12);
|
||||
Point minimizeBtnPoint = new(15, 5);
|
||||
SolidBrush minimizeBtnBrush = new(_EnableMinimize ? _EnableMinimizeColor : _DisableMinimizeColor);
|
||||
|
||||
if (hover_min && _EnableMinimize)
|
||||
{
|
||||
using (SolidBrush backColor = new(_MinimizeHoverColor))
|
||||
{
|
||||
g.FillRectangle(backColor, new Rectangle(new Point(1, 0), btnBackgroundSize));
|
||||
}
|
||||
|
||||
minimizeBtnBrush = new(_MinimizeHoverForeColor);
|
||||
}
|
||||
|
||||
g.DrawString("\u2212", minimizeBtnFont, minimizeBtnBrush, minimizeBtnPoint);
|
||||
minimizeBtnBrush.Dispose();
|
||||
minimizeBtnFont.Dispose();
|
||||
|
||||
// Maxmize button
|
||||
Font maximizeBtnFont = new("Marlett", 9);
|
||||
Point maximizeBtnPoint = new(63, 10);
|
||||
SolidBrush maximizeBtnBrush = new(_EnableMaximize ? _EnableMaximizeColor : _DisableMaximizeColor);
|
||||
|
||||
if (hover_max && _EnableMaximize)
|
||||
{
|
||||
using (SolidBrush backColor = new(_MaximizeHoverColor))
|
||||
{
|
||||
g.FillRectangle(backColor, new Rectangle(new Point(47, 0), btnBackgroundSize));
|
||||
}
|
||||
|
||||
maximizeBtnBrush = new(_MaximizeHoverForeColor);
|
||||
}
|
||||
|
||||
g.DrawString(FindForm().WindowState != FormWindowState.Maximized ? "1" : "2", maximizeBtnFont, maximizeBtnBrush, maximizeBtnPoint);
|
||||
|
||||
maximizeBtnBrush.Dispose();
|
||||
maximizeBtnFont.Dispose();
|
||||
|
||||
// Close button
|
||||
Font closeBtnFont = new("Tahoma", 11);
|
||||
Point closeBtnPoint = new(107, 6);
|
||||
SolidBrush closeBtnBrush = new(_EnableCloseColor);
|
||||
|
||||
if (hover_close)
|
||||
{
|
||||
using (SolidBrush backColor = new(_CloseHoverColor))
|
||||
{
|
||||
g.FillRectangle(backColor, new Rectangle(new Point(93, 0), btnBackgroundSize));
|
||||
}
|
||||
|
||||
closeBtnBrush = new(_CloseHoverForeColor);
|
||||
}
|
||||
|
||||
g.DrawString("\u2A09", closeBtnFont, closeBtnBrush, closeBtnPoint);
|
||||
closeBtnBrush.Dispose();
|
||||
closeBtnFont.Dispose();
|
||||
|
||||
base.OnPaint(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
internal class CrEaTiiOn_DragControl : Component
|
||||
{
|
||||
private Control controler;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SendMessage(IntPtr o, int msg, int wParams, int IParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ReleaseCapture();
|
||||
|
||||
public Control TargetControl
|
||||
{
|
||||
get => this.controler;
|
||||
set
|
||||
{
|
||||
this.controler = value;
|
||||
this.controler.MouseDown += new MouseEventHandler(this.Controler_MouseDown);
|
||||
}
|
||||
}
|
||||
|
||||
private void Controler_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left)
|
||||
return;
|
||||
CrEaTiiOn_DragControl.ReleaseCapture();
|
||||
CrEaTiiOn_DragControl.SendMessage(this.TargetControl.FindForm().Handle, 161, 2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_VolumeController
|
||||
|
||||
public class CrEaTiiOn_VolumeController : Component
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
private static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern byte MapVirtualKey(uint uCode, uint uMapType);
|
||||
|
||||
public void VolumeUp()
|
||||
{
|
||||
keybd_event(VK_VOLUME_UP, MapVirtualKey(VK_VOLUME_UP_U, KEYEVENTF_NONKEY), KEYEVENTF_EXTENDEDKEY, KEYEVENTF_NONKEY);
|
||||
keybd_event(VK_VOLUME_UP, MapVirtualKey(VK_VOLUME_UP_U, KEYEVENTF_NONKEY), KEYEVENTF_TOPUP, KEYEVENTF_NONKEY);
|
||||
}
|
||||
|
||||
public void VolumeDown()
|
||||
{
|
||||
keybd_event(VK_VOLUME_DOWN, MapVirtualKey(VK_VOLUME_DOWN_U, KEYEVENTF_NONKEY), KEYEVENTF_EXTENDEDKEY, KEYEVENTF_NONKEY);
|
||||
keybd_event(VK_VOLUME_DOWN, MapVirtualKey(VK_VOLUME_DOWN_U, KEYEVENTF_NONKEY), KEYEVENTF_TOPUP, KEYEVENTF_NONKEY);
|
||||
}
|
||||
|
||||
public void Mute()
|
||||
{
|
||||
keybd_event(VK_VOLUME_MUTE, MapVirtualKey(VK_VOLUME_MUTE_U, KEYEVENTF_NONKEY), KEYEVENTF_EXTENDEDKEY, KEYEVENTF_NONKEY);
|
||||
keybd_event(VK_VOLUME_MUTE, MapVirtualKey(VK_VOLUME_MUTE_U, KEYEVENTF_NONKEY), KEYEVENTF_TOPUP, KEYEVENTF_NONKEY);
|
||||
}
|
||||
|
||||
public void SetVolume(int value)
|
||||
{
|
||||
for (int num = 0; num != 50; num++)
|
||||
{
|
||||
keybd_event(VK_VOLUME_DOWN, MapVirtualKey(VK_VOLUME_DOWN_U, KEYEVENTF_NONKEY), KEYEVENTF_EXTENDEDKEY, KEYEVENTF_NONKEY);
|
||||
keybd_event(VK_VOLUME_DOWN, MapVirtualKey(VK_VOLUME_DOWN_U, KEYEVENTF_NONKEY), KEYEVENTF_TOPUP, KEYEVENTF_NONKEY);
|
||||
}
|
||||
if (value > 0)
|
||||
{
|
||||
for (int num = 0; num != value / 2; num++)
|
||||
{
|
||||
keybd_event(VK_VOLUME_UP, MapVirtualKey(VK_VOLUME_UP_U, KEYEVENTF_NONKEY), KEYEVENTF_EXTENDEDKEY, KEYEVENTF_NONKEY);
|
||||
keybd_event(VK_VOLUME_UP, MapVirtualKey(VK_VOLUME_UP_U, KEYEVENTF_NONKEY), KEYEVENTF_TOPUP, KEYEVENTF_NONKEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const byte VK_VOLUME_MUTE = 173;
|
||||
private const uint VK_VOLUME_MUTE_U = 173U;
|
||||
|
||||
private const byte VK_VOLUME_DOWN = 174;
|
||||
private const uint VK_VOLUME_DOWN_U = 174U;
|
||||
|
||||
private const byte VK_VOLUME_UP = 175;
|
||||
private const uint VK_VOLUME_UP_U = 175U;
|
||||
|
||||
private const uint KEYEVENTF_NONKEY = 0U;
|
||||
private const uint KEYEVENTF_EXTENDEDKEY = 1U;
|
||||
private const uint KEYEVENTF_KEYUP = 2U;
|
||||
private const uint KEYEVENTF_TOPUP = 3U;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,314 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public partial class CrEaTiiOn_DatePicker : Control
|
||||
{
|
||||
public new Color BackColor { get { return ThemeColors.PrimaryColor; } set { } }
|
||||
|
||||
private RectangleF TopDateRect;//顶部日期区域
|
||||
private RectangleF WeekRect;//显示星期区域
|
||||
|
||||
private List<List<DateRect>> DateRectangles;//显示日期区域
|
||||
|
||||
private RectangleF PreviousMonthRect;//上一月区域
|
||||
private RectangleF NextMonthRect;//下一月区域
|
||||
private RectangleF PreviousYearRect;//上一年区域
|
||||
private RectangleF NextYearRect;//下一年区域
|
||||
|
||||
private DateTime CurrentDate;
|
||||
public DateTime Date { get { return CurrentDate; } set { CurrentDate = value; Invalidate(); } }
|
||||
|
||||
|
||||
private int DateRectDefaultSize;
|
||||
private int HoverX;
|
||||
private int HoverY;
|
||||
private int SelectedX;
|
||||
private int SelectedY;
|
||||
|
||||
private bool previousYearHovered;
|
||||
private bool previousMonthHovered;
|
||||
private bool nextMonthHovered;
|
||||
private bool nextYearHovered;
|
||||
|
||||
#region 事件
|
||||
public delegate void DateChanged(DateTime newDateTime);
|
||||
public event DateChanged onDateChanged;
|
||||
#endregion
|
||||
|
||||
#region 重写事件
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
for (int j = 0; j < 7; j++)
|
||||
{
|
||||
if (DateRectangles[i][j].Drawn)
|
||||
{
|
||||
if (DateRectangles[i][j].Rect.Contains(e.Location))
|
||||
{
|
||||
if (HoverX != i || HoverY != j)
|
||||
{
|
||||
HoverX = i;
|
||||
previousYearHovered = false;
|
||||
nextYearHovered = false;
|
||||
HoverY = j;
|
||||
Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PreviousYearRect.Contains(e.Location))
|
||||
{
|
||||
previousYearHovered = true;
|
||||
HoverX = -1;
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
if (PreviousMonthRect.Contains(e.Location))
|
||||
{
|
||||
previousMonthHovered = true;
|
||||
HoverX = -1;
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
if (NextMonthRect.Contains(e.Location))
|
||||
{
|
||||
nextMonthHovered = true;
|
||||
HoverX = -1;
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
if (NextYearRect.Contains(e.Location))
|
||||
{
|
||||
nextYearHovered = true;
|
||||
HoverX = -1;
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
if (HoverX >= 0 || previousYearHovered || previousMonthHovered || nextMonthHovered || nextYearHovered)
|
||||
{
|
||||
HoverX = -1;
|
||||
previousYearHovered = false;
|
||||
previousMonthHovered = false;
|
||||
nextMonthHovered = false;
|
||||
nextYearHovered = false;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
if (HoverX >= 0)
|
||||
{
|
||||
SelectedX = HoverX;
|
||||
SelectedY = HoverY;
|
||||
CurrentDate = DateRectangles[SelectedX][SelectedY].Date;
|
||||
Invalidate();
|
||||
if (onDateChanged != null)
|
||||
{
|
||||
onDateChanged(CurrentDate);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (PreviousYearRect.Contains(e.Location))
|
||||
CurrentDate = FirstDayOfMonth(CurrentDate.AddYears(-1));
|
||||
if (PreviousMonthRect.Contains(e.Location))
|
||||
CurrentDate = FirstDayOfMonth(CurrentDate.AddMonths(-1));
|
||||
if (NextMonthRect.Contains(e.Location))
|
||||
CurrentDate = FirstDayOfMonth(CurrentDate.AddMonths(1));
|
||||
if (NextYearRect.Contains(e.Location))
|
||||
CurrentDate = FirstDayOfMonth(CurrentDate.AddYears(1));
|
||||
CalculateRectangles();
|
||||
Invalidate();
|
||||
if (onDateChanged != null)
|
||||
{
|
||||
onDateChanged(CurrentDate);
|
||||
}
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
HoverX = -1;
|
||||
HoverY = -1;
|
||||
previousYearHovered = false;
|
||||
previousMonthHovered = false;
|
||||
nextMonthHovered = false;
|
||||
nextYearHovered = false;
|
||||
Invalidate();
|
||||
base.OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void CalculateRectangles()
|
||||
{
|
||||
//日期位置List
|
||||
DateRectangles = new List<List<DateRect>>();
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
DateRectangles.Add(new List<DateRect>());
|
||||
for (int j = 0; j < 7; j++)
|
||||
{
|
||||
DateRectangles[i].Add(new DateRect(new RectangleF(10 + (j * (Width - 20) / 7), WeekRect.Y + WeekRect.Height + (i * DateRectDefaultSize), DateRectDefaultSize, DateRectDefaultSize)));
|
||||
}
|
||||
}
|
||||
DateTime FirstDay = FirstDayOfMonth(CurrentDate);
|
||||
var temp = 0;
|
||||
for (int i = FirstDay.DayOfWeek == DayOfWeek.Sunday ? 6 : (int)FirstDay.DayOfWeek - 1; i > 0; i--, temp++)
|
||||
{
|
||||
DateRectangles[temp / 7][temp % 7].Drawn = false;
|
||||
DateRectangles[temp / 7][temp % 7].Date = FirstDay.AddDays(0 - i);
|
||||
}
|
||||
for (DateTime date = FirstDay; date <= LastDayOfMonth(CurrentDate); date = date.AddDays(1), temp++)
|
||||
{
|
||||
if (date.DayOfYear == CurrentDate.DayOfYear && date.Year == CurrentDate.Year)
|
||||
{
|
||||
SelectedX = temp / 7;
|
||||
SelectedY = temp % 7;
|
||||
}
|
||||
DateRectangles[temp / 7][temp % 7].Drawn = true;
|
||||
DateRectangles[temp / 7][temp % 7].Date = date;
|
||||
}
|
||||
DateTime LastDay = LastDayOfMonth(CurrentDate);
|
||||
for (int i = 0; temp < 42; i++, temp++)
|
||||
{
|
||||
DateRectangles[temp / 7][temp % 7].Drawn = false;
|
||||
DateRectangles[temp / 7][temp % 7].Date = LastDay.AddDays(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
Width = 250;
|
||||
Height = 270;
|
||||
}
|
||||
|
||||
public CrEaTiiOn_DatePicker()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
DoubleBuffered = true;
|
||||
Width = 250;
|
||||
Height = 260;
|
||||
|
||||
DateRectDefaultSize = (Width - 20) / 7;
|
||||
TopDateRect = new RectangleF(20, 5, Width - 40, DateRectDefaultSize);
|
||||
WeekRect = new RectangleF(0, TopDateRect.Y + TopDateRect.Height, DateRectDefaultSize, DateRectDefaultSize);
|
||||
|
||||
PreviousYearRect = new RectangleF(10, TopDateRect.Y, 20, DateRectDefaultSize);
|
||||
PreviousMonthRect = new RectangleF(35, TopDateRect.Y + 1, 20, DateRectDefaultSize);
|
||||
NextMonthRect = new RectangleF(Width - 55, TopDateRect.Y + 1, 20, DateRectDefaultSize);
|
||||
NextYearRect = new RectangleF(Width - 30, TopDateRect.Y, 20, DateRectDefaultSize);
|
||||
|
||||
CurrentDate = DateTime.Now;
|
||||
|
||||
HoverX = -1;
|
||||
HoverY = -1;
|
||||
CalculateRectangles();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
var graphics = e.Graphics;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
graphics.Clear(Parent.BackColor);
|
||||
|
||||
//绘制背景边框
|
||||
var bg = DrawHelper.CreateRoundRect(1f, 1f, Width - 2, Height - 2, 3);
|
||||
graphics.FillPath(new SolidBrush(Color.FromArgb(20, 20, 20)), bg);
|
||||
graphics.DrawPath(new Pen(ThemeColors.OneLevelBorder), bg);
|
||||
|
||||
//绘制年月
|
||||
graphics.DrawString(string.Format("{0}年{1,2}月", CurrentDate.Year, CurrentDate.Month), new Font("微软雅黑", 12f), new SolidBrush(ThemeColors.MainText), TopDateRect, StringAlign.Center);
|
||||
//绘制年月选择区域
|
||||
graphics.DrawString("7", new Font("Segoe UI", 12f), new SolidBrush(previousYearHovered ? ThemeColors.PrimaryColor : ThemeColors.PlaceholderText), PreviousYearRect, StringAlign.Center);
|
||||
graphics.DrawString("3", new Font("Segoe UI", 12f), new SolidBrush(previousMonthHovered ? ThemeColors.PrimaryColor : ThemeColors.PlaceholderText), PreviousMonthRect, StringAlign.Center);
|
||||
graphics.DrawString("4", new Font("Segoe UI", 12f), new SolidBrush(nextMonthHovered ? ThemeColors.PrimaryColor : ThemeColors.PlaceholderText), NextMonthRect, StringAlign.Center);
|
||||
graphics.DrawString("8", new Font("Segoe UI", 12f), new SolidBrush(nextYearHovered ? ThemeColors.PrimaryColor : ThemeColors.PlaceholderText), NextYearRect, StringAlign.Center);
|
||||
|
||||
//绘制星期
|
||||
string s = "一二三四五六日";
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
graphics.DrawString(s[i].ToString(), new Font("微软雅黑", 10f), new SolidBrush(ThemeColors.RegularText), new RectangleF(10 + i * (Width - 20) / 7, WeekRect.Y, WeekRect.Width, WeekRect.Height), StringAlign.Center);
|
||||
}
|
||||
|
||||
//绘制分割线
|
||||
graphics.DrawLine(new Pen(ThemeColors.TwoLevelBorder, 0.5f), 10, WeekRect.Y + WeekRect.Height, Width - 10, WeekRect.Y + WeekRect.Height);
|
||||
|
||||
//绘制日期
|
||||
DateTime FirstDay = FirstDayOfMonth(CurrentDate);
|
||||
for (int i = 0; i < 42; i++)
|
||||
{
|
||||
var tempDate = DateRectangles[i / 7][i % 7];
|
||||
var brush = new SolidBrush(ThemeColors.MainText);
|
||||
//突出显示鼠标所指
|
||||
if (HoverX == i / 7 && HoverY == i % 7)
|
||||
{
|
||||
var rect1 = tempDate.Rect;
|
||||
var bg1 = DrawHelper.CreateRoundRect(rect1.X + 2, rect1.Y + 2, rect1.Width - 4, rect1.Width - 4, 3);
|
||||
graphics.FillPath(new SolidBrush(ThemeColors.ThreeLevelBorder), bg1);
|
||||
//graphics.FillRectangle(new SolidBrush(ThemeColors.ThreeLevelBorder), new RectangleF(rect1.X + 3, rect1.Y + 3, rect1.Width - 6, rect1.Width - 6));
|
||||
}
|
||||
//突出显示今天
|
||||
if (tempDate.Date == DateTime.Today)
|
||||
{
|
||||
brush = new SolidBrush(ThemeColors.DarkPrimary);
|
||||
}
|
||||
//突出显示所选日期
|
||||
if (tempDate.Date == Date)
|
||||
{
|
||||
var rect1 = tempDate.Rect;
|
||||
var bg1 = DrawHelper.CreateRoundRect(rect1.X + 2, rect1.Y + 2, rect1.Width - 4, rect1.Width - 4, 3);
|
||||
graphics.FillPath(new SolidBrush(ThemeColors.PrimaryColor), bg1);
|
||||
|
||||
//graphics.FillRectangle(new SolidBrush(ThemeColors.PrimaryColor), new RectangleF(rect1.X+3,rect1.Y+3,rect1.Width-6,rect1.Width-6));
|
||||
brush = new SolidBrush(Color.White);
|
||||
}
|
||||
graphics.DrawString(DateRectangles[i / 7][i % 7].Date.Day.ToString(), Font, DateRectangles[i / 7][i % 7].Drawn ? brush : new SolidBrush(ThemeColors.SecondaryText), DateRectangles[i / 7][i % 7].Rect, StringAlign.Center);
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime FirstDayOfMonth(DateTime value)
|
||||
{
|
||||
return new DateTime(value.Year, value.Month, 1);
|
||||
}
|
||||
|
||||
public DateTime LastDayOfMonth(DateTime value)
|
||||
{
|
||||
return new DateTime(value.Year, value.Month, DateTime.DaysInMonth(value.Year, value.Month));
|
||||
}
|
||||
|
||||
private class DateRect
|
||||
{
|
||||
public RectangleF Rect;
|
||||
public bool Drawn = false;
|
||||
public DateTime Date;
|
||||
|
||||
public DateRect(RectangleF pRect)
|
||||
{
|
||||
Rect = pRect;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Layout;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_ClasicDropdownMenu : CrEaTiiOn_ContextMenuStrip
|
||||
{
|
||||
private bool isMainMenu;
|
||||
private int menuItemHeight = 25;
|
||||
private Color menuItemTextColor = Color.Empty;
|
||||
private Color primaryColor = Color.FromArgb(20, 20, 20);
|
||||
private Bitmap menuItemHeaderSize;
|
||||
|
||||
public CrEaTiiOn_ClasicDropdownMenu(IContainer container)
|
||||
: base(container)
|
||||
{
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public bool IsMainMenu
|
||||
{
|
||||
get => this.isMainMenu;
|
||||
set => this.isMainMenu = value;
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public int MenuItemHeight
|
||||
{
|
||||
get => this.menuItemHeight;
|
||||
set => this.menuItemHeight = value;
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public Color MenuItemTextColor
|
||||
{
|
||||
get => this.menuItemTextColor;
|
||||
set => this.menuItemTextColor = value;
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public Color PrimaryColor
|
||||
{
|
||||
get => this.primaryColor;
|
||||
set => this.primaryColor = value;
|
||||
}
|
||||
|
||||
private void LoadMenuItemHeight()
|
||||
{
|
||||
this.menuItemHeaderSize = !this.isMainMenu ? new Bitmap(20, this.menuItemHeight) : new Bitmap(25, 45);
|
||||
foreach (ToolStripMenuItem toolStripMenuItem in (ArrangedElementCollection)this.Items)
|
||||
{
|
||||
toolStripMenuItem.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (toolStripMenuItem.Image == null)
|
||||
toolStripMenuItem.Image = (Image)this.menuItemHeaderSize;
|
||||
foreach (ToolStripMenuItem dropDownItem1 in (ArrangedElementCollection)toolStripMenuItem.DropDownItems)
|
||||
{
|
||||
dropDownItem1.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (dropDownItem1.Image == null)
|
||||
dropDownItem1.Image = (Image)this.menuItemHeaderSize;
|
||||
foreach (ToolStripMenuItem dropDownItem2 in (ArrangedElementCollection)dropDownItem1.DropDownItems)
|
||||
{
|
||||
dropDownItem2.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (dropDownItem2.Image == null)
|
||||
dropDownItem2.Image = (Image)this.menuItemHeaderSize;
|
||||
foreach (ToolStripMenuItem dropDownItem3 in (ArrangedElementCollection)dropDownItem2.DropDownItems)
|
||||
{
|
||||
dropDownItem3.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (dropDownItem3.Image == null)
|
||||
dropDownItem3.Image = (Image)this.menuItemHeaderSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
if (this.DesignMode)
|
||||
return;
|
||||
this.Renderer = (ToolStripRenderer)new MenuRenderer(this.isMainMenu, this.primaryColor, this.menuItemTextColor);
|
||||
this.LoadMenuItemHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_DropdownMenu : CrEaTiiOn_ContextMenuStrip
|
||||
{
|
||||
//Fields
|
||||
private bool isMainMenu;
|
||||
private int menuItemHeight = 25;
|
||||
private Color menuItemTextColor = Color.Empty;//No color, The default color is set in the MenuRenderer class
|
||||
private Color primaryColor = Color.Empty;//No color, The default color is set in the MenuRenderer class
|
||||
|
||||
private Bitmap menuItemHeaderSize;
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_DropdownMenu(IContainer container)
|
||||
: base(container)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Properties
|
||||
//Optionally, hide the properties in the toolbox to avoid the problem of displaying and/or
|
||||
//saving control property changes in the designer at design time in Visual Studio.
|
||||
//If the problem I mention does not occur you can expose the properties and manipulate them from the toolbox.
|
||||
[Browsable(false)]
|
||||
public bool IsMainMenu
|
||||
{
|
||||
get { return isMainMenu; }
|
||||
set { isMainMenu = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public int MenuItemHeight
|
||||
{
|
||||
get { return menuItemHeight; }
|
||||
set { menuItemHeight = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public Color MenuItemTextColor
|
||||
{
|
||||
get { return menuItemTextColor; }
|
||||
set { menuItemTextColor = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public Color PrimaryColor
|
||||
{
|
||||
get { return primaryColor; }
|
||||
set { primaryColor = value; }
|
||||
}
|
||||
|
||||
//Private methods
|
||||
private void LoadMenuItemHeight()
|
||||
{
|
||||
if (isMainMenu)
|
||||
menuItemHeaderSize = new Bitmap(25, 45);
|
||||
else menuItemHeaderSize = new Bitmap(20, menuItemHeight);
|
||||
|
||||
foreach (ToolStripMenuItem menuItemL1 in this.Items)
|
||||
{
|
||||
menuItemL1.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (menuItemL1.Image == null) menuItemL1.Image = menuItemHeaderSize;
|
||||
|
||||
foreach (ToolStripMenuItem menuItemL2 in menuItemL1.DropDownItems)
|
||||
{
|
||||
menuItemL2.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (menuItemL2.Image == null) menuItemL2.Image = menuItemHeaderSize;
|
||||
|
||||
foreach (ToolStripMenuItem menuItemL3 in menuItemL2.DropDownItems)
|
||||
{
|
||||
menuItemL3.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (menuItemL3.Image == null) menuItemL3.Image = menuItemHeaderSize;
|
||||
|
||||
foreach (ToolStripMenuItem menuItemL4 in menuItemL3.DropDownItems)
|
||||
{
|
||||
menuItemL4.ImageScaling = ToolStripItemImageScaling.None;
|
||||
if (menuItemL4.Image == null) menuItemL4.Image = menuItemHeaderSize;
|
||||
///Level 5++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Overrides
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
if (this.DesignMode == false)
|
||||
{
|
||||
this.Renderer = new MenuRenderer(isMainMenu, primaryColor, menuItemTextColor);
|
||||
LoadMenuItemHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_Ellipse : Component
|
||||
{
|
||||
private Control control;
|
||||
private int cornerRadius = 6;
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
private static extern IntPtr CreateRoundRectRgn(
|
||||
int nL,
|
||||
int nT,
|
||||
int nR,
|
||||
int nB,
|
||||
int nWidthEllipse,
|
||||
int nHeightEllipse);
|
||||
|
||||
public Control TargetControl
|
||||
{
|
||||
get => this.control;
|
||||
set
|
||||
{
|
||||
this.control = value;
|
||||
this.control.SizeChanged += (EventHandler)((sender, eventArgs) => this.control.Region = Region.FromHrgn(CrEaTiiOn_Ellipse.CreateRoundRectRgn(0, 0, this.control.Width, this.control.Height, this.cornerRadius, this.cornerRadius)));
|
||||
}
|
||||
}
|
||||
|
||||
public int CornerRadius
|
||||
{
|
||||
get => this.cornerRadius;
|
||||
set
|
||||
{
|
||||
this.cornerRadius = value;
|
||||
if (this.control == null)
|
||||
return;
|
||||
this.control.Region = Region.FromHrgn(CrEaTiiOn_Ellipse.CreateRoundRectRgn(0, 0, this.control.Width, this.control.Height, this.cornerRadius, this.cornerRadius));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,241 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ObjectEllipse
|
||||
|
||||
public class CrEaTiiOn_ObjectEllipse : Component
|
||||
{
|
||||
public CrEaTiiOn_ObjectEllipse()
|
||||
{
|
||||
UpdateControl();
|
||||
UpdateForm();
|
||||
}
|
||||
|
||||
public override ISite Site
|
||||
{
|
||||
get => base.Site;
|
||||
set
|
||||
{
|
||||
base.Site = value;
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IDesignerHost designerHost = value.GetService(typeof(IDesignerHost)) as IDesignerHost;
|
||||
|
||||
if (designerHost != null)
|
||||
{
|
||||
IComponent rootComponent = designerHost.RootComponent;
|
||||
|
||||
if (rootComponent is ContainerControl && rootComponent is not Form)
|
||||
{
|
||||
effectedControl = rootComponent as ContainerControl;
|
||||
|
||||
DefaultControl = rootComponent as ContainerControl;
|
||||
|
||||
if (DefaultControl != null)
|
||||
{
|
||||
DefaultControlRegion = DefaultControl.Region;
|
||||
}
|
||||
}
|
||||
|
||||
if (rootComponent is Form)
|
||||
{
|
||||
effectedForm = rootComponent as Form;
|
||||
|
||||
DefaultForm = rootComponent as Form;
|
||||
|
||||
if (DefaultForm != null)
|
||||
{
|
||||
DefaultFormRegion = DefaultForm.Region;
|
||||
DefaultStyle = DefaultForm.FormBorderStyle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCustomRegion()
|
||||
{
|
||||
if (effectedControl != null)
|
||||
{
|
||||
effectedControl.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, effectedControl.Width, effectedControl.Height, cornerRadius, cornerRadius));
|
||||
effectedControl.SizeChanged += Container_SizeChanged;
|
||||
}
|
||||
|
||||
if (effectedForm != null)
|
||||
{
|
||||
effectedForm.FormBorderStyle = FormBorderStyle.None;
|
||||
|
||||
effectedForm.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, effectedForm.Width, effectedForm.Height, cornerRadius, cornerRadius));
|
||||
effectedForm.SizeChanged += Container_SizeChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateControl()
|
||||
{
|
||||
if (DefaultControl != null)
|
||||
{
|
||||
DefaultControl.Region = DefaultControlRegion;
|
||||
}
|
||||
|
||||
if (effectedControl != null)
|
||||
{
|
||||
DefaultControl = effectedControl;
|
||||
|
||||
DefaultControlRegion = effectedControl.Region;
|
||||
|
||||
SetCustomRegion();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateForm()
|
||||
{
|
||||
if (DefaultForm != null)
|
||||
{
|
||||
DefaultForm.FormBorderStyle = DefaultStyle;
|
||||
|
||||
DefaultForm.Region = DefaultFormRegion;
|
||||
}
|
||||
|
||||
if (effectedForm != null)
|
||||
{
|
||||
DefaultForm = effectedForm;
|
||||
|
||||
DefaultFormRegion = effectedForm.Region;
|
||||
|
||||
DefaultStyle = effectedForm.FormBorderStyle;
|
||||
|
||||
SetCustomRegion();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (effectedControl != null)
|
||||
{
|
||||
effectedControl.Region = DefaultControlRegion;
|
||||
}
|
||||
|
||||
if (effectedForm != null)
|
||||
{
|
||||
effectedForm.FormBorderStyle = DefaultStyle;
|
||||
|
||||
effectedForm.Region = DefaultFormRegion;
|
||||
}
|
||||
}
|
||||
|
||||
private void Container_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (effectedControl != null)
|
||||
{
|
||||
effectedControl.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, effectedControl.Width, effectedControl.Height, cornerRadius, cornerRadius));
|
||||
}
|
||||
|
||||
if (effectedForm != null)
|
||||
{
|
||||
effectedForm.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, effectedForm.Width, effectedForm.Height, cornerRadius, cornerRadius));
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Parrot")]
|
||||
[Browsable(true)]
|
||||
[Description("The corner radius")]
|
||||
public int CornerRadius
|
||||
{
|
||||
get => cornerRadius;
|
||||
set
|
||||
{
|
||||
cornerRadius = value;
|
||||
SetCustomRegion();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Parrot")]
|
||||
[Browsable(true)]
|
||||
[Description("The effected control")]
|
||||
public Control EffectedControl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (effectedControl != null)
|
||||
{
|
||||
return effectedControl;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != EffectedForm || value == null)
|
||||
{
|
||||
effectedControl = value;
|
||||
UpdateControl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Parrot")]
|
||||
[Browsable(true)]
|
||||
[Description("The effected form(will remove ellipse from effected control)")]
|
||||
public Form EffectedForm
|
||||
{
|
||||
get
|
||||
{
|
||||
if (effectedForm != null)
|
||||
{
|
||||
return effectedForm;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != EffectedControl || value == null)
|
||||
{
|
||||
effectedForm = value;
|
||||
UpdateForm();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("Gdi32.dll")]
|
||||
private static extern IntPtr CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse);
|
||||
|
||||
private Control DefaultControl = null;
|
||||
|
||||
private Form DefaultForm = null;
|
||||
|
||||
private FormBorderStyle DefaultStyle;
|
||||
|
||||
private Region DefaultControlRegion = null;
|
||||
|
||||
private Region DefaultFormRegion = null;
|
||||
|
||||
private int cornerRadius = 10;
|
||||
|
||||
private Control effectedControl = null;
|
||||
|
||||
private Form effectedForm = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Gauge
|
||||
|
||||
public class CrEaTiiOn_Gauge : Control
|
||||
{
|
||||
public CrEaTiiOn_Gauge()
|
||||
{
|
||||
base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
base.Size = new Size(140, 70);
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge style")]
|
||||
public Style GaugeStyle
|
||||
{
|
||||
get => gaugeStyle;
|
||||
set
|
||||
{
|
||||
gaugeStyle = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge thickness")]
|
||||
public int Thickness
|
||||
{
|
||||
get => thickness;
|
||||
set
|
||||
{
|
||||
thickness = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge dial thickness")]
|
||||
public int DialThickness
|
||||
{
|
||||
get => dialThickness;
|
||||
set
|
||||
{
|
||||
dialThickness = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge percentage")]
|
||||
public int Percentage
|
||||
{
|
||||
get => percentage;
|
||||
set
|
||||
{
|
||||
percentage = value;
|
||||
if (value < 0)
|
||||
{
|
||||
percentage = 0;
|
||||
}
|
||||
if (value > 100)
|
||||
{
|
||||
percentage = 100;
|
||||
}
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge percentage")]
|
||||
public Color DialColor
|
||||
{
|
||||
get => dialColor;
|
||||
set
|
||||
{
|
||||
dialColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge unfilled color")]
|
||||
public Color UnfilledColor
|
||||
{
|
||||
get => unfilledColor;
|
||||
set
|
||||
{
|
||||
unfilledColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge filled color")]
|
||||
public Color FilledColor
|
||||
{
|
||||
get => filledColor;
|
||||
set
|
||||
{
|
||||
filledColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge consumption color")]
|
||||
public Color ConsumptionColor
|
||||
{
|
||||
get => consumptionColor;
|
||||
set
|
||||
{
|
||||
consumptionColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The gauge bar color")]
|
||||
public List<Color> BarColor
|
||||
{
|
||||
get => barColor;
|
||||
set
|
||||
{
|
||||
barColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingType;
|
||||
if (BarColor.Count == 7)
|
||||
{
|
||||
if (gaugeStyle == Style.Standard)
|
||||
{
|
||||
Rectangle rect = new(1 + thickness / 2, 1 + thickness / 2, base.Width - 2 - thickness, base.Height * 2 - thickness);
|
||||
e.Graphics.DrawArc(new Pen(BarColor[0], thickness / 4), rect, 180f, 44f);
|
||||
e.Graphics.DrawArc(new Pen(BarColor[1], thickness / 4 * 2), rect, 226f, 44f);
|
||||
e.Graphics.DrawArc(new Pen(BarColor[2], thickness / 4 * 3), rect, 272f, 44f);
|
||||
e.Graphics.DrawArc(new Pen(BarColor[3], thickness), rect, 318f, 44f);
|
||||
rect.Inflate(0 - thickness, 0 - thickness);
|
||||
e.Graphics.FillPie(new SolidBrush(dialColor), new Rectangle(base.Width / 2 - thickness, base.Height - thickness, thickness * 2, thickness * 2), 0f, 360f);
|
||||
if (percentage <= 5)
|
||||
{
|
||||
e.Graphics.FillPie(new SolidBrush(ConsumptionColor), rect, 180 + dialThickness * 2 - 2, dialThickness);
|
||||
}
|
||||
else if (percentage >= 95)
|
||||
{
|
||||
e.Graphics.FillPie(new SolidBrush(ConsumptionColor), rect, 360 - dialThickness * 2, dialThickness);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.FillPie(new SolidBrush(dialColor), rect, 180 + (int)(percentage * 1.8) - dialThickness / 2, dialThickness);
|
||||
}
|
||||
}
|
||||
if (gaugeStyle == Style.Material)
|
||||
{
|
||||
Rectangle rect2 = new(1 + thickness / 2, 1 + thickness / 2, base.Width - 2 - thickness, base.Height * 2 - thickness);
|
||||
e.Graphics.DrawArc(new Pen(new LinearGradientBrush(new Rectangle(0, 0, base.Width, base.Height), BarColor[4], BarColor[5], 1f), thickness), rect2, 180f, (int)(percentage * 1.8) - 1);
|
||||
e.Graphics.DrawArc(new Pen(BarColor[6], thickness), rect2, 180 + (int)(percentage * 1.8) + 1, 180 - (int)(percentage * 1.8) + 5);
|
||||
}
|
||||
if (gaugeStyle == Style.Flat)
|
||||
{
|
||||
Rectangle rect3 = new(1 + thickness / 2, 1 + thickness / 2, base.Width - 2 - thickness, base.Height * 2 - thickness);
|
||||
e.Graphics.DrawArc(new Pen(filledColor, thickness), rect3, 180f, (int)(percentage * 1.8) - 1);
|
||||
e.Graphics.DrawArc(new Pen(unfilledColor, thickness), rect3, 180 + (int)(percentage * 1.8) + 1, 180 - (int)(percentage * 1.8) + 5);
|
||||
}
|
||||
}
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
public Style gaugeStyle = Style.Material;
|
||||
|
||||
public int thickness = 8;
|
||||
|
||||
public int dialThickness = 5;
|
||||
|
||||
public int percentage = 75;
|
||||
|
||||
public Color dialColor = Color.Gray;
|
||||
|
||||
public Color unfilledColor = Color.Gray;
|
||||
|
||||
public Color consumptionColor = Color.Black;
|
||||
|
||||
public List<Color> barColor = new()
|
||||
{
|
||||
Color.FromArgb(255, 220, 0),
|
||||
Color.FromArgb(255, 150, 0),
|
||||
Color.FromArgb(250, 90, 0),
|
||||
Color.FromArgb(255, 0, 0),
|
||||
Color.FromArgb(249, 55, 98),
|
||||
Color.FromArgb(0, 162, 250),
|
||||
Color.FromArgb(0, 162, 250)
|
||||
};
|
||||
|
||||
public Color filledColor = Color.FromArgb(0, 162, 250);
|
||||
|
||||
public enum Style
|
||||
{
|
||||
Standard,
|
||||
Material,
|
||||
Flat
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatGroupBox : GroupBox
|
||||
{
|
||||
#region 属性
|
||||
|
||||
[RefreshProperties(RefreshProperties.Repaint)]
|
||||
public Color ThemeColor { get; set; } = ThemeColors.PrimaryColor;
|
||||
|
||||
[Description("是否显示控件文本")]
|
||||
[RefreshProperties(RefreshProperties.Repaint)]
|
||||
public bool ShowText { get; set; } = false;
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Graphics graphics = e.Graphics;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;//消除锯齿
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;//高质量显示
|
||||
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;//最高质量显示文本
|
||||
graphics.Clear(Parent.BackColor);
|
||||
|
||||
var BG = DrawHelper.CreateRoundRect(1, 1, Width - 2, Height - 2, 3);
|
||||
graphics.FillPath(new SolidBrush(BackColor), BG);
|
||||
graphics.DrawPath(new Pen(ThemeColors.OneLevelBorder), BG);
|
||||
|
||||
if (ShowText)
|
||||
{
|
||||
graphics.DrawLine(new Pen(ThemeColors.OneLevelBorder, 1), 0, 38, Width, 38);
|
||||
graphics.DrawString(Text, new Font("Segoe UI", 12F), new SolidBrush(ThemeColors.MainText), new RectangleF(15, 0, Width - 50, 38), StringAlign.Left);
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_FlatGroupBox()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
DoubleBuffered = true;
|
||||
Font = new Font("Segoe UI", 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using CBH_Ultimate_Theme_Library;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_ModernGroupBox : ThemeContainer154
|
||||
{
|
||||
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
|
||||
private static extern IntPtr CreateRoundRectRgn
|
||||
(
|
||||
int nLeftRect, // x-coordinate of upper-left corner
|
||||
int nTopRect, // y-coordinate of upper-left corner
|
||||
int nRightRect, // x-coordinate of lower-right corner
|
||||
int nBottomRect, // y-coordinate of lower-right corner
|
||||
int nWidthEllipse, // width of ellipse
|
||||
int nHeightEllipse // height of ellipse
|
||||
);
|
||||
|
||||
public CrEaTiiOn_ModernGroupBox()
|
||||
{
|
||||
ControlMode = true;
|
||||
Header = 26;
|
||||
TextColor = Color.White;
|
||||
Size = new Size(205, 120);
|
||||
Font = new Font("Segoe UI", 8);
|
||||
}
|
||||
|
||||
protected override void ColorHook()
|
||||
{
|
||||
}
|
||||
private Color _ForeColor;
|
||||
public Color TextColor
|
||||
{
|
||||
get { return _ForeColor; }
|
||||
set { _ForeColor = value; }
|
||||
}
|
||||
private ColorBlend LBlend = new ColorBlend();
|
||||
|
||||
private ColorBlend LBlend2 = new ColorBlend();
|
||||
protected override void PaintHook()
|
||||
{
|
||||
LBlend.Positions = new float[] {
|
||||
0f,
|
||||
0.15f,
|
||||
0.85f,
|
||||
1f
|
||||
};
|
||||
LBlend2.Positions = new float[] {
|
||||
0f,
|
||||
0.15f,
|
||||
0.5f,
|
||||
0.85f,
|
||||
1f
|
||||
};
|
||||
LBlend.Colors = new Color[] {
|
||||
Color.Transparent,
|
||||
Color.FromArgb(250, 36, 38),
|
||||
Color.FromArgb(250, 36, 38),
|
||||
Color.Transparent
|
||||
};
|
||||
LBlend2.Colors = new Color[] {
|
||||
Color.Transparent,
|
||||
Color.FromArgb(10, 10, 10),
|
||||
Color.FromArgb(250, 36, 38),
|
||||
Color.FromArgb(10, 10, 10),
|
||||
Color.Transparent
|
||||
};
|
||||
|
||||
G.Clear(Color.FromArgb(15, 15, 15));
|
||||
|
||||
if (Text == null)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawGradient(LBlend, 0, 23, Width, 1, 0f);
|
||||
DrawGradient(LBlend2, 0, 24, Width, 1, 0f);
|
||||
}
|
||||
|
||||
G.DrawLine(new Pen(Color.FromArgb(15, 15, 15)), 1, 1, Width - 2, 1);
|
||||
|
||||
DrawText(new SolidBrush(TextColor), HorizontalAlignment.Center, 0, 0);
|
||||
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_FormHandle
|
||||
|
||||
public class CrEaTiiOn_FormHandle : Component
|
||||
{
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The handleControl")]
|
||||
public Control HandleControl
|
||||
{
|
||||
get => handleControl;
|
||||
set
|
||||
{
|
||||
handleControl = value;
|
||||
handleControl.MouseDown += DragForm_MouseDown;
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Maximize when dragged to top")]
|
||||
public bool DockAtTop
|
||||
{
|
||||
get => dockAtTop;
|
||||
set => dockAtTop = value;
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ReleaseCapture();
|
||||
|
||||
private void DragForm_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
ReleaseCapture();
|
||||
SendMessage(HandleControl.FindForm().Handle, 161, 2, 0);
|
||||
if (dockAtTop && handleControl.FindForm().FormBorderStyle == FormBorderStyle.None)
|
||||
{
|
||||
if (HandleControl.FindForm().WindowState != FormWindowState.Maximized && Cursor.Position.Y <= 3)
|
||||
{
|
||||
HandleControl.FindForm().WindowState = FormWindowState.Maximized;
|
||||
return;
|
||||
}
|
||||
HandleControl.FindForm().WindowState = FormWindowState.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Control handleControl;
|
||||
|
||||
private bool dockAtTop = true;
|
||||
|
||||
public const int WM_NCLBUTTONDOWN = 161;
|
||||
|
||||
public const int HT_CAPTION = 2;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_InfoIcon
|
||||
|
||||
public class CrEaTiiOn_InfoIcon : Control
|
||||
{
|
||||
#region Settings
|
||||
|
||||
private Color _BaseColor = Color.FromArgb(246, 246, 246);
|
||||
public Color BaseColor
|
||||
{
|
||||
get => _BaseColor;
|
||||
set => _BaseColor = value;
|
||||
}
|
||||
|
||||
private Color _CircleColor = Color.Gray;
|
||||
public Color CircleColor
|
||||
{
|
||||
get => _CircleColor;
|
||||
set => _CircleColor = value;
|
||||
}
|
||||
|
||||
private string _String = "¡";
|
||||
public string String
|
||||
{
|
||||
get => _String;
|
||||
set => _String = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_InfoIcon()
|
||||
{
|
||||
ForeColor = Color.DimGray;
|
||||
BackColor = Color.FromArgb(20, 20, 20);
|
||||
ForeColor = Color.White;
|
||||
Font = new("Segoe UI", 25, FontStyle.Bold);
|
||||
Size = new(33, 33);
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
|
||||
e.Graphics.FillEllipse(new SolidBrush(_CircleColor), new Rectangle(1, 1, 29, 29));
|
||||
e.Graphics.FillEllipse(new SolidBrush(_BaseColor), new Rectangle(3, 3, 25, 25));
|
||||
|
||||
e.Graphics.DrawString(_String, Font, new SolidBrush(ForeColor), new Rectangle(4, -14, Width, 43), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Near,
|
||||
LineAlignment = StringAlignment.Near
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_TickIcon
|
||||
|
||||
public class CrEaTiiOn_TickIcon : Control
|
||||
{
|
||||
#region Settings
|
||||
|
||||
private Color _BaseColor = Color.FromArgb(246, 246, 246);
|
||||
public Color BaseColor
|
||||
{
|
||||
get => _BaseColor;
|
||||
set => _BaseColor = value;
|
||||
}
|
||||
|
||||
private Color _CircleColor = Color.Gray;
|
||||
public Color CircleColor
|
||||
{
|
||||
get => _CircleColor;
|
||||
set => _CircleColor = value;
|
||||
}
|
||||
|
||||
private string _String = "ü";
|
||||
public string String
|
||||
{
|
||||
get => _String;
|
||||
set => _String = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_TickIcon()
|
||||
{
|
||||
ForeColor = Color.White;
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.Gray;
|
||||
Font = new("Wingdings", 25, FontStyle.Bold);
|
||||
Size = new(33, 33);
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
|
||||
e.Graphics.FillEllipse(new SolidBrush(_CircleColor), new Rectangle(1, 1, 29, 29));
|
||||
e.Graphics.FillEllipse(new SolidBrush(_BaseColor), new Rectangle(3, 3, 25, 25));
|
||||
|
||||
e.Graphics.DrawString(_String, Font, new SolidBrush(ForeColor), new Rectangle(0, -3, Width, 43), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Near,
|
||||
LineAlignment = StringAlignment.Near
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_AirLabel
|
||||
|
||||
public class CrEaTiiOn_AirLabel : System.Windows.Forms.Label
|
||||
{
|
||||
public CrEaTiiOn_AirLabel() : base()
|
||||
{
|
||||
Font = new("Segoe UI", 6.75f, FontStyle.Bold);
|
||||
ForeColor = Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_BigLabel
|
||||
|
||||
public class CrEaTiiOn_BigLabel : System.Windows.Forms.Label
|
||||
{
|
||||
public CrEaTiiOn_BigLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 25, FontStyle.Regular);
|
||||
ForeColor = Color.White;
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ClasicHeaderLabel
|
||||
|
||||
public class CrEaTiiOn_ClasicHeaderLabel : System.Windows.Forms.Label
|
||||
{
|
||||
|
||||
public CrEaTiiOn_ClasicHeaderLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 11, FontStyle.Bold);
|
||||
ForeColor = Color.White;
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region Label5
|
||||
|
||||
public class CrEaTiiOn_ClasicLabel : System.Windows.Forms.Label
|
||||
{
|
||||
public CrEaTiiOn_ClasicLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 9, FontStyle.Regular);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = ColorTranslator.FromHtml("#FFFFFF");
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
Focus();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region Label7
|
||||
|
||||
public class CrEaTiiOn_FancyLabel : Control
|
||||
{
|
||||
public CrEaTiiOn_FancyLabel()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
DoubleBuffered = true;
|
||||
Size = new(96, 16);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
//Rectangle ClientRectangle = new(0, 0, Width - 1, Height - 1);
|
||||
base.OnPaint(e);
|
||||
G.Clear(BackColor);
|
||||
Font drawFont = new("", 9, FontStyle.Bold);
|
||||
StringFormat format = new() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center };
|
||||
G.CompositingQuality = CompositingQuality.HighQuality;
|
||||
G.SmoothingMode = SmoothingMode.HighQuality;
|
||||
G.DrawString(Text, drawFont, new SolidBrush(Color.FromArgb(5, 5, 5)), new Rectangle(1, 0, Width - 1, Height - 1), format);
|
||||
G.DrawString(Text, drawFont, new SolidBrush(ForeColor), new Rectangle(0, -1, Width - 1, Height - 1), format);
|
||||
e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
|
||||
G.Dispose();
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region Label2
|
||||
|
||||
public class CrEaTiiOn_FlatLabel : System.Windows.Forms.Label
|
||||
{
|
||||
|
||||
public CrEaTiiOn_FlatLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 11);
|
||||
ForeColor = Color.White;
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_HeaderLabel
|
||||
|
||||
public class CrEaTiiOn_HeaderLabel : System.Windows.Forms.Label
|
||||
{
|
||||
public CrEaTiiOn_HeaderLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 11, FontStyle.Bold);
|
||||
ForeColor = Color.FromArgb(255, 255, 255);
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Label
|
||||
|
||||
public class CrEaTiiOn_Label : System.Windows.Forms.Label
|
||||
{
|
||||
#region Field Region
|
||||
|
||||
private bool _autoUpdateHeight;
|
||||
private bool _isGrowing;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property Region
|
||||
|
||||
[Category("Layout")]
|
||||
[Description("Enables automatic height sizing based on the contents of the label.")]
|
||||
[DefaultValue(false)]
|
||||
public bool AutoUpdateHeight
|
||||
{
|
||||
get => _autoUpdateHeight;
|
||||
set
|
||||
{
|
||||
_autoUpdateHeight = value;
|
||||
|
||||
if (_autoUpdateHeight)
|
||||
{
|
||||
AutoSize = false;
|
||||
ResizeLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public new bool AutoSize
|
||||
{
|
||||
get => base.AutoSize;
|
||||
set
|
||||
{
|
||||
base.AutoSize = value;
|
||||
|
||||
if (AutoSize)
|
||||
{
|
||||
AutoUpdateHeight = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor Region
|
||||
|
||||
public CrEaTiiOn_Label()
|
||||
{
|
||||
ForeColor = Color.White;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method Region
|
||||
|
||||
private void ResizeLabel()
|
||||
{
|
||||
if (!_autoUpdateHeight || _isGrowing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_isGrowing = true;
|
||||
Size sz = new(Width, int.MaxValue);
|
||||
sz = TextRenderer.MeasureText(Text, Font, sz, TextFormatFlags.WordBreak);
|
||||
Height = sz.Height + Padding.Vertical;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isGrowing = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handler Region
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
ResizeLabel();
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
{
|
||||
base.OnFontChanged(e);
|
||||
ResizeLabel();
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
ResizeLabel();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Reflection.Emit;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_MetroLabel : Control
|
||||
{
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
public CrEaTiiOn_MetroLabel()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
Font = new Font("Segoe UI", 10);
|
||||
ForeColor = Color.White;
|
||||
BackColor = Color.Transparent;
|
||||
Text = Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ModernHeaderLabel
|
||||
|
||||
public class CrEaTiiOn_ModernHeaderLabel : System.Windows.Forms.Label
|
||||
{
|
||||
#region Properties
|
||||
|
||||
private PanelSide _Side;
|
||||
[Browsable(true)]
|
||||
[Description("Determines the foreground color of the label according to which side it is placed on.")]
|
||||
public PanelSide Side
|
||||
{
|
||||
get => _Side;
|
||||
set
|
||||
{
|
||||
_Side = value;
|
||||
switch (value)
|
||||
{
|
||||
case PanelSide.LeftPanel:
|
||||
ForeColor = _LeftSideForeColor;
|
||||
break;
|
||||
case PanelSide.RightPanel:
|
||||
ForeColor = _RightSideForeColor;
|
||||
break;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _LeftSideForeColor = ColorTranslator.FromHtml("#FAFAFA");
|
||||
public Color LeftSideForeColor
|
||||
{
|
||||
get => _LeftSideForeColor;
|
||||
set
|
||||
{
|
||||
_LeftSideForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _RightSideForeColor = ColorTranslator.FromHtml("#AAABB0");
|
||||
public Color RightSideForeColor
|
||||
{
|
||||
get => _RightSideForeColor;
|
||||
set
|
||||
{
|
||||
_RightSideForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
|
||||
[Browsable(true)]
|
||||
[Description("Specifies the quality of text rendering.")]
|
||||
public TextRenderingHint TextRenderingHint
|
||||
{
|
||||
get => _TextRenderingHint;
|
||||
set
|
||||
{
|
||||
_TextRenderingHint = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Enum
|
||||
|
||||
public enum PanelSide
|
||||
{
|
||||
LeftPanel,
|
||||
RightPanel
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_ModernHeaderLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 22, FontStyle.Regular, GraphicsUnit.Point);
|
||||
TextAlign = ContentAlignment.MiddleCenter;
|
||||
ForeColor = _RightSideForeColor;
|
||||
BackColor = Color.Transparent;
|
||||
UseCompatibleTextRendering = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
Focus();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.TextRenderingHint = _TextRenderingHint;
|
||||
base.OnPaint(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region Label3
|
||||
|
||||
public class CrEaTiiOn_ModernLabel : System.Windows.Forms.Label
|
||||
{
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
public CrEaTiiOn_ModernLabel()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
Font = new("Segoe UI", 8);
|
||||
ForeColor = Color.LightGray;
|
||||
BackColor = Color.Transparent;
|
||||
Text = Text;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region SmallLabel
|
||||
|
||||
public class CrEaTiiOn_SmallLabel : System.Windows.Forms.Label
|
||||
{
|
||||
public CrEaTiiOn_SmallLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 8);
|
||||
ForeColor = Color.FromArgb(142, 142, 142);
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_LabelEdit
|
||||
|
||||
public class CrEaTiiOn_LabelEdit : System.Windows.Forms.Label
|
||||
{
|
||||
public CrEaTiiOn_LabelEdit()
|
||||
{
|
||||
Font = new("Microsoft Sans Serif", 9);
|
||||
ForeColor = Color.FromArgb(116, 125, 132);
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_LinkLabel
|
||||
|
||||
public class CrEaTiiOn_LinkLabel : System.Windows.Forms.LinkLabel
|
||||
{
|
||||
public CrEaTiiOn_LinkLabel()
|
||||
{
|
||||
Font = new("Segoe UI", 11, FontStyle.Regular);
|
||||
BackColor = Color.Transparent;
|
||||
LinkColor = Color.FromArgb(240, 119, 70);
|
||||
ActiveLinkColor = Color.FromArgb(221, 72, 20);
|
||||
VisitedLinkColor = Color.FromArgb(240, 119, 70);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_LinkLabelEdit
|
||||
|
||||
public class CrEaTiiOn_LinkLabelEdit : System.Windows.Forms.LinkLabel
|
||||
{
|
||||
public CrEaTiiOn_LinkLabelEdit()
|
||||
{
|
||||
Font = new("Microsoft Sans Serif", 9, FontStyle.Regular);
|
||||
BackColor = Color.Transparent;
|
||||
LinkColor = Color.FromArgb(32, 34, 37);
|
||||
ActiveLinkColor = Color.FromArgb(153, 34, 34);
|
||||
VisitedLinkColor = Color.FromArgb(32, 34, 37);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ListBox
|
||||
|
||||
public class CrEaTiiOn_ListBox : System.Windows.Forms.ListBox
|
||||
{
|
||||
|
||||
public CrEaTiiOn_ListBox()
|
||||
{
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
|
||||
DrawMode = DrawMode.OwnerDrawFixed;
|
||||
IntegralHeight = false;
|
||||
ItemHeight = 18;
|
||||
Font = new("Seoge UI", 11, FontStyle.Regular);
|
||||
}
|
||||
|
||||
protected override void OnDrawItem(DrawItemEventArgs e)
|
||||
{
|
||||
base.OnDrawItem(e);
|
||||
e.DrawBackground();
|
||||
LinearGradientBrush LGB = new(e.Bounds, Color.FromArgb(250, 36, 38), Color.FromArgb(20, 20, 20), 90.0F);
|
||||
if (Convert.ToInt32((e.State & DrawItemState.Selected)) == (int)DrawItemState.Selected)
|
||||
{
|
||||
e.Graphics.FillRectangle(LGB, e.Bounds);
|
||||
}
|
||||
|
||||
using (SolidBrush b = new(e.ForeColor))
|
||||
{
|
||||
if (base.Items.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawString(base.GetItemText(base.Items[e.Index]), e.Font, b, e.Bounds);
|
||||
}
|
||||
}
|
||||
|
||||
LGB.Dispose();
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Region MyRegion = new(e.ClipRectangle);
|
||||
e.Graphics.FillRegion(new SolidBrush(BackColor), MyRegion);
|
||||
|
||||
if (Items.Count > 0)
|
||||
{
|
||||
for (int i = 0; i <= Items.Count - 1; i++)
|
||||
{
|
||||
System.Drawing.Rectangle RegionRect = GetItemRectangle(i);
|
||||
if (e.ClipRectangle.IntersectsWith(RegionRect))
|
||||
{
|
||||
if ((SelectionMode == SelectionMode.One && SelectedIndex == i) || (SelectionMode == SelectionMode.MultiSimple && SelectedIndices.Contains(i)) || (SelectionMode == SelectionMode.MultiExtended && SelectedIndices.Contains(i)))
|
||||
{
|
||||
OnDrawItem(new DrawItemEventArgs(e.Graphics, Font, RegionRect, i, DrawItemState.Selected, ForeColor, BackColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDrawItem(new DrawItemEventArgs(e.Graphics, Font, RegionRect, i, DrawItemState.Default, Color.FromArgb(15, 15, 15), BackColor));
|
||||
}
|
||||
|
||||
MyRegion.Complement(RegionRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_MenuColorTable : ProfessionalColorTable
|
||||
{
|
||||
//Fields
|
||||
private Color backColor;
|
||||
private Color leftColumnColor;
|
||||
private Color borderColor;
|
||||
private Color menuItemBorderColor;
|
||||
private Color menuItemSelectedColor;
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_MenuColorTable(bool isMainMenu, Color primaryColor)
|
||||
{
|
||||
if (isMainMenu)
|
||||
{
|
||||
backColor = Color.FromArgb(37, 39, 60);
|
||||
leftColumnColor = Color.FromArgb(32, 33, 51);
|
||||
borderColor = Color.FromArgb(32, 33, 51);
|
||||
menuItemBorderColor = primaryColor;
|
||||
menuItemSelectedColor = primaryColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
backColor = Color.White;
|
||||
leftColumnColor = Color.LightGray;
|
||||
borderColor = Color.LightGray;
|
||||
menuItemBorderColor = primaryColor;
|
||||
menuItemSelectedColor = primaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
//Overrides
|
||||
public override Color ToolStripDropDownBackground { get { return backColor; } }
|
||||
public override Color MenuBorder { get { return borderColor; } }
|
||||
public override Color MenuItemBorder { get { return menuItemBorderColor; } }
|
||||
public override Color MenuItemSelected { get { return menuItemSelectedColor; } }
|
||||
public override Color ImageMarginGradientBegin { get { return leftColumnColor; } }
|
||||
public override Color ImageMarginGradientMiddle { get { return leftColumnColor; } }
|
||||
public override Color ImageMarginGradientEnd { get { return leftColumnColor; } }
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using CBH.RJControls;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_MenuRenderer : ToolStripProfessionalRenderer
|
||||
{
|
||||
//Fields
|
||||
private Color primaryColor;
|
||||
private Color textColor;
|
||||
private int arrowThickness;
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_MenuRenderer(bool isMainMenu, Color primaryColor, Color textColor)
|
||||
: base(new CrEaTiiOn_MenuColorTable(isMainMenu, primaryColor))
|
||||
{
|
||||
this.primaryColor = primaryColor;
|
||||
if (isMainMenu)
|
||||
{
|
||||
arrowThickness = 3;
|
||||
if (textColor == Color.Empty) //Set Default Color
|
||||
this.textColor = Color.Gainsboro;
|
||||
else//Set custom text color
|
||||
this.textColor = textColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
arrowThickness = 2;
|
||||
if (textColor == Color.Empty) //Set Default Color
|
||||
this.textColor = Color.DimGray;
|
||||
else//Set custom text color
|
||||
this.textColor = textColor;
|
||||
}
|
||||
}
|
||||
|
||||
//Overrides
|
||||
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
|
||||
{
|
||||
base.OnRenderItemText(e);
|
||||
e.Item.ForeColor = e.Item.Selected ? Color.White : textColor;
|
||||
}
|
||||
|
||||
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
|
||||
{
|
||||
//Fields
|
||||
var graph = e.Graphics;
|
||||
var arrowSize = new Size(5, 12);
|
||||
var arrowColor = e.Item.Selected ? Color.White : primaryColor;
|
||||
var rect = new Rectangle(e.ArrowRectangle.Location.X, (e.ArrowRectangle.Height - arrowSize.Height) / 2,
|
||||
arrowSize.Width, arrowSize.Height);
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
using (Pen pen = new Pen(arrowColor, arrowThickness))
|
||||
{
|
||||
//Drawing
|
||||
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
path.AddLine(rect.Left, rect.Top, rect.Right, rect.Top + rect.Height / 2);
|
||||
path.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Left, rect.Top + rect.Height);
|
||||
graph.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#region Imports
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class MenuColorTable : ProfessionalColorTable
|
||||
{
|
||||
private Color backColor;
|
||||
private Color leftColumnColor;
|
||||
private Color borderColor;
|
||||
private Color menuItemBorderColor;
|
||||
private Color menuItemSelectedColor;
|
||||
|
||||
public MenuColorTable(bool isMainMenu, Color primaryColor)
|
||||
{
|
||||
if (isMainMenu)
|
||||
{
|
||||
this.backColor = Color.FromArgb(37, 39, 60);
|
||||
this.leftColumnColor = Color.FromArgb(32, 33, 51);
|
||||
this.borderColor = Color.FromArgb(32, 33, 51);
|
||||
this.menuItemBorderColor = primaryColor;
|
||||
this.menuItemSelectedColor = primaryColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.backColor = Color.White;
|
||||
this.leftColumnColor = Color.LightGray;
|
||||
this.borderColor = Color.LightGray;
|
||||
this.menuItemBorderColor = primaryColor;
|
||||
this.menuItemSelectedColor = primaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
public override Color ToolStripDropDownBackground => this.backColor;
|
||||
|
||||
public override Color MenuBorder => this.borderColor;
|
||||
|
||||
public override Color MenuItemBorder => this.menuItemBorderColor;
|
||||
|
||||
public override Color MenuItemSelected => this.menuItemSelectedColor;
|
||||
|
||||
public override Color ImageMarginGradientBegin => this.leftColumnColor;
|
||||
|
||||
public override Color ImageMarginGradientMiddle => this.leftColumnColor;
|
||||
|
||||
public override Color ImageMarginGradientEnd => this.leftColumnColor;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#region Imports
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class MenuRenderer : ToolStripProfessionalRenderer
|
||||
{
|
||||
private Color primaryColor;
|
||||
private Color textColor;
|
||||
private int arrowThickness;
|
||||
|
||||
public MenuRenderer(bool isMainMenu, Color primaryColor, Color textColor)
|
||||
: base((ProfessionalColorTable) new MenuColorTable(isMainMenu, primaryColor))
|
||||
{
|
||||
this.primaryColor = primaryColor;
|
||||
if (isMainMenu)
|
||||
{
|
||||
this.arrowThickness = 3;
|
||||
if (textColor == Color.Empty)
|
||||
this.textColor = Color.Gainsboro;
|
||||
else
|
||||
this.textColor = textColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.arrowThickness = 2;
|
||||
this.textColor = !(textColor == Color.Empty) ? textColor : Color.DimGray;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
|
||||
{
|
||||
base.OnRenderItemText(e);
|
||||
e.Item.ForeColor = e.Item.Selected ? Color.Black : this.textColor;
|
||||
}
|
||||
|
||||
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
Size size = new Size(5, 12);
|
||||
Color color = e.Item.Selected ? Color.Blue : this.primaryColor;
|
||||
Rectangle rectangle = new Rectangle(e.ArrowRectangle.Location.X, (e.ArrowRectangle.Height - size.Height) / 2, size.Width, size.Height);
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
using (Pen pen = new Pen(color, (float) this.arrowThickness))
|
||||
{
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
path.AddLine(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Top + rectangle.Height / 2);
|
||||
path.AddLine(rectangle.Right, rectangle.Top + rectangle.Height / 2, rectangle.Left, rectangle.Top + rectangle.Height);
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_Message : Control
|
||||
{
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
g.Clear(Parent.BackColor);
|
||||
|
||||
DrawingHelper dh = new DrawingHelper();
|
||||
MultiLineHandler mlh = new MultiLineHandler();
|
||||
int slope = Adjustments.Roundness;
|
||||
|
||||
Rectangle mainRect = new Rectangle(0, 0, Width - 1, Height - 1);
|
||||
GraphicsPath mainPath = dh.RoundRect(mainRect, slope);
|
||||
|
||||
Color bgColor = new Color();
|
||||
Color borderColor = new Color();
|
||||
Color textColor = new Color();
|
||||
|
||||
bgColor = dh.AdjustColor(BackColor, 30, DrawingHelper.ColorAdjustmentType.Lighten);
|
||||
|
||||
ColorBlend bgCB = new ColorBlend(3);
|
||||
bgCB.Colors = new[] { bgColor, bgColor, dh.AdjustColor(bgColor, 15, DrawingHelper.ColorAdjustmentType.Darken) };
|
||||
bgCB.Positions = new[] { 0.0F, 0.7F, 1.0F };
|
||||
|
||||
LinearGradientBrush bgLGB = new LinearGradientBrush(mainRect, Color.FromArgb(250, 36, 38), Color.FromArgb(250, 36, 38), 90.0F);
|
||||
bgLGB.InterpolationColors = bgCB;
|
||||
|
||||
borderColor = dh.AdjustColor(bgColor, 20, DrawingHelper.ColorAdjustmentType.Darken);
|
||||
textColor = dh.AdjustColor(bgColor, 95, DrawingHelper.ColorAdjustmentType.Darken);
|
||||
|
||||
g.FillPath(bgLGB, mainPath);
|
||||
g.DrawPath(new Pen(borderColor), mainPath);
|
||||
|
||||
int descY = 0;
|
||||
|
||||
if (Header != null)
|
||||
{
|
||||
g.DrawString(_header, _headerFont, new SolidBrush(textColor), new Point(8, 8));
|
||||
descY = (int)(8 + g.MeasureString(_header, _headerFont).Height + 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
descY = 8;
|
||||
}
|
||||
|
||||
foreach (string line in mlh.GetLines(g, Text, Font, Width - 16))
|
||||
{
|
||||
g.DrawString(line, Font, new SolidBrush(textColor), new Point(8, descY));
|
||||
descY += 13;
|
||||
}
|
||||
|
||||
if (_sizeByText)
|
||||
{
|
||||
Size = new Size(Width, 8 + descY + 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CrEaTiiOn_Message()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
|
||||
BackColor = Color.FromArgb(250, 36, 38);
|
||||
Font = new Font(Adjustments.DefaultFontFamily, 8);
|
||||
Size = new Size(600, 80);
|
||||
}
|
||||
|
||||
private string _header = "Welcome!";
|
||||
public string Header
|
||||
{
|
||||
get
|
||||
{
|
||||
return _header;
|
||||
}
|
||||
set
|
||||
{
|
||||
_header = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Font _headerFont = new Font(Adjustments.DefaultFontFamily, 10F, FontStyle.Bold);
|
||||
public Font HeaderFont
|
||||
{
|
||||
get
|
||||
{
|
||||
return _headerFont;
|
||||
}
|
||||
set
|
||||
{
|
||||
_headerFont = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _sizeByText = false;
|
||||
public bool SizeByText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _sizeByText;
|
||||
}
|
||||
set
|
||||
{
|
||||
_sizeByText = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
{
|
||||
base.OnFontChanged(e);
|
||||
Font = new Font(Font.FontFamily, 8);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,476 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_NotificationBox
|
||||
|
||||
public class CrEaTiiOn_NotificationBox : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
private Point CloseCoordinates;
|
||||
private bool IsOverClose;
|
||||
private int _BorderCurve = 8;
|
||||
private GraphicsPath CreateRoundPath;
|
||||
private string NotificationText = null;
|
||||
private Type _NotificationType;
|
||||
private bool _RoundedCorners;
|
||||
private bool _ShowCloseButton;
|
||||
private Image _Image;
|
||||
private Size _ImageSize;
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
private Color _CloseForeColor = Color.Black;
|
||||
private Color _ErrorBackColor = Color.Crimson;
|
||||
private Color _ErrorForeColor = Color.White;
|
||||
private Color _ErrorBorderColor = Color.Crimson;
|
||||
private Color _SuccessBackColor = Color.SeaGreen;
|
||||
private Color _SuccessForeColor = Color.White;
|
||||
private Color _SuccessBorderColor = Color.SeaGreen;
|
||||
private Color _WarningBackColor = Color.FromArgb(255, 128, 0);
|
||||
private Color _WarningForeColor = Color.White;
|
||||
private Color _WarningBorderColor = Color.FromArgb(255, 128, 0);
|
||||
private Color _NoticeBackColor = Color.FromArgb(20, 20, 20);
|
||||
private Color _NoticeForeColor = Color.White;
|
||||
private Color _NoticeBorderColor = Color.FromArgb(250, 36, 38);
|
||||
private string _ErrorTitleText = "ERROR!";
|
||||
private string _SuccessTitleText = "SUCCESS!";
|
||||
private string _WarningTitleText = "WARNING!";
|
||||
private string _NoticeTitleText = "NOTICE!";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Enums
|
||||
|
||||
// Create a list of Notification Types
|
||||
public enum Type
|
||||
{
|
||||
@Notice,
|
||||
@Success,
|
||||
@Warning,
|
||||
@Error
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Custom Properties
|
||||
|
||||
// Create a NotificationType property and add the Type enum to it
|
||||
public Type NotificationType
|
||||
{
|
||||
get => _NotificationType;
|
||||
set
|
||||
{
|
||||
_NotificationType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// Boolean value to determine whether the control should use border radius
|
||||
public bool RoundCorners
|
||||
{
|
||||
get => _RoundedCorners;
|
||||
set
|
||||
{
|
||||
_RoundedCorners = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// Boolean value to determine whether the control should draw the close button
|
||||
public bool ShowCloseButton
|
||||
{
|
||||
get => _ShowCloseButton;
|
||||
set
|
||||
{
|
||||
_ShowCloseButton = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// Integer value to determine the curve level of the borders
|
||||
public int BorderCurve
|
||||
{
|
||||
get => _BorderCurve;
|
||||
set
|
||||
{
|
||||
_BorderCurve = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// Image value to determine whether the control should draw an image before the header
|
||||
public Image Image
|
||||
{
|
||||
get => _Image;
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
_ImageSize = Size.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ImageSize = value.Size;
|
||||
}
|
||||
|
||||
_Image = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
// Size value - returns the image size
|
||||
protected Size ImageSize => _ImageSize;
|
||||
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color CloseForeColor
|
||||
{
|
||||
get => _CloseForeColor;
|
||||
set
|
||||
{
|
||||
_CloseForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color ErrorBackColor
|
||||
{
|
||||
get => _ErrorBackColor;
|
||||
set
|
||||
{
|
||||
_ErrorBackColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color ErrorForeColor
|
||||
{
|
||||
get => _ErrorForeColor;
|
||||
set
|
||||
{
|
||||
_ErrorForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color ErrorBorderColor
|
||||
{
|
||||
get => _ErrorBorderColor;
|
||||
set
|
||||
{
|
||||
_ErrorBorderColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color SuccessBackColor
|
||||
{
|
||||
get => _SuccessBackColor;
|
||||
set
|
||||
{
|
||||
_SuccessBackColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color SuccessForeColor
|
||||
{
|
||||
get => _SuccessForeColor;
|
||||
set
|
||||
{
|
||||
_SuccessForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color SuccessBorderColor
|
||||
{
|
||||
get => _SuccessBorderColor;
|
||||
set
|
||||
{
|
||||
_SuccessBorderColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color WarningBackColor
|
||||
{
|
||||
get => _WarningBackColor;
|
||||
set
|
||||
{
|
||||
_WarningBackColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color WarningForeColor
|
||||
{
|
||||
get => _WarningForeColor;
|
||||
set
|
||||
{
|
||||
_WarningForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color WarningBorderColor
|
||||
{
|
||||
get => _WarningBorderColor;
|
||||
set
|
||||
{
|
||||
_WarningBorderColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color NoticeBackColor
|
||||
{
|
||||
get => _NoticeBackColor;
|
||||
set
|
||||
{
|
||||
_NoticeBackColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color NoticeForeColor
|
||||
{
|
||||
get => _NoticeForeColor;
|
||||
set
|
||||
{
|
||||
_NoticeForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color NoticeBorderColor
|
||||
{
|
||||
get => _NoticeBorderColor;
|
||||
set
|
||||
{
|
||||
_NoticeBorderColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public string ErrorTitleText
|
||||
{
|
||||
get => _ErrorTitleText;
|
||||
set
|
||||
{
|
||||
_ErrorTitleText = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public string SuccessTitleText
|
||||
{
|
||||
get => _SuccessTitleText;
|
||||
set
|
||||
{
|
||||
_SuccessTitleText = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public string WarningTitleText
|
||||
{
|
||||
get => _WarningTitleText;
|
||||
set
|
||||
{
|
||||
_WarningTitleText = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public string NoticeTitleText
|
||||
{
|
||||
get => _NoticeTitleText;
|
||||
set
|
||||
{
|
||||
_NoticeTitleText = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
// Decides the location of the drawn ellipse. If mouse is over the correct coordinates, "IsOverClose" boolean will be triggered to draw the ellipse
|
||||
if (e.X >= Width - 19 && e.X <= Width - 10 && e.Y > CloseCoordinates.Y && e.Y < CloseCoordinates.Y + 12 && ShowCloseButton)
|
||||
{
|
||||
IsOverClose = true;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsOverClose = false;
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
// Updates the control
|
||||
Invalidate();
|
||||
}
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
|
||||
// Disposes the control when the close button is clicked
|
||||
if (_ShowCloseButton == true)
|
||||
{
|
||||
if (IsOverClose)
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal GraphicsPath CreateRoundRect(Rectangle r, int curve)
|
||||
{
|
||||
// Draw a border radius
|
||||
try
|
||||
{
|
||||
CreateRoundPath = new(FillMode.Winding);
|
||||
CreateRoundPath.AddArc(r.X, r.Y, curve, curve, 180.0F, 90.0F);
|
||||
CreateRoundPath.AddArc(r.Right - curve, r.Y, curve, curve, 270.0F, 90.0F);
|
||||
CreateRoundPath.AddArc(r.Right - curve, r.Bottom - curve, curve, curve, 0.0F, 90.0F);
|
||||
CreateRoundPath.AddArc(r.X, r.Bottom - curve, curve, curve, 90.0F, 90.0F);
|
||||
CreateRoundPath.CloseFigure();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show(ex.Message + Environment.NewLine + Environment.NewLine + "Value must be either \'1\' or higher", "Invalid Integer", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
// Return to the default border curve if the parameter is less than "1"
|
||||
_BorderCurve = 8;
|
||||
BorderCurve = 8;
|
||||
}
|
||||
return CreateRoundPath;
|
||||
}
|
||||
|
||||
public CrEaTiiOn_NotificationBox()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);
|
||||
Font = new("Tahoma", 9);
|
||||
MinimumSize = new(100, 40);
|
||||
RoundCorners = false;
|
||||
Size = new(130, 40);
|
||||
ShowCloseButton = true;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
// Declare Graphics to draw the control
|
||||
Graphics GFX = e.Graphics;
|
||||
// Declare Color to paint the control's Text, Background and Border
|
||||
Color ForeColor = new();
|
||||
Color BackgroundColor = new();
|
||||
Color BorderColor = new();
|
||||
// Determine the header Notification Type font
|
||||
Font TypeFont = new(Font.FontFamily, Font.Size, FontStyle.Bold);
|
||||
// Decalre a new rectangle to draw the control inside it
|
||||
Rectangle MainRectangle = new(0, 0, Width - 1, Height - 1);
|
||||
// Declare a GraphicsPath to create a border radius
|
||||
GraphicsPath CrvBorderPath = CreateRoundRect(MainRectangle, _BorderCurve);
|
||||
|
||||
GFX.SmoothingMode = SmoothingType;
|
||||
GFX.TextRenderingHint = TextRenderingType;
|
||||
GFX.Clear(Parent.BackColor);
|
||||
|
||||
switch (_NotificationType)
|
||||
{
|
||||
case Type.Notice:
|
||||
NotificationText = NoticeTitleText;
|
||||
BackgroundColor = NoticeBackColor;
|
||||
BorderColor = NoticeBorderColor;
|
||||
ForeColor = NoticeForeColor;
|
||||
break;
|
||||
case Type.Success:
|
||||
NotificationText = SuccessTitleText;
|
||||
BackgroundColor = SuccessBackColor;
|
||||
BorderColor = SuccessBorderColor;
|
||||
ForeColor = SuccessForeColor;
|
||||
break;
|
||||
case Type.Warning:
|
||||
NotificationText = WarningTitleText;
|
||||
BackgroundColor = WarningBackColor;
|
||||
BorderColor = WarningBorderColor;
|
||||
ForeColor = WarningForeColor;
|
||||
break;
|
||||
case Type.Error:
|
||||
NotificationText = ErrorTitleText;
|
||||
BackgroundColor = ErrorBackColor;
|
||||
BorderColor = ErrorBorderColor;
|
||||
ForeColor = ErrorForeColor;
|
||||
break;
|
||||
}
|
||||
|
||||
if (_RoundedCorners)
|
||||
{
|
||||
GFX.FillPath(new SolidBrush(BackgroundColor), CrvBorderPath);
|
||||
GFX.DrawPath(new(BorderColor), CrvBorderPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
GFX.FillRectangle(new SolidBrush(BackgroundColor), MainRectangle);
|
||||
GFX.DrawRectangle(new(BorderColor), MainRectangle);
|
||||
}
|
||||
|
||||
if (Image == null)
|
||||
{
|
||||
GFX.DrawString(NotificationText, TypeFont, new SolidBrush(ForeColor), new Point(10, 5));
|
||||
GFX.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(10, 21, Width - 17, Height - 5));
|
||||
}
|
||||
else
|
||||
{
|
||||
GFX.DrawImage(_Image, 12, 4, 16, 16);
|
||||
GFX.DrawString(NotificationText, TypeFont, new SolidBrush(ForeColor), new Point(30, 5));
|
||||
GFX.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(10, 21, Width - 17, Height - 5));
|
||||
}
|
||||
|
||||
CloseCoordinates = new(Width - 26, 4);
|
||||
|
||||
if (_ShowCloseButton)
|
||||
{
|
||||
GFX.DrawString("r", new Font("Marlett", 7, FontStyle.Regular), new SolidBrush(CloseForeColor), new Rectangle(Width - 20, 10, Width, Height), new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Near }); // Draw the close button
|
||||
}
|
||||
|
||||
CrvBorderPath.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,342 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Numeric
|
||||
|
||||
public class CrEaTiiOn_Numeric : Control
|
||||
{
|
||||
#region " Properties & Flicker Control "
|
||||
private int X;
|
||||
private int Y;
|
||||
private long _Value;
|
||||
private long _Max;
|
||||
private long _Min;
|
||||
private bool Typing;
|
||||
|
||||
public long Value
|
||||
{
|
||||
get => _Value;
|
||||
set
|
||||
{
|
||||
if (value <= _Max & value >= _Min)
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public long Maximum
|
||||
{
|
||||
get => _Max;
|
||||
set
|
||||
{
|
||||
if (value > _Min)
|
||||
{
|
||||
_Max = value;
|
||||
}
|
||||
|
||||
if (_Value > _Max)
|
||||
{
|
||||
_Value = _Max;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public long Minimum
|
||||
{
|
||||
get => _Min;
|
||||
set
|
||||
{
|
||||
if (value < _Max)
|
||||
{
|
||||
_Min = value;
|
||||
}
|
||||
|
||||
if (_Value < _Min)
|
||||
{
|
||||
_Value = _Min;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
X = e.Location.X;
|
||||
Y = e.Location.Y;
|
||||
Invalidate();
|
||||
if (e.X < Width - 23)
|
||||
{
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = 30;
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseClick(e);
|
||||
if (X > Width - 21 && X < Width - 3)
|
||||
{
|
||||
if (Y < 15)
|
||||
{
|
||||
if ((Value + 1) <= _Max)
|
||||
{
|
||||
_Value += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Value - 1) >= _Min)
|
||||
{
|
||||
_Value -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Typing = !Typing;
|
||||
Focus();
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnKeyPress(KeyPressEventArgs e)
|
||||
{
|
||||
base.OnKeyPress(e);
|
||||
try
|
||||
{
|
||||
if (Typing)
|
||||
{
|
||||
_Value = Convert.ToInt32(Convert.ToString(Convert.ToString(_Value) + e.KeyChar.ToString()));
|
||||
}
|
||||
|
||||
if (_Value > _Max) { _Value = _Max; }
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnKeyUp(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyUp(e);
|
||||
if (e.KeyCode == Keys.Up)
|
||||
{
|
||||
if ((Value + 1) <= _Max)
|
||||
{
|
||||
_Value += 1;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
else if (e.KeyCode == Keys.Down)
|
||||
{
|
||||
if ((Value - 1) >= _Min)
|
||||
{
|
||||
_Value -= 1;
|
||||
}
|
||||
}
|
||||
else if (e.KeyCode == Keys.Back)
|
||||
{
|
||||
string tmp = _Value.ToString();
|
||||
tmp = tmp.Remove(Convert.ToInt32(tmp.Length - 1));
|
||||
if (tmp.Length == 0) { tmp = "0"; }
|
||||
_Value = Convert.ToInt32(tmp);
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected void DrawTriangle(Color Clr, Point FirstPoint, Point SecondPoint, Point ThirdPoint, Graphics G)
|
||||
{
|
||||
List<Point> points = new()
|
||||
{
|
||||
FirstPoint,
|
||||
SecondPoint,
|
||||
ThirdPoint
|
||||
};
|
||||
G.FillPolygon(new SolidBrush(Clr), points.ToArray());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Variables
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
private Color _TopTriangleColor = Color.FromArgb(255, 255, 255);
|
||||
private Color _BotTriangleColor = Color.FromArgb(255, 255, 255);
|
||||
private Color _BorderColorA = Color.FromArgb(250, 36, 38);
|
||||
private Color _BorderColorB = Color.FromArgb(250, 36, 38);
|
||||
private Color _BorderColorC = Color.FromArgb(250, 36, 38);
|
||||
private Color _BorderColorD = Color.FromArgb(250, 36, 38);
|
||||
private Color _ButtonBackColorA = Color.FromArgb(20, 20, 20);
|
||||
private Color _ButtonBackColorB = Color.FromArgb(15, 15, 15);
|
||||
private Color _ButtonBorderColorA = Color.FromArgb(250, 36, 38);
|
||||
private Color _ButtonBorderColorB = Color.FromArgb(250, 36, 38);
|
||||
private Color _ButtonBorderColorC = Color.FromArgb(250, 36, 38);
|
||||
private Color _ButtonBorderColorD = Color.FromArgb(250, 36, 38);
|
||||
private Color _ButtonBorderColorE = Color.FromArgb(250, 36, 38);
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color TopTriangleColor
|
||||
{
|
||||
get => _TopTriangleColor;
|
||||
set => _TopTriangleColor = value;
|
||||
}
|
||||
|
||||
public Color BotTriangleColor
|
||||
{
|
||||
get => _BotTriangleColor;
|
||||
set => _BotTriangleColor = value;
|
||||
}
|
||||
|
||||
public Color BorderColorA
|
||||
{
|
||||
get => _BorderColorA;
|
||||
set => _BorderColorA = value;
|
||||
}
|
||||
|
||||
public Color BorderColorB
|
||||
{
|
||||
get => _BorderColorB;
|
||||
set => _BorderColorB = value;
|
||||
}
|
||||
|
||||
public Color BorderColorC
|
||||
{
|
||||
get => _BorderColorC;
|
||||
set => _BorderColorC = value;
|
||||
}
|
||||
|
||||
public Color BorderColorD
|
||||
{
|
||||
get => _BorderColorD;
|
||||
set => _BorderColorD = value;
|
||||
}
|
||||
|
||||
public Color ButtonBackColorA
|
||||
{
|
||||
get => _ButtonBackColorA;
|
||||
set => _ButtonBackColorA = value;
|
||||
}
|
||||
|
||||
public Color ButtonBackColorB
|
||||
{
|
||||
get => _ButtonBackColorB;
|
||||
set => _ButtonBackColorB = value;
|
||||
}
|
||||
|
||||
public Color ButtonBorderColorA
|
||||
{
|
||||
get => _ButtonBorderColorA;
|
||||
set => _ButtonBorderColorA = value;
|
||||
}
|
||||
|
||||
public Color ButtonBorderColorB
|
||||
{
|
||||
get => _ButtonBorderColorB;
|
||||
set => _ButtonBorderColorB = value;
|
||||
}
|
||||
|
||||
public Color ButtonBorderColorC
|
||||
{
|
||||
get => _ButtonBorderColorC;
|
||||
set => _ButtonBorderColorC = value;
|
||||
}
|
||||
|
||||
public Color ButtonBorderColorD
|
||||
{
|
||||
get => _ButtonBorderColorD;
|
||||
set => _ButtonBorderColorD = value;
|
||||
}
|
||||
|
||||
public Color ButtonBorderColorE
|
||||
{
|
||||
get => _ButtonBorderColorE;
|
||||
set => _ButtonBorderColorE = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_Numeric()
|
||||
{
|
||||
_Max = 9999999;
|
||||
_Min = 0;
|
||||
Cursor = Cursors.IBeam;
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
||||
BackColor = Color.FromArgb(20, 20, 20);
|
||||
ForeColor = Color.White;
|
||||
DoubleBuffered = true;
|
||||
Font = new("Segoe UI", 6.75f, FontStyle.Bold);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
|
||||
G.Clear(BackColor);
|
||||
G.SmoothingMode = SmoothingType;
|
||||
|
||||
LinearGradientBrush innerBorderBrush = new(new Rectangle(1, 1, Width - 3, Height - 3), BorderColorA, BorderColorB, 90);
|
||||
Pen innerBorderPen = new(innerBorderBrush);
|
||||
G.DrawRectangle(innerBorderPen, new Rectangle(1, 1, Width - 3, Height - 3));
|
||||
G.DrawLine(new(BorderColorC), new Point(1, 1), new Point(Width - 3, 1));
|
||||
|
||||
G.DrawRectangle(new(BorderColorD), new Rectangle(0, 0, Width - 1, Height - 1));
|
||||
|
||||
LinearGradientBrush buttonGradient = new(new Rectangle(Width - 23, 4, 19, 21), ButtonBackColorA, ButtonBackColorB, 90);
|
||||
G.FillRectangle(buttonGradient, buttonGradient.Rectangle);
|
||||
G.DrawRectangle(new(ButtonBorderColorA), new Rectangle(Width - 22, 5, 17, 19));
|
||||
G.DrawRectangle(new(ButtonBorderColorB), new Rectangle(Width - 23, 4, 19, 21));
|
||||
G.DrawLine(new(ButtonBorderColorC), new Point(Width - 22, Height - 4), new Point(Width - 5, Height - 4));
|
||||
G.DrawLine(new(ButtonBorderColorD), new Point(Width - 22, Height - 16), new Point(Width - 5, Height - 16));
|
||||
G.DrawLine(new(ButtonBorderColorE), new Point(Width - 22, Height - 15), new Point(Width - 5, Height - 15));
|
||||
|
||||
//Top Triangle
|
||||
DrawTriangle(TopTriangleColor, new Point(Width - 17, 18), new Point(Width - 9, 18), new Point(Width - 13, 21), G);
|
||||
|
||||
//Bottom Triangle
|
||||
DrawTriangle(BotTriangleColor, new Point(Width - 17, 10), new Point(Width - 9, 10), new Point(Width - 13, 7), G);
|
||||
|
||||
G.DrawString(Value.ToString(), Font, new SolidBrush(ForeColor), new Rectangle(5, 0, Width - 1, Height - 1), new StringFormat { LineAlignment = StringAlignment.Center });
|
||||
|
||||
e.Graphics.DrawImage(B, 0, 0);
|
||||
G.Dispose();
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,393 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ColorPalette
|
||||
|
||||
public class CrEaTiiOn_ColorPalette : Control
|
||||
{
|
||||
public CrEaTiiOn_ColorPalette()
|
||||
{
|
||||
base.Size = new Size(175, 50);
|
||||
Increment = base.Width / 7;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public new Color BackColor { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public new Color ForeColor { get; set; }
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The selected color")]
|
||||
public Color SelectedColor
|
||||
{
|
||||
get => selectedColor;
|
||||
set
|
||||
{
|
||||
selectedColor = value;
|
||||
OnColorChange();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The color of the grid")]
|
||||
public Color GridColor
|
||||
{
|
||||
get => gridColor;
|
||||
set
|
||||
{
|
||||
gridColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Show gridlines")]
|
||||
public bool ShowGrid
|
||||
{
|
||||
get => showGrid;
|
||||
set
|
||||
{
|
||||
showGrid = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 1")]
|
||||
public Color Color1
|
||||
{
|
||||
get => color1;
|
||||
set
|
||||
{
|
||||
color1 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 2")]
|
||||
public Color Color2
|
||||
{
|
||||
get => color2;
|
||||
set
|
||||
{
|
||||
color2 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 3")]
|
||||
public Color Color3
|
||||
{
|
||||
get => color3;
|
||||
set
|
||||
{
|
||||
color3 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 4")]
|
||||
public Color Color4
|
||||
{
|
||||
get => color4;
|
||||
set
|
||||
{
|
||||
color4 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 5")]
|
||||
public Color Color5
|
||||
{
|
||||
get => color5;
|
||||
set
|
||||
{
|
||||
color5 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 6")]
|
||||
public Color Color6
|
||||
{
|
||||
get => color6;
|
||||
set
|
||||
{
|
||||
color6 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 7")]
|
||||
public Color Color7
|
||||
{
|
||||
get => color7;
|
||||
set
|
||||
{
|
||||
color7 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 8")]
|
||||
public Color Color8
|
||||
{
|
||||
get => color8;
|
||||
set
|
||||
{
|
||||
color8 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 9")]
|
||||
public Color Color9
|
||||
{
|
||||
get => color9;
|
||||
set
|
||||
{
|
||||
color9 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 10")]
|
||||
public Color Color10
|
||||
{
|
||||
get => color10;
|
||||
set
|
||||
{
|
||||
color10 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 11")]
|
||||
public Color Color11
|
||||
{
|
||||
get => color11;
|
||||
set
|
||||
{
|
||||
color11 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 12")]
|
||||
public Color Color12
|
||||
{
|
||||
get => color12;
|
||||
set
|
||||
{
|
||||
color12 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 13")]
|
||||
public Color Color13
|
||||
{
|
||||
get => color13;
|
||||
set
|
||||
{
|
||||
color13 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Color 14")]
|
||||
public Color Color14
|
||||
{
|
||||
get => color14;
|
||||
set
|
||||
{
|
||||
color14 = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
if (e.X > 0 && e.Y < base.Height)
|
||||
{
|
||||
selectedColor = color2;
|
||||
}
|
||||
if (e.X > 0 && e.Y < base.Height / 2)
|
||||
{
|
||||
selectedColor = color1;
|
||||
}
|
||||
if (e.X > Increment && e.Y < base.Height)
|
||||
{
|
||||
selectedColor = color4;
|
||||
}
|
||||
if (e.X > Increment && e.Y < base.Height / 2)
|
||||
{
|
||||
selectedColor = color3;
|
||||
}
|
||||
if (e.X > Increment * 2 && e.Y < base.Height)
|
||||
{
|
||||
selectedColor = color6;
|
||||
}
|
||||
if (e.X > Increment * 2 && e.Y < base.Height / 2)
|
||||
{
|
||||
selectedColor = color5;
|
||||
}
|
||||
if (e.X > Increment * 3 && e.Y < base.Height)
|
||||
{
|
||||
selectedColor = color8;
|
||||
}
|
||||
if (e.X > Increment * 3 && e.Y < base.Height / 2)
|
||||
{
|
||||
selectedColor = color7;
|
||||
}
|
||||
if (e.X > Increment * 4 && e.Y < base.Height)
|
||||
{
|
||||
selectedColor = color10;
|
||||
}
|
||||
if (e.X > Increment * 4 && e.Y < base.Height / 2)
|
||||
{
|
||||
selectedColor = color9;
|
||||
}
|
||||
if (e.X > Increment * 5 && e.Y < base.Height)
|
||||
{
|
||||
selectedColor = color12;
|
||||
}
|
||||
if (e.X > Increment * 5 && e.Y < base.Height / 2)
|
||||
{
|
||||
selectedColor = color11;
|
||||
}
|
||||
if (e.X > Increment * 6 && e.Y < base.Height)
|
||||
{
|
||||
selectedColor = color14;
|
||||
}
|
||||
if (e.X > Increment * 6 && e.Y < base.Height / 2)
|
||||
{
|
||||
selectedColor = color13;
|
||||
}
|
||||
OnColorChange();
|
||||
}
|
||||
|
||||
public event EventHandler ColorChanged;
|
||||
|
||||
protected virtual void OnColorChange()
|
||||
{
|
||||
ColorChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Increment = base.Width / 7;
|
||||
|
||||
e.Graphics.FillRectangle(new SolidBrush(color1), 0, 0, Increment, base.Height / 2);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color2), 0, base.Height / 2, Increment, base.Height);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color3), Increment, 0, Increment, base.Height / 2);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color4), Increment, base.Height / 2, Increment, base.Height);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color5), Increment * 2, 0, Increment, base.Height / 2);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color6), Increment * 2, base.Height / 2, Increment, base.Height);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color7), Increment * 3, 0, Increment, base.Height / 2);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color8), Increment * 3, base.Height / 2, Increment, base.Height);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color9), Increment * 4, 0, Increment, base.Height / 2);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color10), Increment * 4, base.Height / 2, Increment, base.Height);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color11), Increment * 5, 0, Increment, base.Height / 2);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color12), Increment * 5, base.Height / 2, Increment, base.Height);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color13), Increment * 6, 0, Increment, base.Height / 2);
|
||||
e.Graphics.FillRectangle(new SolidBrush(color14), Increment * 6, base.Height / 2, Increment, base.Height);
|
||||
|
||||
if (showGrid)
|
||||
{
|
||||
e.Graphics.DrawRectangle(new Pen(gridColor, 1f), 0, 0, Increment * 7 - 1, base.Height - 1);
|
||||
e.Graphics.DrawLine(new Pen(gridColor, 1f), Increment, 0, Increment, base.Height);
|
||||
e.Graphics.DrawLine(new Pen(gridColor, 1f), Increment * 2, 0, Increment * 2, base.Height);
|
||||
e.Graphics.DrawLine(new Pen(gridColor, 1f), Increment * 3, 0, Increment * 3, base.Height);
|
||||
e.Graphics.DrawLine(new Pen(gridColor, 1f), Increment * 4, 0, Increment * 4, base.Height);
|
||||
e.Graphics.DrawLine(new Pen(gridColor, 1f), Increment * 5, 0, Increment * 5, base.Height);
|
||||
e.Graphics.DrawLine(new Pen(gridColor, 1f), Increment * 6, 0, Increment * 6, base.Height);
|
||||
e.Graphics.DrawLine(new Pen(gridColor, 1f), 0, base.Height / 2, Increment * 7 - 1, base.Height / 2);
|
||||
}
|
||||
}
|
||||
|
||||
private int Increment;
|
||||
|
||||
private Color selectedColor;
|
||||
|
||||
private Color gridColor = Color.FromArgb(15, 15, 15);
|
||||
|
||||
private bool showGrid = true;
|
||||
|
||||
private Color color1 = Color.FromArgb(30, 33, 38);
|
||||
|
||||
private Color color2 = Color.FromArgb(37, 40, 49);
|
||||
|
||||
private Color color3 = Color.FromArgb(24, 11, 56);
|
||||
|
||||
private Color color4 = Color.FromArgb(48, 36, 76);
|
||||
|
||||
private Color color5 = Color.FromArgb(1, 119, 215);
|
||||
|
||||
private Color color6 = Color.FromArgb(26, 169, 219);
|
||||
|
||||
private Color color7 = Color.FromArgb(24, 202, 142);
|
||||
|
||||
private Color color8 = Color.FromArgb(102, 217, 174);
|
||||
|
||||
private Color color9 = Color.FromArgb(230, 71, 89);
|
||||
|
||||
private Color color10 = Color.FromArgb(234, 129, 136);
|
||||
|
||||
private Color color11 = Color.FromArgb(159, 133, 255);
|
||||
|
||||
private Color color12 = Color.FromArgb(188, 170, 252);
|
||||
|
||||
private Color color13 = Color.FromArgb(228, 216, 54);
|
||||
|
||||
private Color color14 = Color.FromArgb(235, 227, 120);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatPanel : Panel
|
||||
{
|
||||
private int borderSize = 0;
|
||||
private int borderRadius = 6;
|
||||
private Color borderColor = Color.FromArgb(250, 36, 38);
|
||||
|
||||
public CrEaTiiOn_FlatPanel()
|
||||
{
|
||||
this.Size = new Size(150, 40);
|
||||
this.BackColor = Color.Transparent;
|
||||
this.ForeColor = Color.White;
|
||||
this.Resize += new EventHandler(this.Panel_Resize);
|
||||
}
|
||||
|
||||
private void Panel_Resize(object sender, EventArgs e)
|
||||
{
|
||||
if (this.borderRadius <= this.Height)
|
||||
return;
|
||||
this.borderRadius = this.Height;
|
||||
}
|
||||
|
||||
private GraphicsPath GetFigurePath(Rectangle rect, float radius)
|
||||
{
|
||||
GraphicsPath figurePath = new GraphicsPath();
|
||||
float num = radius * 2f;
|
||||
figurePath.StartFigure();
|
||||
figurePath.AddArc((float)rect.X, (float)rect.Y, num, num, 180f, 90f);
|
||||
figurePath.AddArc((float)rect.Right - num, (float)rect.Y, num, num, 270f, 90f);
|
||||
figurePath.AddArc((float)rect.Right - num, (float)rect.Bottom - num, num, num, 0.0f, 90f);
|
||||
figurePath.AddArc((float)rect.X, (float)rect.Bottom - num, num, num, 90f, 90f);
|
||||
figurePath.CloseFigure();
|
||||
return figurePath;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pevent)
|
||||
{
|
||||
base.OnPaint(pevent);
|
||||
Rectangle clientRectangle = this.ClientRectangle;
|
||||
Rectangle rect = Rectangle.Inflate(clientRectangle, -this.borderSize, -this.borderSize);
|
||||
int width = 2;
|
||||
if (this.borderSize > 0)
|
||||
width = this.borderSize;
|
||||
if (this.borderRadius > 2)
|
||||
{
|
||||
using (GraphicsPath figurePath1 = this.GetFigurePath(clientRectangle, (float)this.borderRadius))
|
||||
{
|
||||
using (GraphicsPath figurePath2 = this.GetFigurePath(rect, (float)(this.borderRadius - this.borderSize)))
|
||||
{
|
||||
using (Pen pen1 = new Pen(this.Parent.BackColor, (float)width))
|
||||
{
|
||||
using (Pen pen2 = new Pen(this.borderColor, (float)this.borderSize))
|
||||
{
|
||||
pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
this.Region = new Region(figurePath1);
|
||||
pevent.Graphics.DrawPath(pen1, figurePath1);
|
||||
if (this.borderSize < 1)
|
||||
return;
|
||||
pevent.Graphics.DrawPath(pen2, figurePath2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pevent.Graphics.SmoothingMode = SmoothingMode.None;
|
||||
this.Region = new Region(clientRectangle);
|
||||
if (this.borderSize >= 1)
|
||||
{
|
||||
using (Pen pen = new Pen(this.borderColor, (float)this.borderSize))
|
||||
{
|
||||
pen.Alignment = PenAlignment.Inset;
|
||||
pevent.Graphics.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public int BorderSize
|
||||
{
|
||||
get => this.borderSize;
|
||||
set
|
||||
{
|
||||
this.borderSize = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public int BorderRadius
|
||||
{
|
||||
get => this.borderRadius;
|
||||
set
|
||||
{
|
||||
this.borderRadius = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e) => base.OnHandleCreated(e);
|
||||
|
||||
private void Container_BackColorChanged(object sender, EventArgs e) => this.Invalidate();
|
||||
|
||||
[Category("Sipaa")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get => this.borderColor;
|
||||
set
|
||||
{
|
||||
this.borderColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ModernPanel
|
||||
|
||||
public class CrEaTiiOn_ModernPanel : System.Windows.Forms.Panel
|
||||
{
|
||||
#region Enum
|
||||
|
||||
public enum PanelSide
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
[Browsable(false)]
|
||||
[Description("The background color of the component.")]
|
||||
public override Color BackColor { get; set; }
|
||||
|
||||
private PanelSide _Side = PanelSide.Left;
|
||||
public PanelSide Side
|
||||
{
|
||||
get => _Side;
|
||||
set
|
||||
{
|
||||
_Side = value;
|
||||
if (_Side == PanelSide.Left)
|
||||
{
|
||||
BackColor = LeftSideColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
BackColor = RightSideColor;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _LeftSideColor = ColorTranslator.FromHtml("#F25D59");
|
||||
public Color LeftSideColor
|
||||
{
|
||||
get => _LeftSideColor;
|
||||
set
|
||||
{
|
||||
_LeftSideColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _RightSideColor = ColorTranslator.FromHtml("#292C3D");
|
||||
public Color RightSideColor
|
||||
{
|
||||
get => _RightSideColor;
|
||||
set
|
||||
{
|
||||
_RightSideColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
Focus();
|
||||
base.OnClick(e);
|
||||
}
|
||||
|
||||
public CrEaTiiOn_ModernPanel()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
|
||||
|
||||
UpdateStyles();
|
||||
|
||||
ForeColor = ColorTranslator.FromHtml("#FFFFFF");
|
||||
BackColor = Color.Transparent;
|
||||
|
||||
BorderStyle = BorderStyle.None;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Panel
|
||||
|
||||
public class CrEaTiiOn_Panel : ContainerControl
|
||||
{
|
||||
private GraphicsPath Shape;
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _EdgeColor = Color.Transparent;
|
||||
public Color EdgeColor
|
||||
{
|
||||
get => _EdgeColor;
|
||||
set
|
||||
{
|
||||
_EdgeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_Panel()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
|
||||
BackColor = Color.Transparent;
|
||||
Size = new(187, 117);
|
||||
Padding = new Padding(5, 5, 5, 5);
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
Shape = new();
|
||||
Shape.AddArc(0, 0, 10, 10, 180, 90);
|
||||
Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
|
||||
Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
|
||||
Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
|
||||
Shape.CloseAllFigures();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
|
||||
G.SmoothingMode = SmoothingType;
|
||||
|
||||
G.Clear(EdgeColor); // Set control background to transparent
|
||||
G.FillPath(new SolidBrush(BackColor), Shape); // Draw RTB background
|
||||
G.DrawPath(new(BackColor), Shape); // Draw border
|
||||
|
||||
G.Dispose();
|
||||
e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_WidgetPanel
|
||||
|
||||
public class CrEaTiiOn_WidgetPanel : System.Windows.Forms.Panel
|
||||
{
|
||||
protected override void OnControlAdded(ControlEventArgs e)
|
||||
{
|
||||
base.OnControlAdded(e);
|
||||
if (!ControlsAsWidgets)
|
||||
{
|
||||
foreach (object obj in base.Controls)
|
||||
{
|
||||
Control control = (Control)obj;
|
||||
control.MouseDown += WidgetDown;
|
||||
control.MouseUp += WidgetUp;
|
||||
control.MouseMove += WidgetMove;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Reat controls as widgets")]
|
||||
public bool ControlsAsWidgets
|
||||
{
|
||||
get => controlsAsWidgets;
|
||||
set => controlsAsWidgets = value;
|
||||
}
|
||||
|
||||
private void WidgetDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
isDragging = true;
|
||||
}
|
||||
|
||||
private void WidgetUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
isDragging = false;
|
||||
}
|
||||
|
||||
private void WidgetMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (isDragging)
|
||||
{
|
||||
((Control)sender).Location = new Point(e.X, e.Y);
|
||||
}
|
||||
}
|
||||
|
||||
private bool controlsAsWidgets;
|
||||
|
||||
private bool isDragging;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
namespace CBH.Controls
|
||||
{
|
||||
partial class CrEaTiiOn_ColorPicker
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.pictureBox3 = new System.Windows.Forms.PictureBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(4, 3);
|
||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(175, 173);
|
||||
this.pictureBox1.TabIndex = 8;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click_1);
|
||||
this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
|
||||
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
|
||||
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
|
||||
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
|
||||
//
|
||||
// pictureBox2
|
||||
//
|
||||
this.pictureBox2.Location = new System.Drawing.Point(192, 134);
|
||||
this.pictureBox2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.pictureBox2.Name = "pictureBox2";
|
||||
this.pictureBox2.Size = new System.Drawing.Size(20, 43);
|
||||
this.pictureBox2.TabIndex = 9;
|
||||
this.pictureBox2.TabStop = false;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.label1.ForeColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.label1.Location = new System.Drawing.Point(55, 187);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(72, 16);
|
||||
this.label1.TabIndex = 12;
|
||||
this.label1.Text = "RGB: none";
|
||||
//
|
||||
// pictureBox3
|
||||
//
|
||||
this.pictureBox3.Location = new System.Drawing.Point(192, 3);
|
||||
this.pictureBox3.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.pictureBox3.Name = "pictureBox3";
|
||||
this.pictureBox3.Size = new System.Drawing.Size(20, 123);
|
||||
this.pictureBox3.TabIndex = 13;
|
||||
this.pictureBox3.TabStop = false;
|
||||
this.pictureBox3.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox3_Paint);
|
||||
this.pictureBox3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox3_MouseDown);
|
||||
this.pictureBox3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox3_MouseMove);
|
||||
this.pictureBox3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox3_MouseUp);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.label2.ForeColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.label2.Location = new System.Drawing.Point(55, 210);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(70, 16);
|
||||
this.label2.TabIndex = 16;
|
||||
this.label2.Text = "HEX: none";
|
||||
//
|
||||
// ColorPicker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.pictureBox3);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.pictureBox2);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.Name = "ColorPicker";
|
||||
this.Size = new System.Drawing.Size(216, 242);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.PictureBox pictureBox2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.PictureBox pictureBox3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.EventHandler pictureBox1_Click;
|
||||
}
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public partial class CrEaTiiOn_ColorPicker : UserControl
|
||||
{
|
||||
#region ПЕРЕМЕННЫЕ
|
||||
private class ValueBox
|
||||
{
|
||||
public float Value = 1F;
|
||||
public Color Color = Color.White;
|
||||
}
|
||||
private bool ValueBoxMD;
|
||||
private PointF CursorPos;
|
||||
private bool ColorPickerMD;
|
||||
#endregion
|
||||
|
||||
#region НАСТРОЙКИ
|
||||
public delegate void EventHandler(Color color);
|
||||
[Category("FC_UI")]
|
||||
[Description("Событие возникает, когда в Control изменяется значение свойства Text.")]
|
||||
public event EventHandler ColorChanged = delegate { };
|
||||
|
||||
private Color tmp_selectedcolor;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Description("Выбранный цвет")]
|
||||
public Color SelectedColor
|
||||
{
|
||||
get => tmp_selectedcolor;
|
||||
set
|
||||
{
|
||||
tmp_selectedcolor = value;
|
||||
ColorChanged(value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ЗАГРУЗКА
|
||||
public CrEaTiiOn_ColorPicker()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Tag = "FC_UI";
|
||||
pictureBox1.Tag = new PointF((float)pictureBox1.Width / 2, (float)pictureBox1.Height / 2);
|
||||
pictureBox3.Tag = new ValueBox();
|
||||
|
||||
Bitmap Wheel = new Bitmap(pictureBox1.Width, pictureBox1.Height);
|
||||
Graphics g = Graphics.FromImage(Wheel);
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
DrawWheel((float)Wheel.Width / 2, g);
|
||||
pictureBox1.Image = Wheel;
|
||||
CursorPos = new PointF((float)pictureBox1.Height / 2, (float)pictureBox1.Height / 2);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region СОБЫТИЯ
|
||||
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
ColorPickerMD = true;
|
||||
PickColor(e.X, e.Y);
|
||||
}
|
||||
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (ColorPickerMD) PickColor(e.X, e.Y);
|
||||
}
|
||||
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
ColorPickerMD = false;
|
||||
PickColor(e.X, e.Y);
|
||||
}
|
||||
private void pictureBox1_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
e.Graphics.DrawEllipse(new Pen(Color.DarkGray, 1F), CursorPos.X - 4, CursorPos.Y - 4, 8, 8);
|
||||
}
|
||||
private void pictureBox3_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
LinearGradientBrush Brush = new LinearGradientBrush(new Point(0, 0), new Point(0, pictureBox3.Height), ((ValueBox)pictureBox3.Tag).Color, Color.Black);
|
||||
e.Graphics.FillRectangle(Brush, pictureBox3.ClientRectangle);
|
||||
e.Graphics.FillRectangle(new SolidBrush(Color.DarkGray), 0, pictureBox3.Height * (1 - ((ValueBox)pictureBox3.Tag).Value) - 2, pictureBox3.Width, 4);
|
||||
}
|
||||
private void pictureBox3_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
ValueBoxMD = true;
|
||||
if (e.Y > pictureBox3.Height || e.Y < 0) return;
|
||||
((ValueBox)pictureBox3.Tag).Value = (float)(pictureBox3.Height - e.Y) / pictureBox3.Height;
|
||||
PickColor(((PointF)pictureBox1.Tag).X, ((PointF)pictureBox1.Tag).Y);
|
||||
}
|
||||
private void pictureBox3_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (ValueBoxMD)
|
||||
{
|
||||
if (e.Y > pictureBox3.Height || e.Y < 0) return;
|
||||
((ValueBox)pictureBox3.Tag).Value = (float)(pictureBox3.Height - e.Y) / pictureBox3.Height;
|
||||
PickColor(((PointF)pictureBox1.Tag).X, ((PointF)pictureBox1.Tag).Y);
|
||||
}
|
||||
}
|
||||
private void pictureBox3_MouseUp(object sender, MouseEventArgs e) => ValueBoxMD = false;
|
||||
#endregion
|
||||
|
||||
#region МЕТОДЫ РИСОВАНИЯ
|
||||
private void DrawWheel(float radius, Graphics graphics)
|
||||
{
|
||||
GraphicsPath FillPath = new GraphicsPath();
|
||||
FillPath.AddEllipse(0, 0, radius * 2, radius * 2);
|
||||
FillPath.Flatten();
|
||||
|
||||
GraphicsPath BrushPath = new GraphicsPath();
|
||||
BrushPath.AddEllipse(-1, -1, radius * 2 + 2, radius * 2 + 2);
|
||||
BrushPath.Flatten();
|
||||
|
||||
graphics.FillPath(GetBrush(BrushPath), FillPath);
|
||||
}
|
||||
private Brush GetBrush(GraphicsPath graphicsPath)
|
||||
{
|
||||
PathGradientBrush Brush = new PathGradientBrush(graphicsPath) { CenterColor = Color.White };
|
||||
|
||||
Color[] Colors = new Color[graphicsPath.PointCount];
|
||||
for (int Angle = 0; Angle < Colors.Length; Angle++)
|
||||
{
|
||||
Colors[Angle] = HSVtoRGB((float)Angle / Colors.Length, 1, 1);
|
||||
}
|
||||
Brush.SurroundColors = Colors;
|
||||
|
||||
return Brush;
|
||||
}
|
||||
private Color GetPixelColor(float x, float y, float value, float radius)
|
||||
{
|
||||
float R = (float)Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
|
||||
float S = (float)(R / radius);
|
||||
if (S > 1) return Color.Transparent;
|
||||
|
||||
double Angle;
|
||||
if (x > 0 && y > 0) Angle = Math.Asin(y / R);
|
||||
else if (x <= 0 && y > 0) Angle = Math.Acos(y / R) + Math.PI / 2;
|
||||
else if (x <= 0 && y <= 0) Angle = Math.Asin(-y / R) + Math.PI;
|
||||
else Angle = Math.Acos(-y / R) + 3 * Math.PI / 2;
|
||||
float H = (float)(Angle / Math.PI / 2);
|
||||
|
||||
return HSVtoRGB(H, S, value);
|
||||
}
|
||||
private Color PickColor(float x, float y)
|
||||
{
|
||||
float x1 = x - (float)pictureBox1.Width / 2;
|
||||
float y1 = y - (float)pictureBox1.Height / 2;
|
||||
float Radius = (float)Math.Sqrt(Math.Pow(x1, 2) + Math.Pow(y1, 2));
|
||||
if (Radius > (float)pictureBox1.Width / 2)
|
||||
{
|
||||
float mult = (float)pictureBox1.Width / 2 / Radius;
|
||||
x1 *= mult;
|
||||
y1 *= mult;
|
||||
}
|
||||
Color Color = GetPixelColor(x1, y1, ((ValueBox)pictureBox3.Tag).Value, (float)pictureBox1.Width / 2);
|
||||
if (Color == Color.Transparent) return Color.Empty;
|
||||
|
||||
label1.Text = $"RGB: {Color.R}, {Color.G}, {Color.B}";
|
||||
label2.Text = $"HEX: #{Color.ToArgb():X}";
|
||||
CursorPos = new PointF(x1 + (float)pictureBox1.Width / 2, y1 + (float)pictureBox1.Height / 2);
|
||||
pictureBox2.BackColor = Color;
|
||||
((ValueBox)pictureBox3.Tag).Color = Color;
|
||||
pictureBox1.Tag = new PointF(x, y);
|
||||
pictureBox1.Invalidate();
|
||||
pictureBox2.Invalidate();
|
||||
pictureBox3.Invalidate();
|
||||
|
||||
SelectedColor = Color;
|
||||
return Color;
|
||||
}
|
||||
|
||||
private Color HSVtoRGB(double H, double S, double V)
|
||||
{
|
||||
double R, G, B;
|
||||
if (S == 0)
|
||||
{
|
||||
R = V * 255;
|
||||
G = V * 255;
|
||||
B = V * 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
double H1 = H * 6;
|
||||
if (H1 == 6) H1 = 0;
|
||||
|
||||
int i = (int)Math.Floor(H1);
|
||||
|
||||
double i1 = V * (1 - S);
|
||||
double i2 = V * (1 - S * (H1 - i));
|
||||
double i3 = V * (1 - S * (1 - (H1 - i)));
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
R = V;
|
||||
G = i3;
|
||||
B = i1;
|
||||
break;
|
||||
case 1:
|
||||
R = i2;
|
||||
G = V;
|
||||
B = i1;
|
||||
break;
|
||||
case 2:
|
||||
R = i1;
|
||||
G = V;
|
||||
B = i3;
|
||||
break;
|
||||
case 3:
|
||||
R = i1;
|
||||
G = i2;
|
||||
B = V;
|
||||
break;
|
||||
case 4:
|
||||
R = i3;
|
||||
G = i1;
|
||||
B = V;
|
||||
break;
|
||||
default:
|
||||
R = V;
|
||||
G = i1;
|
||||
B = i2;
|
||||
break;
|
||||
}
|
||||
|
||||
R *= 255;
|
||||
G *= 255;
|
||||
B *= 255;
|
||||
}
|
||||
return Color.FromArgb((int)R, (int)G, (int)B);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Click
|
||||
private void pictureBox1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,130 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
internal class CrEaTiiOn_CircularPictureBox : CrEaTiiOn_Ultimate_PictureBox
|
||||
{
|
||||
private int borderSize = 2;
|
||||
private Color borderColor = Color.RoyalBlue;
|
||||
private Color borderColor2 = Color.HotPink;
|
||||
private DashStyle borderLineStyle = DashStyle.Solid;
|
||||
private DashCap borderCapStyle = DashCap.Flat;
|
||||
private float gradientAngle = 50f;
|
||||
|
||||
public CrEaTiiOn_CircularPictureBox()
|
||||
{
|
||||
this.Size = new Size(100, 100);
|
||||
this.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public int BorderSize
|
||||
{
|
||||
get => this.borderSize;
|
||||
set
|
||||
{
|
||||
this.borderSize = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get => this.borderColor;
|
||||
set
|
||||
{
|
||||
this.borderColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public Color BorderColor2
|
||||
{
|
||||
get => this.borderColor2;
|
||||
set
|
||||
{
|
||||
this.borderColor2 = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public DashStyle BorderLineStyle
|
||||
{
|
||||
get => this.borderLineStyle;
|
||||
set
|
||||
{
|
||||
this.borderLineStyle = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public DashCap BorderCapStyle
|
||||
{
|
||||
get => this.borderCapStyle;
|
||||
set
|
||||
{
|
||||
this.borderCapStyle = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Sipaa")]
|
||||
public float GradientAngle
|
||||
{
|
||||
get => this.gradientAngle;
|
||||
set
|
||||
{
|
||||
this.gradientAngle = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public PictureBoxSizeMode SizeMode { get; private set; }
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
this.Size = new Size(this.Width, this.Width);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
Graphics graphics = pe.Graphics;
|
||||
Rectangle rect1 = Rectangle.Inflate(this.ClientRectangle, -1, -1);
|
||||
Rectangle rect2 = Rectangle.Inflate(rect1, -this.borderSize, -this.borderSize);
|
||||
int width = this.borderSize > 0 ? this.borderSize * 3 : 1;
|
||||
using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rect2, this.borderColor, this.borderColor2, this.gradientAngle))
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
using (Pen pen1 = new Pen(this.Parent.BackColor, (float)width))
|
||||
{
|
||||
using (Pen pen2 = new Pen((Brush)linearGradientBrush, (float)this.borderSize))
|
||||
{
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
pen2.DashStyle = this.borderLineStyle;
|
||||
pen2.DashCap = this.borderCapStyle;
|
||||
path.AddEllipse(rect1);
|
||||
this.Region = new Region(path);
|
||||
graphics.DrawEllipse(pen1, rect1);
|
||||
if (this.borderSize <= 0)
|
||||
return;
|
||||
graphics.DrawEllipse(pen2, rect2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using CBH.RJControls;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
class CrEaTiiOn_ModernPictureBox : CrEaTiiOn_Ultimate_PictureBox
|
||||
{
|
||||
//Fields
|
||||
private int borderSize = 2;
|
||||
private Color borderColor = Color.FromArgb(250, 36, 38);
|
||||
private Color borderColor2 = Color.FromArgb(250, 36, 38);
|
||||
private DashStyle borderLineStyle = DashStyle.Solid;
|
||||
private DashCap borderCapStyle = DashCap.Flat;
|
||||
private float gradientAngle = 50F;
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_ModernPictureBox()
|
||||
{
|
||||
this.Size = new Size(100, 100);
|
||||
this.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
}
|
||||
|
||||
//Properties
|
||||
[Category("RJ Code Advance")]
|
||||
public int BorderSize
|
||||
{
|
||||
get { return borderSize; }
|
||||
set
|
||||
{
|
||||
borderSize = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public Color BorderColor2
|
||||
{
|
||||
get { return borderColor2; }
|
||||
set
|
||||
{
|
||||
borderColor2 = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public DashStyle BorderLineStyle
|
||||
{
|
||||
get { return borderLineStyle; }
|
||||
set
|
||||
{
|
||||
borderLineStyle = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public DashCap BorderCapStyle
|
||||
{
|
||||
get { return borderCapStyle; }
|
||||
set
|
||||
{
|
||||
borderCapStyle = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public float GradientAngle
|
||||
{
|
||||
get { return gradientAngle; }
|
||||
set
|
||||
{
|
||||
gradientAngle = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public PictureBoxSizeMode SizeMode { get; private set; }
|
||||
|
||||
//Overridden methods
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
this.Size = new Size(this.Width, this.Width);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
//Fields
|
||||
var graph = pe.Graphics;
|
||||
var rectContourSmooth = Rectangle.Inflate(this.ClientRectangle, -1, -1);
|
||||
var rectBorder = Rectangle.Inflate(rectContourSmooth, -borderSize, -borderSize);
|
||||
var smoothSize = borderSize > 0 ? borderSize * 3 : 1;
|
||||
using (var borderGColor = new LinearGradientBrush(rectBorder, borderColor, borderColor2, gradientAngle))
|
||||
using (var pathRegion = new GraphicsPath())
|
||||
using (var penSmooth = new Pen(this.Parent.BackColor, smoothSize))
|
||||
using (var penBorder = new Pen(borderGColor, borderSize))
|
||||
{
|
||||
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
penBorder.DashStyle = borderLineStyle;
|
||||
penBorder.DashCap = borderCapStyle;
|
||||
pathRegion.AddEllipse(rectContourSmooth);
|
||||
//Set rounded region
|
||||
this.Region = new Region(pathRegion);
|
||||
|
||||
//Drawing
|
||||
graph.DrawEllipse(penSmooth, rectContourSmooth);//Draw contour smoothing
|
||||
if (borderSize > 0) //Draw border
|
||||
graph.DrawEllipse(penBorder, rectBorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,284 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_PictureBox
|
||||
|
||||
public class CrEaTiiOn_Ultimate_PictureBox : Control
|
||||
{
|
||||
public CrEaTiiOn_Ultimate_PictureBox()
|
||||
{
|
||||
base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
base.Size = new Size(150, 150);
|
||||
base.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
x = 0 - base.Width / 2;
|
||||
y = 0 - base.Height / 2;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Is the image eliptical")]
|
||||
public bool IsElipse
|
||||
{
|
||||
get => isElipse;
|
||||
set
|
||||
{
|
||||
isElipse = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Is the image")]
|
||||
public Image Image
|
||||
{
|
||||
get => image;
|
||||
set
|
||||
{
|
||||
image = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Is the image paralax zoom")]
|
||||
public bool IsParallax
|
||||
{
|
||||
get => isParallax;
|
||||
set
|
||||
{
|
||||
isParallax = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Enable filters")]
|
||||
public bool FilterEnabled
|
||||
{
|
||||
get => filterEnabled;
|
||||
set
|
||||
{
|
||||
filterEnabled = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Filter color left")]
|
||||
public Color ColorLeft
|
||||
{
|
||||
get => colorLeft;
|
||||
set
|
||||
{
|
||||
colorLeft = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Filter color right")]
|
||||
public Color ColorRight
|
||||
{
|
||||
get => colorRight;
|
||||
set
|
||||
{
|
||||
colorRight = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Filter alpha")]
|
||||
public int FilterAlpha
|
||||
{
|
||||
get => filterAlpha;
|
||||
set
|
||||
{
|
||||
filterAlpha = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private PixelOffsetMode _PixelOffsetType = PixelOffsetMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public PixelOffsetMode PixelOffsetType
|
||||
{
|
||||
get => _PixelOffsetType;
|
||||
set
|
||||
{
|
||||
_PixelOffsetType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private CompositingQuality _CompositingQualityType = CompositingQuality.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public CompositingQuality CompositingQualityType
|
||||
{
|
||||
get => _CompositingQualityType;
|
||||
set
|
||||
{
|
||||
_CompositingQualityType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private InterpolationMode _InterpolationType = InterpolationMode.HighQualityBilinear;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public InterpolationMode InterpolationType
|
||||
{
|
||||
get => _InterpolationType;
|
||||
set
|
||||
{
|
||||
_InterpolationType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
BufferedGraphicsContext bufferedGraphicsContext = BufferedGraphicsManager.Current;
|
||||
bufferedGraphicsContext.MaximumBuffer = new Size(base.Width, base.Height);
|
||||
bufferedGraphics = bufferedGraphicsContext.Allocate(base.CreateGraphics(), base.ClientRectangle);
|
||||
bufferedGraphics.Graphics.SmoothingMode = SmoothingType;
|
||||
bufferedGraphics.Graphics.InterpolationMode = InterpolationType;
|
||||
bufferedGraphics.Graphics.CompositingQuality = CompositingQualityType;
|
||||
bufferedGraphics.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
bufferedGraphics.Graphics.TextRenderingHint = TextRenderingType;
|
||||
bufferedGraphics.Graphics.Clear(BackColor);
|
||||
e.Graphics.SmoothingMode = SmoothingType;
|
||||
e.Graphics.InterpolationMode = InterpolationType;
|
||||
e.Graphics.CompositingQuality = CompositingQualityType;
|
||||
e.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
if (image != null)
|
||||
{
|
||||
if (!isParallax)
|
||||
{
|
||||
if (isElipse)
|
||||
{
|
||||
Brush brush = new TextureBrush(new Bitmap(image, base.Width, base.Height), new Rectangle(0, 0, base.Width, base.Height));
|
||||
e.Graphics.FillEllipse(brush, 0, 0, base.Width, base.Height);
|
||||
if (filterEnabled)
|
||||
{
|
||||
Brush brush2 = new LinearGradientBrush(base.ClientRectangle, Color.FromArgb(filterAlpha, colorRight), Color.FromArgb(filterAlpha, colorLeft), 180f);
|
||||
e.Graphics.FillEllipse(brush2, 0, 0, base.Width, base.Height);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawImage(new Bitmap(image, base.Width, base.Height), 0, 0);
|
||||
if (filterEnabled)
|
||||
{
|
||||
Brush brush3 = new LinearGradientBrush(base.ClientRectangle, Color.FromArgb(filterAlpha, colorRight), Color.FromArgb(filterAlpha, colorLeft), 180f);
|
||||
e.Graphics.FillRectangle(brush3, 0, 0, base.Width, base.Height);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isParallax)
|
||||
{
|
||||
try
|
||||
{
|
||||
bufferedGraphics.Graphics.DrawImage(new Bitmap(image, base.Width * 2, base.Height * 2), x, y);
|
||||
bufferedGraphics.Render(e.Graphics);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateParallax()
|
||||
{
|
||||
try
|
||||
{
|
||||
bufferedGraphics.Graphics.Clear(BackColor);
|
||||
bufferedGraphics.Graphics.DrawImage(new Bitmap(image, base.Width * 2, base.Height * 2), x, y);
|
||||
bufferedGraphics.Render(base.CreateGraphics());
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if (isParallax)
|
||||
{
|
||||
x = e.X - base.Width;
|
||||
y = e.Y - base.Height;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private int x;
|
||||
|
||||
private int y;
|
||||
|
||||
private BufferedGraphics bufferedGraphics;
|
||||
|
||||
private bool isElipse;
|
||||
|
||||
private Image image;
|
||||
|
||||
private bool isParallax;
|
||||
|
||||
private bool filterEnabled = true;
|
||||
|
||||
private Color colorLeft = Color.FromArgb(250, 36, 38);
|
||||
|
||||
private Color colorRight = Color.FromArgb(250, 36, 38);
|
||||
|
||||
private int filterAlpha = 200;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_CircleProgressBar
|
||||
|
||||
public class CrEaTiiOn_CircleProgressBar : Control
|
||||
{
|
||||
|
||||
#region Enums
|
||||
|
||||
public enum _ProgressShape
|
||||
{
|
||||
Round,
|
||||
Flat
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Variables
|
||||
|
||||
private long _Value;
|
||||
private long _Maximum = 100;
|
||||
private Color _PercentColor = Color.White;
|
||||
private Color _ProgressColor1 = Color.FromArgb(250, 36, 38);
|
||||
private Color _ProgressColor2 = Color.FromArgb(250, 36, 38);
|
||||
private _ProgressShape ProgressShapeVal;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Custom Properties
|
||||
|
||||
public long Value
|
||||
{
|
||||
get => _Value;
|
||||
set
|
||||
{
|
||||
if (value > _Maximum)
|
||||
{
|
||||
value = _Maximum;
|
||||
}
|
||||
|
||||
_Value = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public long Maximum
|
||||
{
|
||||
get => _Maximum;
|
||||
set
|
||||
{
|
||||
if (value < 1)
|
||||
{
|
||||
value = 1;
|
||||
}
|
||||
|
||||
_Maximum = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color PercentColor
|
||||
{
|
||||
get => _PercentColor;
|
||||
set
|
||||
{
|
||||
_PercentColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color ProgressColor1
|
||||
{
|
||||
get => _ProgressColor1;
|
||||
set
|
||||
{
|
||||
_ProgressColor1 = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color ProgressColor2
|
||||
{
|
||||
get => _ProgressColor2;
|
||||
set
|
||||
{
|
||||
_ProgressColor2 = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public _ProgressShape ProgressShape
|
||||
{
|
||||
get => ProgressShapeVal;
|
||||
set
|
||||
{
|
||||
ProgressShapeVal = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
SetStandardSize();
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
SetStandardSize();
|
||||
}
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs p)
|
||||
{
|
||||
base.OnPaintBackground(p);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_CircleProgressBar()
|
||||
{
|
||||
Size = new(130, 130);
|
||||
Font = new("Segoe UI", 15);
|
||||
MinimumSize = new(100, 100);
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
|
||||
private void SetStandardSize()
|
||||
{
|
||||
int _Size = Math.Max(Width, Height);
|
||||
Size = new(_Size, _Size);
|
||||
}
|
||||
|
||||
public void Increment(int Val)
|
||||
{
|
||||
_Value += Val;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
public void Decrement(int Val)
|
||||
{
|
||||
_Value -= Val;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
using Bitmap bitmap = new(Width, Height);
|
||||
using Graphics graphics = Graphics.FromImage(bitmap);
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
graphics.Clear(BackColor);
|
||||
using (LinearGradientBrush brush = new(ClientRectangle, _ProgressColor1, _ProgressColor2, LinearGradientMode.ForwardDiagonal))
|
||||
{
|
||||
using Pen pen = new(brush, 14f);
|
||||
switch (ProgressShapeVal)
|
||||
{
|
||||
case _ProgressShape.Round:
|
||||
pen.StartCap = LineCap.Round;
|
||||
pen.EndCap = LineCap.Round;
|
||||
break;
|
||||
|
||||
case _ProgressShape.Flat:
|
||||
pen.StartCap = LineCap.Flat;
|
||||
pen.EndCap = LineCap.Flat;
|
||||
break;
|
||||
}
|
||||
graphics.DrawArc(pen, 0x12, 0x12, (Width - 0x23) - 2, (Height - 0x23) - 2, -90, (int)Math.Round((double)((360.0 / _Maximum) * _Value)));
|
||||
}
|
||||
using (LinearGradientBrush brush2 = new(ClientRectangle, Color.FromArgb(0x34, 0x34, 0x34), Color.FromArgb(0x34, 0x34, 0x34), LinearGradientMode.Vertical))
|
||||
{
|
||||
graphics.FillEllipse(brush2, 0x18, 0x18, (Width - 0x30) - 1, (Height - 0x30) - 1);
|
||||
}
|
||||
|
||||
SizeF MS = graphics.MeasureString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font);
|
||||
graphics.DrawString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font, new SolidBrush(_PercentColor), Convert.ToInt32(Width / 2 - MS.Width / 2), Convert.ToInt32(Height / 2 - MS.Height / 2));
|
||||
e.Graphics.DrawImage(bitmap, 0, 0);
|
||||
graphics.Dispose();
|
||||
bitmap.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FancyProgressBar : Control
|
||||
{
|
||||
int value;
|
||||
int maxValue;
|
||||
int minValue;
|
||||
int old, current;
|
||||
Color prColor;
|
||||
System.Windows.Forms.Timer timer;
|
||||
|
||||
public CrEaTiiOn_FancyProgressBar()
|
||||
{
|
||||
prColor = Color.LightBlue;
|
||||
maxValue = 100;
|
||||
minValue = 0;
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
|
||||
Width = 100;
|
||||
Height = 20;
|
||||
timer = new System.Windows.Forms.Timer();
|
||||
timer.Interval = 1;
|
||||
timer.Tick += timer_Tick;
|
||||
timer.Enabled = true;
|
||||
}
|
||||
void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
int a = current - old;
|
||||
int k = maxValue / 100;
|
||||
int art = k < 1 ? 1 : k;
|
||||
old += Math.Abs(a) < 2 ? a : art * Math.Sign(a);
|
||||
this.value = old;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
int length = Width * value / maxValue;
|
||||
e.Graphics.DrawRectangle(Pens.Silver, 0, 0, Width - 1, Height - 1);
|
||||
using (SolidBrush brush = new SolidBrush(prColor))
|
||||
e.Graphics.FillRectangle(brush, 1, 1, length - 2, Height - 2);
|
||||
|
||||
Size textSize = TextRenderer.MeasureText(value + "", this.Font);
|
||||
int x = (Width - textSize.Width) / 2;
|
||||
int y = (Height - textSize.Height) / 2;
|
||||
using (SolidBrush textBrush = new SolidBrush(this.ForeColor))
|
||||
e.Graphics.DrawString("%" + (value * 100 / maxValue), this.Font, textBrush, x, y);
|
||||
base.OnPaint(e);
|
||||
}
|
||||
public int Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return current;
|
||||
}
|
||||
set
|
||||
{
|
||||
old = this.value;
|
||||
if (value > maxValue)
|
||||
throw new Exception("The value is greater than the maximum value of progress");
|
||||
if (value < minValue)
|
||||
throw new Exception("The value is lower than the maximum value of progress");
|
||||
current = value;
|
||||
}
|
||||
}
|
||||
public int MaxValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
maxValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public int MinValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return minValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
minValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public Color ProgressColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return prColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
prColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,350 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_FlatProgressBar
|
||||
|
||||
public class CrEaTiiOn_FlatProgressBar : Control
|
||||
{
|
||||
public CrEaTiiOn_FlatProgressBar()
|
||||
{
|
||||
base.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
base.Size = new Size(300, 5);
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The progress bar style")]
|
||||
public Style BarStyle
|
||||
{
|
||||
get => barStyle;
|
||||
set
|
||||
{
|
||||
barStyle = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The progress value")]
|
||||
public int Value
|
||||
{
|
||||
get => value;
|
||||
set
|
||||
{
|
||||
this.value = value;
|
||||
if (this.value < 0)
|
||||
{
|
||||
this.value = 0;
|
||||
}
|
||||
if (this.value > maxValue)
|
||||
{
|
||||
this.value = maxValue;
|
||||
}
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The progress complete color")]
|
||||
public Color CompleteColor
|
||||
{
|
||||
get => completeColor;
|
||||
set
|
||||
{
|
||||
completeColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The progress complete ios back color")]
|
||||
public Color CompleteBackColor
|
||||
{
|
||||
get => completeBackColor;
|
||||
set
|
||||
{
|
||||
completeBackColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The progress bar border color")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get => borderColor;
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Show the progress bar border")]
|
||||
public bool ShowBorder
|
||||
{
|
||||
get => showBorder;
|
||||
set
|
||||
{
|
||||
showBorder = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The progress incompleted color")]
|
||||
public Color InocmpletedColor
|
||||
{
|
||||
get => incompletedColor;
|
||||
set
|
||||
{
|
||||
incompletedColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The progress incompleted ios back color")]
|
||||
public Color IncompletedBackColor
|
||||
{
|
||||
get => incompletedBackColor;
|
||||
set
|
||||
{
|
||||
incompletedBackColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The maximum value")]
|
||||
public int MaxValue
|
||||
{
|
||||
get => maxValue;
|
||||
set
|
||||
{
|
||||
maxValue = value;
|
||||
if (Value > maxValue)
|
||||
{
|
||||
Value = maxValue;
|
||||
}
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The positions")]
|
||||
public List<float> Positions
|
||||
{
|
||||
get => _Positions;
|
||||
set
|
||||
{
|
||||
_Positions = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The colors")]
|
||||
public List<Color> Colors
|
||||
{
|
||||
get => _Colors;
|
||||
set
|
||||
{
|
||||
_Colors = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private PixelOffsetMode _PixelOffsetType = PixelOffsetMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public PixelOffsetMode PixelOffsetType
|
||||
{
|
||||
get => _PixelOffsetType;
|
||||
set
|
||||
{
|
||||
_PixelOffsetType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private CompositingQuality _CompositingQualityType = CompositingQuality.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public CompositingQuality CompositingQualityType
|
||||
{
|
||||
get => _CompositingQualityType;
|
||||
set
|
||||
{
|
||||
_CompositingQualityType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private InterpolationMode _InterpolationType = InterpolationMode.HighQualityBilinear;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public InterpolationMode InterpolationType
|
||||
{
|
||||
get => _InterpolationType;
|
||||
set
|
||||
{
|
||||
_InterpolationType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
BufferedGraphicsContext bufferedGraphicsContext = BufferedGraphicsManager.Current;
|
||||
bufferedGraphicsContext.MaximumBuffer = new Size(base.Width + 1, base.Height + 1);
|
||||
bufferedGraphics = bufferedGraphicsContext.Allocate(base.CreateGraphics(), base.ClientRectangle);
|
||||
|
||||
bufferedGraphics.Graphics.SmoothingMode = SmoothingType;
|
||||
bufferedGraphics.Graphics.InterpolationMode = InterpolationType;
|
||||
bufferedGraphics.Graphics.CompositingQuality = CompositingQualityType;
|
||||
bufferedGraphics.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
bufferedGraphics.Graphics.TextRenderingHint = TextRenderingType;
|
||||
|
||||
bufferedGraphics.Graphics.Clear(BackColor);
|
||||
|
||||
if (barStyle == Style.Flat)
|
||||
{
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(incompletedColor), 0, 0, base.Width, base.Height);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(completeColor), 0, 0, value * base.Width / maxValue, base.Height);
|
||||
}
|
||||
|
||||
if (barStyle == Style.IOS)
|
||||
{
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(incompletedBackColor), 0, 0, base.Width, base.Height);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(completeBackColor), 0, 0, value * base.Width / maxValue, base.Height);
|
||||
}
|
||||
|
||||
if (barStyle == Style.Material && Positions.Count == Colors.Count)
|
||||
{
|
||||
LinearGradientBrush linearGradientBrush = new(new Rectangle(0, 0, base.Width, base.Height), Color.Black, Color.Black, 0f, false)
|
||||
{
|
||||
InterpolationColors = new ColorBlend
|
||||
{
|
||||
Positions = Positions.ToArray(),
|
||||
Colors = Colors.ToArray()
|
||||
}
|
||||
};
|
||||
|
||||
linearGradientBrush.RotateTransform(1f);
|
||||
bufferedGraphics.Graphics.FillRectangle(linearGradientBrush, new Rectangle(0, 0, base.Width, base.Height));
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(incompletedColor), value * base.Width / maxValue, 0, base.Width - value * base.Width / maxValue, base.Height);
|
||||
}
|
||||
|
||||
if (ShowBorder)
|
||||
{
|
||||
bufferedGraphics.Graphics.DrawRectangle(new Pen(BorderColor, 1f), new Rectangle(1, 1, base.Width - 2, base.Height - 2));
|
||||
}
|
||||
|
||||
bufferedGraphics.Render(e.Graphics);
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.Invalidate();
|
||||
}
|
||||
|
||||
private BufferedGraphics bufferedGraphics;
|
||||
|
||||
private Style barStyle = Style.Material;
|
||||
|
||||
private int value = 50;
|
||||
|
||||
private Color completeColor = Color.FromArgb(250, 36, 38);
|
||||
|
||||
private Color completeBackColor = Color.FromArgb(15, 15, 15);
|
||||
|
||||
private Color borderColor = Color.FromArgb(20, 20, 20);
|
||||
|
||||
private bool showBorder = true;
|
||||
|
||||
private Color incompletedColor = Color.DarkGray;
|
||||
|
||||
private Color incompletedBackColor = Color.FromArgb(100, 100, 100);
|
||||
|
||||
private int maxValue = 100;
|
||||
|
||||
private List<float> _Positions = new()
|
||||
{
|
||||
0f,
|
||||
0.2f,
|
||||
0.4f,
|
||||
0.6f,
|
||||
0.8f,
|
||||
1f
|
||||
};
|
||||
|
||||
private List<Color> _Colors = new()
|
||||
{
|
||||
Color.FromArgb(76, 217, 100),
|
||||
Color.FromArgb(85, 205, 205),
|
||||
Color.FromArgb(2, 124, 255),
|
||||
Color.FromArgb(130, 75, 180),
|
||||
Color.FromArgb(255, 0, 150),
|
||||
Color.FromArgb(255, 45, 85)
|
||||
};
|
||||
|
||||
public enum Style
|
||||
{
|
||||
Flat,
|
||||
Material,
|
||||
IOS
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatRoundProgressBar : Control
|
||||
{
|
||||
#region 变量
|
||||
#endregion
|
||||
|
||||
private int tempValue = 0;
|
||||
private int _valueNumber = 0;
|
||||
public int ValueNumber
|
||||
{
|
||||
get { return _valueNumber; }
|
||||
set
|
||||
{
|
||||
_valueNumber = value > 100 ? 100 : (value < 0 ? 0 : value);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private float _roundWidth = 6;
|
||||
|
||||
private bool _isError = false;
|
||||
public bool IsError
|
||||
{
|
||||
get { return _isError; }
|
||||
set
|
||||
{
|
||||
_isError = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#region 事件
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Width = Height;
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
graphics.Clear(Parent.BackColor);
|
||||
|
||||
graphics.FillEllipse(new SolidBrush(ThemeColors.OneLevelBorder), new Rectangle(0, 0, Width, Height));
|
||||
|
||||
if(_isError)
|
||||
{
|
||||
//绘制扇形
|
||||
graphics.FillPie(new SolidBrush(ThemeColors.Danger), new Rectangle(0, 0, Width, Width), 0, _valueNumber * 3.6f);
|
||||
//绘制文字
|
||||
graphics.FillEllipse(new SolidBrush(Color.FromArgb(20, 20, 20)), new RectangleF(_roundWidth, _roundWidth, Width - _roundWidth * 2, Width - _roundWidth * 2));
|
||||
graphics.DrawLine(new Pen(ThemeColors.Danger, 2f), Width / 2 - 6, Height / 2 - 6, Width / 2 + 6, Height / 2 + 6);
|
||||
graphics.DrawLine(new Pen(ThemeColors.Danger, 2f), Width / 2 - 6, Height / 2 + 6, Width / 2 + 6, Height / 2 - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_valueNumber==100)
|
||||
{
|
||||
graphics.FillPie(new SolidBrush(ThemeColors.Success), new Rectangle(0, 0, Width, Width), 0, _valueNumber * 3.6f);
|
||||
graphics.FillEllipse(new SolidBrush(Color.FromArgb(20, 20, 20)), new RectangleF(_roundWidth, _roundWidth, Width - _roundWidth * 2, Width - _roundWidth * 2));
|
||||
graphics.DrawLine(new Pen(ThemeColors.Success, 2f), Width / 2 - 6, Height / 2, Width / 2-3, Height / 2 + 6);
|
||||
graphics.DrawLine(new Pen(ThemeColors.Success, 2f), Width / 2 + 6, Height / 2 - 6, Width / 2-3, Height / 2 + 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.FillPie(new SolidBrush(ThemeColors.PrimaryColor), new Rectangle(0, 0, Width, Width), 0, _valueNumber * 3.6f);
|
||||
graphics.FillEllipse(new SolidBrush(Color.White), new RectangleF(_roundWidth, _roundWidth, Width - _roundWidth * 2, Width - _roundWidth * 2));
|
||||
graphics.DrawString(_valueNumber.ToString()+"%", new Font("微软雅黑", 12f), new SolidBrush(ThemeColors.PrimaryColor), new RectangleF(_roundWidth, _roundWidth, Width - (_roundWidth * 2), Width - (_roundWidth * 2)), StringAlign.Center);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_FlatRoundProgressBar()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
|
||||
DoubleBuffered = true;
|
||||
Font = new Font("Segoe UI", 10F, FontStyle.Bold);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,279 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
using CBH.RJControls;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public enum TextPosition
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Center,
|
||||
Sliding,
|
||||
None
|
||||
}
|
||||
|
||||
class CrEaTiiOn_ModernProgressBar : CrEaTiiOn_ProgressBar
|
||||
{
|
||||
//Fields
|
||||
//-> Appearance
|
||||
private Color channelColor = Color.FromArgb(255, 150, 151);
|
||||
private Color sliderColor = Color.FromArgb(250, 36, 38);
|
||||
private Color foreBackColor = Color.FromArgb(20,20, 20);
|
||||
private int channelHeight = 6;
|
||||
private int sliderHeight = 6;
|
||||
private TextPosition showValue = TextPosition.Right;
|
||||
private string symbolBefore = "";
|
||||
private string symbolAfter = "";
|
||||
private bool showMaximun = false;
|
||||
|
||||
//-> Others
|
||||
private bool paintedBack = false;
|
||||
private bool stopPainting = false;
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_ModernProgressBar()
|
||||
{
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.ForeColor = Color.White;
|
||||
}
|
||||
|
||||
//Propertiesfff
|
||||
[Category("RJ Code Advance")]
|
||||
public Color ChannelColor
|
||||
{
|
||||
get { return channelColor; }
|
||||
set
|
||||
{
|
||||
channelColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public Color SliderColor
|
||||
{
|
||||
get { return sliderColor; }
|
||||
set
|
||||
{
|
||||
sliderColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public Color ForeBackColor
|
||||
{
|
||||
get { return foreBackColor; }
|
||||
set
|
||||
{
|
||||
foreBackColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public int ChannelHeight
|
||||
{
|
||||
get { return channelHeight; }
|
||||
set
|
||||
{
|
||||
channelHeight = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public int SliderHeight
|
||||
{
|
||||
get { return sliderHeight; }
|
||||
set
|
||||
{
|
||||
sliderHeight = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public TextPosition ShowValue
|
||||
{
|
||||
get { return showValue; }
|
||||
set
|
||||
{
|
||||
showValue = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public string SymbolBefore
|
||||
{
|
||||
get { return symbolBefore; }
|
||||
set
|
||||
{
|
||||
symbolBefore = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public string SymbolAfter
|
||||
{
|
||||
get { return symbolAfter; }
|
||||
set
|
||||
{
|
||||
symbolAfter = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public bool ShowMaximun
|
||||
{
|
||||
get { return showMaximun; }
|
||||
set
|
||||
{
|
||||
showMaximun = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
[Browsable(true)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
public override Font Font
|
||||
{
|
||||
get { return base.Font; }
|
||||
set
|
||||
{
|
||||
base.Font = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Category("RJ Code Advance")]
|
||||
public override Color ForeColor
|
||||
{
|
||||
get { return base.ForeColor; }
|
||||
set
|
||||
{
|
||||
base.ForeColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
//-> Paint the background & channel
|
||||
protected override void OnPaintBackground(PaintEventArgs pevent)
|
||||
{
|
||||
if (stopPainting == false)
|
||||
{
|
||||
if (paintedBack == false)
|
||||
{
|
||||
//Fields
|
||||
Graphics graph = pevent.Graphics;
|
||||
Rectangle rectChannel = new Rectangle(0, 0, this.Width, ChannelHeight);
|
||||
using (var brushChannel = new SolidBrush(channelColor))
|
||||
{
|
||||
if (channelHeight >= sliderHeight)
|
||||
rectChannel.Y = this.Height - channelHeight;
|
||||
else rectChannel.Y = this.Height - ((channelHeight + sliderHeight) / 2);
|
||||
|
||||
//Painting
|
||||
graph.Clear(this.Parent.BackColor);//Surface
|
||||
graph.FillRectangle(brushChannel, rectChannel);//Channel
|
||||
|
||||
//Stop painting the back & Channel
|
||||
if (this.DesignMode == false)
|
||||
paintedBack = true;
|
||||
}
|
||||
}
|
||||
//Reset painting the back & channel
|
||||
if (this.Value == this.Maximum || this.Value == this.Minimum)
|
||||
paintedBack = false;
|
||||
}
|
||||
}
|
||||
//-> Paint slider
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (stopPainting == false)
|
||||
{
|
||||
//Fields
|
||||
Graphics graph = e.Graphics;
|
||||
double scaleFactor = (((double)this.Value - this.Minimum) / ((double)this.Maximum - this.Minimum));
|
||||
int sliderWidth = (int)(this.Width * scaleFactor);
|
||||
Rectangle rectSlider = new Rectangle(0, 0, sliderWidth, sliderHeight);
|
||||
using (var brushSlider = new SolidBrush(sliderColor))
|
||||
{
|
||||
if (sliderHeight >= channelHeight)
|
||||
rectSlider.Y = this.Height - sliderHeight;
|
||||
else rectSlider.Y = this.Height - ((sliderHeight + channelHeight) / 2);
|
||||
|
||||
//Painting
|
||||
if (sliderWidth > 1) //Slider
|
||||
graph.FillRectangle(brushSlider, rectSlider);
|
||||
if (showValue != TextPosition.None) //Text
|
||||
DrawValueText(graph, sliderWidth, rectSlider);
|
||||
}
|
||||
}
|
||||
if (this.Value == this.Maximum) stopPainting = true;//Stop painting
|
||||
else stopPainting = false; //Keep painting
|
||||
}
|
||||
|
||||
//-> Paint value text
|
||||
private void DrawValueText(Graphics graph, int sliderWidth, Rectangle rectSlider)
|
||||
{
|
||||
//Fields
|
||||
string text = symbolBefore + this.Value.ToString() + symbolAfter;
|
||||
if (showMaximun) text = text + "/" + symbolBefore + this.Maximum.ToString() + symbolAfter;
|
||||
var textSize = TextRenderer.MeasureText(text, this.Font);
|
||||
var rectText = new Rectangle(0, 0, textSize.Width, textSize.Height + 2);
|
||||
using (var brushText = new SolidBrush(this.ForeColor))
|
||||
using (var brushTextBack = new SolidBrush(foreBackColor))
|
||||
using (var textFormat = new StringFormat())
|
||||
{
|
||||
switch (showValue)
|
||||
{
|
||||
case TextPosition.Left:
|
||||
rectText.X = 0;
|
||||
textFormat.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case TextPosition.Right:
|
||||
rectText.X = this.Width - textSize.Width;
|
||||
textFormat.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
|
||||
case TextPosition.Center:
|
||||
rectText.X = (this.Width - textSize.Width) / 2;
|
||||
textFormat.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case TextPosition.Sliding:
|
||||
rectText.X = sliderWidth - textSize.Width;
|
||||
textFormat.Alignment = StringAlignment.Center;
|
||||
//Clean previous text surface
|
||||
using (var brushClear = new SolidBrush(this.Parent.BackColor))
|
||||
{
|
||||
var rect = rectSlider;
|
||||
rect.Y = rectText.Y;
|
||||
rect.Height = rectText.Height;
|
||||
graph.FillRectangle(brushClear, rect);
|
||||
}
|
||||
break;
|
||||
}
|
||||
//Painting
|
||||
graph.FillRectangle(brushTextBack, rectText);
|
||||
graph.DrawString(text, this.Font, brushText, rectText, textFormat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_ProcessingControl : Control
|
||||
{
|
||||
#region Variables
|
||||
int n, circleIndex, radius, interval;
|
||||
bool spin;
|
||||
System.Windows.Forms.Timer timer;
|
||||
Color other, index;
|
||||
#endregion
|
||||
|
||||
#region ProcessingControl
|
||||
public CrEaTiiOn_ProcessingControl()
|
||||
{
|
||||
Width = 85;
|
||||
Height = 85;
|
||||
n = 6;
|
||||
circleIndex = 0;
|
||||
interval = 100;
|
||||
radius = 10;
|
||||
spin = true;
|
||||
other = Color.LightGray;
|
||||
index = Color.Gray;
|
||||
timer = new System.Windows.Forms.Timer();
|
||||
timer.Interval = interval;
|
||||
timer.Tick += timer_Tick;
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
|
||||
timer.Enabled = spin;
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Transparenter.MakeTransparent(this, e.Graphics);
|
||||
#region Drawing
|
||||
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
int length = Math.Min(Width, Height);
|
||||
PointF center = new PointF(length / 2, length / 2);
|
||||
int bigRadius = length / 2 - radius;
|
||||
float unitAngle = 360 / n;
|
||||
if (spin)
|
||||
{
|
||||
circleIndex++;
|
||||
circleIndex = circleIndex >= n ? circleIndex % n : circleIndex;
|
||||
}
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
float c1X = center.X + (float)(bigRadius * Math.Cos(unitAngle * i * Math.PI / 180));
|
||||
float c1Y = center.Y + (float)(bigRadius * Math.Sin(unitAngle * i * Math.PI / 180));
|
||||
PointF loc1 = new PointF(c1X - radius, c1Y - radius);
|
||||
if (i == circleIndex)
|
||||
using (SolidBrush brush = new SolidBrush(index))
|
||||
e.Graphics.FillEllipse(brush, loc1.X, loc1.Y, 2 * radius, 2 * radius);
|
||||
else
|
||||
using (SolidBrush brush = new SolidBrush(other))
|
||||
e.Graphics.FillEllipse(brush, loc1.X, loc1.Y, 2 * radius, 2 * radius);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
if (!spin) timer.Stop();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public int NCircle
|
||||
{
|
||||
get
|
||||
{
|
||||
return n;
|
||||
}
|
||||
set
|
||||
{
|
||||
n = value > 1 ? value : 2;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public int Interval
|
||||
{
|
||||
get
|
||||
{
|
||||
return interval;
|
||||
}
|
||||
set
|
||||
{
|
||||
interval = value >= 1 ? value : 1;
|
||||
timer.Interval = interval;
|
||||
}
|
||||
}
|
||||
public bool Spin
|
||||
{
|
||||
get
|
||||
{
|
||||
return spin;
|
||||
}
|
||||
set
|
||||
{
|
||||
spin = value;
|
||||
timer.Enabled = spin;
|
||||
}
|
||||
}
|
||||
public int Radius
|
||||
{
|
||||
get
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
set
|
||||
{
|
||||
radius = value >= 1 ? value : 1;
|
||||
Invalidate();
|
||||
|
||||
}
|
||||
}
|
||||
public Color Others
|
||||
{
|
||||
get
|
||||
{
|
||||
return other;
|
||||
}
|
||||
set
|
||||
{
|
||||
other = value;
|
||||
if (!spin) Invalidate();
|
||||
}
|
||||
}
|
||||
public Color IndexColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return index;
|
||||
}
|
||||
set
|
||||
{
|
||||
index = value;
|
||||
if (!spin) Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ProgressBar
|
||||
|
||||
public class CrEaTiiOn_ProgressBar : System.Windows.Forms.ProgressBar
|
||||
{
|
||||
private int _Value;
|
||||
public int Value
|
||||
{
|
||||
get => _Value;
|
||||
set
|
||||
{
|
||||
_Value = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private int _Maximum = 100;
|
||||
public int Maximum
|
||||
{
|
||||
get => _Maximum;
|
||||
set
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
value = 1;
|
||||
}
|
||||
|
||||
_Maximum = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_ProgressBar()
|
||||
{
|
||||
Value = 50;
|
||||
}
|
||||
|
||||
private Color _ColorA = Color.FromArgb(31, 31, 31);
|
||||
public Color ColorA
|
||||
{
|
||||
get => _ColorA;
|
||||
set => _ColorA = value;
|
||||
}
|
||||
|
||||
private Color _ColorB = Color.FromArgb(41, 41, 41);
|
||||
public Color ColorB
|
||||
{
|
||||
get => _ColorB;
|
||||
set => _ColorB = value;
|
||||
}
|
||||
|
||||
private Color _ColorC = Color.FromArgb(51, 51, 51);
|
||||
public Color ColorC
|
||||
{
|
||||
get => _ColorC;
|
||||
set => _ColorC = value;
|
||||
}
|
||||
|
||||
private Color _ColorD = Color.FromArgb(0, 0, 0, 0);
|
||||
public Color ColorD
|
||||
{
|
||||
get => _ColorD;
|
||||
set => _ColorD = value;
|
||||
}
|
||||
|
||||
private Color _ColorE = Color.FromArgb(25, 255, 255, 255);
|
||||
public Color ColorE
|
||||
{
|
||||
get => _ColorE;
|
||||
set => _ColorE = value;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
int V = Width * _Value / _Maximum;
|
||||
using Bitmap B = new(Width, Height);
|
||||
using Graphics G = Graphics.FromImage(B);
|
||||
Rectangle R1 = new(1, 1, Width - 2, Height - 2);
|
||||
Rectangle R2 = new(2, 2, V - 4, Height - 4);
|
||||
Brush GB1 = new LinearGradientBrush(R1, _ColorB, _ColorC, 90.0F);
|
||||
Brush GB2 = new LinearGradientBrush(R2, _ColorC, _ColorB, 30.0F);
|
||||
G.FillRectangle(GB1, R1);
|
||||
G.FillRectangle(GB2, R2);
|
||||
// Draw.Gradient(G, _ColorB, _ColorC, 1, 1, Width - 2, Height - 2)
|
||||
G.DrawRectangle(new(_ColorB), 1, 1, V - 3, Height - 3);
|
||||
// Draw.Gradient(G, _ColorC, _ColorB, 2, 2, V - 4, Height - 4)
|
||||
|
||||
G.DrawRectangle(new(_ColorA), 0, 0, Width - 1, Height - 1);
|
||||
Bitmap B1 = B;
|
||||
e.Graphics.DrawImage(B1, 0, 0);
|
||||
/*
|
||||
Draw.Gradient(G, _ColorB, _ColorC, 1, 1, Width - 2, Height - 2)
|
||||
G.DrawRectangle(new(_ColorB), 1, 1, V - 3, Height - 3)
|
||||
Draw.Gradient(G, _ColorC, _ColorB, 2, 2, V - 4, Height - 4)
|
||||
|
||||
G.DrawRectangle(new(_ColorA), 0, 0, Width - 1, Height - 1)
|
||||
|
||||
e.Graphics.DrawImage(B.Clone, 0, 0)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_SpinningCircles : Control
|
||||
{
|
||||
bool fullTransparency = true;
|
||||
float increment = 1f;
|
||||
float radius = 2.5f;
|
||||
int n = 8;
|
||||
int next = 0;
|
||||
System.Windows.Forms.Timer timer;
|
||||
public CrEaTiiOn_SpinningCircles()
|
||||
{
|
||||
Width = 90;
|
||||
Height = 100;
|
||||
timer = new System.Windows.Forms.Timer();
|
||||
timer.Tick += timer_Tick;
|
||||
timer.Enabled = false;
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (fullTransparency)
|
||||
{
|
||||
Transparenter.MakeTransparent(this, e.Graphics);
|
||||
}
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
int length = Math.Min(Width, Height);
|
||||
PointF center = new PointF(length / 2, length / 2);
|
||||
float bigRadius = length / 2 - radius - (n - 1) * increment;
|
||||
float unitAngle = 360 / n;
|
||||
next++;
|
||||
next = next >= n ? 0 : next;
|
||||
int a = 0;
|
||||
for (int i = next; i < next + n; i++)
|
||||
{
|
||||
int factor = i % n;
|
||||
float c1X = center.X + (float)(bigRadius * Math.Cos(unitAngle * factor * Math.PI / 180));
|
||||
float c1Y = center.Y + (float)(bigRadius * Math.Sin(unitAngle * factor * Math.PI / 180));
|
||||
float currRad = radius + a * increment;
|
||||
PointF c1 = new PointF(c1X - currRad, c1Y - currRad);
|
||||
e.Graphics.FillEllipse(Brushes.Black, c1.X, c1.Y, 2 * currRad, 2 * currRad);
|
||||
using (Pen pen = new Pen(Color.White, 2))
|
||||
e.Graphics.DrawEllipse(pen, c1.X, c1.Y, 2 * currRad, 2 * currRad);
|
||||
a++;
|
||||
}
|
||||
}
|
||||
protected override void OnVisibleChanged(EventArgs e)
|
||||
{
|
||||
timer.Enabled = Visible;
|
||||
base.OnVisibleChanged(e);
|
||||
}
|
||||
public bool FullTransparent
|
||||
{
|
||||
get
|
||||
{
|
||||
return fullTransparency;
|
||||
}
|
||||
set
|
||||
{
|
||||
fullTransparency = value;
|
||||
}
|
||||
}
|
||||
public int N
|
||||
{
|
||||
get
|
||||
{
|
||||
return n;
|
||||
}
|
||||
set
|
||||
{
|
||||
n = value >= 2 ? value : 2;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public float Increment
|
||||
{
|
||||
get
|
||||
{
|
||||
return increment;
|
||||
}
|
||||
set
|
||||
{
|
||||
increment = value >= 0 ? value : 0;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public float Radius
|
||||
{
|
||||
get
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
set
|
||||
{
|
||||
radius = value >= 1 ? value : 1;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_AirRadioButton
|
||||
|
||||
public class CrEaTiiOn_AirRadioButton : Control
|
||||
{
|
||||
public CrEaTiiOn_AirRadioButton()
|
||||
{
|
||||
base.Size = new Size(100, 16);
|
||||
Text = base.Name;
|
||||
ForeColor = Color.White;
|
||||
currentColor = radioColor;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Checked or unchecked")]
|
||||
public bool Checked
|
||||
{
|
||||
get => isChecked;
|
||||
set
|
||||
{
|
||||
isChecked = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Radio color")]
|
||||
public Color RadioColor
|
||||
{
|
||||
get => radioColor;
|
||||
set
|
||||
{
|
||||
radioColor = value;
|
||||
currentColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Radio color when hovering")]
|
||||
public Color RadioHoverColor
|
||||
{
|
||||
get => radioHoverColor;
|
||||
set
|
||||
{
|
||||
radioHoverColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The radio style")]
|
||||
public Style RadioStyle
|
||||
{
|
||||
get => radioStyle;
|
||||
set
|
||||
{
|
||||
radioStyle = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private PixelOffsetMode _PixelOffsetType = PixelOffsetMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public PixelOffsetMode PixelOffsetType
|
||||
{
|
||||
get => _PixelOffsetType;
|
||||
set
|
||||
{
|
||||
_PixelOffsetType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
base.OnMouseEnter(e);
|
||||
currentColor = radioHoverColor;
|
||||
base.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
currentColor = radioColor;
|
||||
base.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
base.OnClick(e);
|
||||
foreach (object obj in base.Parent.Controls)
|
||||
{
|
||||
Control control = (Control)obj;
|
||||
if (control is System.Windows.Forms.RadioButton)
|
||||
{
|
||||
((CrEaTiiOn_Ultimate_RadioButton)control).Checked = false;
|
||||
}
|
||||
if (control is CrEaTiiOn_AirRadioButton button)
|
||||
{
|
||||
button.Checked = false;
|
||||
}
|
||||
}
|
||||
isChecked = true;
|
||||
base.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SmoothingMode = SmoothingType;
|
||||
if (radioStyle == Style.Material)
|
||||
{
|
||||
e.Graphics.DrawEllipse(new Pen(currentColor, 2f), 2, 2, base.Height - 4, base.Height - 4);
|
||||
if (isChecked)
|
||||
{
|
||||
e.Graphics.FillPie(new SolidBrush(currentColor), new Rectangle(5, 5, base.Height - 2 - 8, base.Height - 2 - 8), 0f, 360f);
|
||||
}
|
||||
e.Graphics.FillPie(new SolidBrush(currentColor), new Rectangle(1, 1, base.Height - 2, base.Height - 2), 0f, 360f);
|
||||
if (isChecked)
|
||||
{
|
||||
e.Graphics.FillPie(new SolidBrush(Color.White), new Rectangle(4, 4, base.Height - 2 - 6, base.Height - 2 - 6), 0f, 360f);
|
||||
}
|
||||
}
|
||||
if (radioStyle == Style.iOS)
|
||||
{
|
||||
e.Graphics.DrawEllipse(new Pen(Color.FromArgb(250, 36, 38), 2f), 2, 2, base.Height - 4, base.Height - 4);
|
||||
if (isChecked)
|
||||
{
|
||||
e.Graphics.FillPie(new SolidBrush(Color.FromArgb(250, 36, 38)), new Rectangle(5, 5, base.Height - 2 - 8, base.Height - 2 - 8), 0f, 360f);
|
||||
}
|
||||
}
|
||||
if (radioStyle == Style.Android)
|
||||
{
|
||||
e.Graphics.DrawEllipse(new Pen(Color.FromArgb(255, 0, 0), 2f), 2, 2, base.Height - 4, base.Height - 4);
|
||||
if (isChecked)
|
||||
{
|
||||
e.Graphics.FillPie(new SolidBrush(Color.FromArgb(255, 0, 0)), new Rectangle(5, 5, base.Height - 2 - 8, base.Height - 2 - 8), 0f, 360f);
|
||||
}
|
||||
}
|
||||
StringFormat stringFormat = new()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Near
|
||||
};
|
||||
SolidBrush brush = new(ForeColor);
|
||||
RectangleF layoutRectangle = new(base.Height + 3, 0f, base.Width - base.Height - 2, Height);
|
||||
e.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
e.Graphics.TextRenderingHint = TextRenderingType;
|
||||
e.Graphics.DrawString(Text, Font, brush, layoutRectangle, stringFormat);
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
private bool isChecked;
|
||||
|
||||
private Color radioColor = Color.FromArgb(15, 15, 15);
|
||||
|
||||
private Color radioHoverColor = Color.FromArgb(155, 31, 33);
|
||||
|
||||
private Style radioStyle = Style.Material;
|
||||
|
||||
private Color currentColor;
|
||||
|
||||
public enum Style
|
||||
{
|
||||
iOS,
|
||||
Android,
|
||||
Material
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ClasicRadioButton
|
||||
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_ClasicRadioButton : Control
|
||||
{
|
||||
#region " Control Help - MouseState & Flicker Control"
|
||||
private Point mouse = new(0, 0);
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = 14;
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
mouse = e.Location;
|
||||
base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
private bool _Checked;
|
||||
public bool Checked
|
||||
{
|
||||
get => _Checked;
|
||||
set
|
||||
{
|
||||
_Checked = value;
|
||||
InvalidateControls();
|
||||
CheckedChanged?.Invoke(this);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
if (mouse.X <= Height - 1 || mouse.Y <= Width - 1)
|
||||
{
|
||||
if (!_Checked)
|
||||
{
|
||||
Checked = true;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
base.OnClick(e);
|
||||
}
|
||||
|
||||
public event CheckedChangedEventHandler CheckedChanged;
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
|
||||
protected override void OnCreateControl()
|
||||
{
|
||||
base.OnCreateControl();
|
||||
InvalidateControls();
|
||||
}
|
||||
|
||||
private void InvalidateControls()
|
||||
{
|
||||
if (!IsHandleCreated || !_Checked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Control C in Parent.Controls)
|
||||
{
|
||||
if (!object.ReferenceEquals(C, this) && C is CrEaTiiOn_ClasicRadioButton button)
|
||||
{
|
||||
button.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Variables
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
private Color _EllipseBorderColorA = Color.FromArgb(15, 15, 15);
|
||||
private Color _EllipseBorderColorB = Color.FromArgb(15, 15, 15);
|
||||
private Color _EllipseBackColorA = Color.Transparent;
|
||||
private Color _EllipseBackColorB = Color.Transparent;
|
||||
private Color _CheckedColorA = Color.FromArgb(250, 36, 38);
|
||||
private Color _CheckedColorB = Color.FromArgb(250, 36, 38);
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color EllipseBorderColorA
|
||||
{
|
||||
get => _EllipseBorderColorA;
|
||||
set => _EllipseBorderColorA = value;
|
||||
}
|
||||
|
||||
public Color EllipseBorderColorB
|
||||
{
|
||||
get => _EllipseBorderColorB;
|
||||
set => _EllipseBorderColorB = value;
|
||||
}
|
||||
|
||||
public Color EllipseBackColorA
|
||||
{
|
||||
get => _EllipseBackColorA;
|
||||
set => _EllipseBackColorA = value;
|
||||
}
|
||||
|
||||
public Color EllipseBackColorB
|
||||
{
|
||||
get => _EllipseBackColorB;
|
||||
set => _EllipseBackColorB = value;
|
||||
}
|
||||
|
||||
public Color CheckedColorA
|
||||
{
|
||||
get => _CheckedColorA;
|
||||
set => _CheckedColorA = value;
|
||||
}
|
||||
|
||||
public Color CheckedColorB
|
||||
{
|
||||
get => _CheckedColorB;
|
||||
set => _CheckedColorB = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_ClasicRadioButton() : base()
|
||||
{
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
Font = new("Segoe UI", 6.75f, FontStyle.Bold);
|
||||
Size = new(105, 14);
|
||||
DoubleBuffered = true;
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
|
||||
G.SmoothingMode = SmoothingType;
|
||||
G.Clear(Parent.FindForm().BackColor);
|
||||
|
||||
G.DrawEllipse(new(EllipseBorderColorA), new Rectangle(0, 0, Height - 2, Height - 1));
|
||||
LinearGradientBrush bgGrad = new(new Rectangle(0, 0, Height - 2, Height - 2), EllipseBackColorA, EllipseBackColorB, 90);
|
||||
G.FillEllipse(bgGrad, new Rectangle(0, 0, Height - 2, Height - 2));
|
||||
G.DrawEllipse(new(EllipseBorderColorB), new Rectangle(1, 1, Height - 4, Height - 4));
|
||||
|
||||
if (Checked)
|
||||
{
|
||||
G.FillEllipse(new SolidBrush(CheckedColorA), new Rectangle(3, 3, Height - 8, Height - 8));
|
||||
G.FillEllipse(new SolidBrush(CheckedColorB), new Rectangle(4, 4, Height - 10, Height - 10));
|
||||
}
|
||||
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), new Point(16, 1), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Near,
|
||||
LineAlignment = StringAlignment.Near
|
||||
});
|
||||
|
||||
e.Graphics.DrawImage(B, 0, 0);
|
||||
G.Dispose();
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_MetroRadioButton
|
||||
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_MetroRadioButton : Control
|
||||
{
|
||||
#region " Control Help - MouseState & Flicker Control"
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = 16;
|
||||
}
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
private bool _Checked;
|
||||
public bool Checked
|
||||
{
|
||||
get => _Checked;
|
||||
set
|
||||
{
|
||||
_Checked = value;
|
||||
InvalidateControls();
|
||||
CheckedChanged?.Invoke(this);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
if (!_Checked)
|
||||
{
|
||||
@Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@Checked = false;
|
||||
}
|
||||
|
||||
base.OnClick(e);
|
||||
}
|
||||
|
||||
public event CheckedChangedEventHandler CheckedChanged;
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
protected override void OnCreateControl()
|
||||
{
|
||||
base.OnCreateControl();
|
||||
InvalidateControls();
|
||||
}
|
||||
|
||||
private void InvalidateControls()
|
||||
{
|
||||
if (!IsHandleCreated || !_Checked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Control C in Parent.Controls)
|
||||
{
|
||||
if (!object.ReferenceEquals(C, this) && C is CrEaTiiOn_MetroRadioButton button)
|
||||
{
|
||||
button.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private CompositingQuality _CompositingQualityType = CompositingQuality.HighQuality;
|
||||
public CompositingQuality CompositingQualityType
|
||||
{
|
||||
get => _CompositingQualityType;
|
||||
set
|
||||
{
|
||||
_CompositingQualityType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.AntiAliasGridFit;
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckedColor = Color.FromArgb(250, 36, 38);
|
||||
public Color CheckedColor
|
||||
{
|
||||
get => _CheckedColor;
|
||||
set
|
||||
{
|
||||
_CheckedColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CircleBorderColor = Color.FromArgb(20, 20, 20);
|
||||
public Color CircleBorderColor
|
||||
{
|
||||
get => _CircleBorderColor;
|
||||
set
|
||||
{
|
||||
_CircleBorderColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CircleEdgeColor = Color.White;
|
||||
public Color CircleEdgeColor
|
||||
{
|
||||
get => _CircleEdgeColor;
|
||||
set
|
||||
{
|
||||
_CircleEdgeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckedBorderColorA = Color.FromArgb(250, 36, 38);
|
||||
public Color CheckedBorderColorA
|
||||
{
|
||||
get => _CheckedBorderColorA;
|
||||
set
|
||||
{
|
||||
_CheckedBorderColorA = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color _CheckedBorderColorB = Color.FromArgb(250, 36, 38);
|
||||
public Color CheckedBorderColorB
|
||||
{
|
||||
get => _CheckedBorderColorB;
|
||||
set
|
||||
{
|
||||
_CheckedBorderColorB = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_MetroRadioButton() : base()
|
||||
{
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
Size = new(133, 16);
|
||||
DoubleBuffered = true;
|
||||
Cursor = Cursors.Hand;
|
||||
Font = new("Segoe UI", 8, FontStyle.Bold);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
Rectangle radioBtnRectangle = new(0, 0, Height, Height - 1);
|
||||
Rectangle Inner = new(1, 1, Height - 2, Height - 3);
|
||||
|
||||
G.SmoothingMode = SmoothingType;
|
||||
G.CompositingQuality = CompositingQualityType;
|
||||
G.TextRenderingHint = TextRenderingType;
|
||||
|
||||
G.Clear(BackColor);
|
||||
|
||||
LinearGradientBrush bgGrad = new(radioBtnRectangle, CheckedBorderColorA, CheckedBorderColorB, 90F);
|
||||
G.FillEllipse(bgGrad, radioBtnRectangle);
|
||||
|
||||
G.DrawEllipse(new(CircleBorderColor), radioBtnRectangle);
|
||||
G.DrawEllipse(new(CircleEdgeColor), Inner);
|
||||
|
||||
if (Checked)
|
||||
{
|
||||
G.DrawString("n", new Font("Marlett", 8, FontStyle.Bold), new SolidBrush(CheckedColor), 0, 3);
|
||||
}
|
||||
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), new Point(18, 8), new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Near,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
|
||||
e.Graphics.DrawImage(B, 0, 0);
|
||||
G.Dispose();
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
class CrEaTiiOn_ModernRadioButton : CrEaTiiOn_Ultimate_RadioButton
|
||||
{
|
||||
//Fields
|
||||
private Color checkedColor = Color.FromArgb(250, 36, 38);
|
||||
private Color unCheckedColor = Color.Gray;
|
||||
|
||||
//Properties
|
||||
public Color CheckedColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return checkedColor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
checkedColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color UnCheckedColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return unCheckedColor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
unCheckedColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
//Constructor
|
||||
public CrEaTiiOn_ModernRadioButton()
|
||||
{
|
||||
this.MinimumSize = new Size(0, 21);
|
||||
//Add a padding of 10 to the left to have a considerable distance between the text and the RadioButton.
|
||||
this.Padding = new Padding(10,0,0,0);
|
||||
}
|
||||
|
||||
//Overridden methods
|
||||
protected override void OnPaint(PaintEventArgs pevent)
|
||||
{
|
||||
//Fields
|
||||
Graphics graphics = pevent.Graphics;
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
float rbBorderSize = 18F;
|
||||
float rbCheckSize = 12F;
|
||||
RectangleF rectRbBorder = new RectangleF()
|
||||
{
|
||||
X = 0.5F,
|
||||
Y = (this.Height - rbBorderSize) / 2, //Center
|
||||
Width = rbBorderSize,
|
||||
Height = rbBorderSize
|
||||
};
|
||||
RectangleF rectRbCheck = new RectangleF()
|
||||
{
|
||||
X = rectRbBorder.X + ((rectRbBorder.Width - rbCheckSize) / 2), //Center
|
||||
Y = (this.Height - rbCheckSize) / 2, //Center
|
||||
Width = rbCheckSize,
|
||||
Height = rbCheckSize
|
||||
};
|
||||
|
||||
//Drawing
|
||||
using (Pen penBorder = new Pen(checkedColor, 1.6F))
|
||||
using (SolidBrush brushRbCheck = new SolidBrush(checkedColor))
|
||||
using (SolidBrush brushText = new SolidBrush(this.ForeColor))
|
||||
{
|
||||
//Draw surface
|
||||
graphics.Clear(this.BackColor);
|
||||
//Draw Radio Button
|
||||
if (this.Checked)
|
||||
{
|
||||
graphics.DrawEllipse(penBorder, rectRbBorder);//Circle border
|
||||
graphics.FillEllipse(brushRbCheck, rectRbCheck); //Circle Radio Check
|
||||
}
|
||||
else
|
||||
{
|
||||
penBorder.Color = unCheckedColor;
|
||||
graphics.DrawEllipse(penBorder, rectRbBorder); //Circle border
|
||||
}
|
||||
//Draw text
|
||||
graphics.DrawString(this.Text, this.Font, brushText,
|
||||
rbBorderSize + 8, (this.Height - TextRenderer.MeasureText(this.Text, this.Font).Height) / 2);//Y=Center
|
||||
}
|
||||
}
|
||||
|
||||
//X-> Obsolete code, this was replaced by the Padding property in the constructor
|
||||
//(this.Padding = new Padding(10,0,0,0);)
|
||||
//protected override void OnResize(EventArgs e)
|
||||
//{
|
||||
// base.OnResize(e);
|
||||
// this.Width = TextRenderer.MeasureText(this.Text, this.Font).Width + 30;
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_RadioButton
|
||||
|
||||
[DefaultEvent("CheckedChanged")]
|
||||
public class CrEaTiiOn_Ultimate_RadioButton : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
private int X;
|
||||
private bool _Checked;
|
||||
private Color _CheckedColor = Color.FromArgb(250, 36, 38);
|
||||
private Color _CircleColor = Color.FromArgb(15, 15, 15);
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.HighQuality;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get => _Checked;
|
||||
set
|
||||
{
|
||||
_Checked = value;
|
||||
InvalidateControls();
|
||||
CheckedChangedEvent?.Invoke(this);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color CircleColor
|
||||
{
|
||||
get => _CircleColor;
|
||||
set
|
||||
{
|
||||
_CircleColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color CheckedColor
|
||||
{
|
||||
get => _CheckedColor;
|
||||
set
|
||||
{
|
||||
_CheckedColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
public delegate void CheckedChangedEventHandler(object sender);
|
||||
private CheckedChangedEventHandler CheckedChangedEvent;
|
||||
|
||||
public event CheckedChangedEventHandler CheckedChanged
|
||||
{
|
||||
add => CheckedChangedEvent = (CheckedChangedEventHandler)Delegate.Combine(CheckedChangedEvent, value);
|
||||
remove => CheckedChangedEvent = (CheckedChangedEventHandler)Delegate.Remove(CheckedChangedEvent, value);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
if (!_Checked)
|
||||
{
|
||||
@Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@Checked = false;
|
||||
}
|
||||
|
||||
Focus();
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
X = e.X;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextChanged(e);
|
||||
//Width = 20 + (int)CreateGraphics().MeasureString(Text, Font).Width;
|
||||
//Width = 20 + (int)TextRenderer.MeasureText(Text, Font).Width;
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = 17;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_Ultimate_RadioButton()
|
||||
{
|
||||
Size = new(120, 17);
|
||||
DoubleBuffered = true;
|
||||
Cursor = Cursors.Hand;
|
||||
ForeColor = Color.White;
|
||||
}
|
||||
|
||||
private void InvalidateControls()
|
||||
{
|
||||
if (!IsHandleCreated || !_Checked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Control _Control in Parent.Controls)
|
||||
{
|
||||
if (_Control != this && _Control is CrEaTiiOn_Ultimate_RadioButton button)
|
||||
{
|
||||
button.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Graphics G = e.Graphics;
|
||||
G.Clear(Parent.BackColor);
|
||||
G.SmoothingMode = SmoothingType;
|
||||
|
||||
G.FillEllipse(new SolidBrush(CircleColor), new Rectangle(0, 0, 16, 16));
|
||||
|
||||
if (_Checked)
|
||||
{
|
||||
G.DrawString("a", new Font("Marlett", 15), new SolidBrush(CheckedColor), new Point(-3, -2));
|
||||
}
|
||||
|
||||
G.DrawString(Text, Font, new SolidBrush(ForeColor), new Point(20, -3));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,207 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_RichTextBox
|
||||
|
||||
[DefaultEvent("TextChanged")]
|
||||
public class CrEaTiiOn_RichTextBox : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
public System.Windows.Forms.RichTextBox DungeonRTB = new();
|
||||
private bool _ReadOnly;
|
||||
private bool _WordWrap;
|
||||
private bool _AutoWordSelection;
|
||||
private GraphicsPath Shape;
|
||||
private Pen P1;
|
||||
private Color _BorderColor = Color.FromArgb(250, 36, 38);
|
||||
private Color _EdgeColor = Color.FromArgb(15, 15, 15);
|
||||
private Color _TextBackColor = Color.FromArgb(15, 15, 15);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public Color BorderColor
|
||||
{
|
||||
get => _BorderColor;
|
||||
set => _BorderColor = value;
|
||||
}
|
||||
|
||||
public Color EdgeColor
|
||||
{
|
||||
get => _EdgeColor;
|
||||
set => _EdgeColor = value;
|
||||
}
|
||||
|
||||
public Color TextBackColor
|
||||
{
|
||||
get => _TextBackColor;
|
||||
set => _TextBackColor = value;
|
||||
}
|
||||
|
||||
public override string Text
|
||||
{
|
||||
get => DungeonRTB.Text;
|
||||
set
|
||||
{
|
||||
DungeonRTB.Text = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
public bool ReadOnly
|
||||
{
|
||||
get => _ReadOnly;
|
||||
set
|
||||
{
|
||||
_ReadOnly = value;
|
||||
if (DungeonRTB != null)
|
||||
{
|
||||
DungeonRTB.ReadOnly = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool WordWrap
|
||||
{
|
||||
get => _WordWrap;
|
||||
set
|
||||
{
|
||||
_WordWrap = value;
|
||||
if (DungeonRTB != null)
|
||||
{
|
||||
DungeonRTB.WordWrap = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool AutoWordSelection
|
||||
{
|
||||
get => _AutoWordSelection;
|
||||
set
|
||||
{
|
||||
_AutoWordSelection = value;
|
||||
if (DungeonRTB != null)
|
||||
{
|
||||
DungeonRTB.AutoWordSelection = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
protected override void OnForeColorChanged(System.EventArgs e)
|
||||
{
|
||||
base.OnForeColorChanged(e);
|
||||
DungeonRTB.ForeColor = ForeColor;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(System.EventArgs e)
|
||||
{
|
||||
base.OnFontChanged(e);
|
||||
DungeonRTB.Font = Font;
|
||||
}
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaintBackground(e);
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(System.EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
DungeonRTB.Size = new(Width - 13, Height - 11);
|
||||
}
|
||||
|
||||
private void _Enter(object Obj, EventArgs e)
|
||||
{
|
||||
P1 = new(Color.FromArgb(205, 87, 40));
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void _Leave(object Obj, EventArgs e)
|
||||
{
|
||||
P1 = new(Color.FromArgb(180, 180, 180));
|
||||
Refresh();
|
||||
}
|
||||
|
||||
protected override void OnResize(System.EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
Shape = new();
|
||||
GraphicsPath _Shape = Shape;
|
||||
_Shape.AddArc(0, 0, 10, 10, 180, 90);
|
||||
_Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
|
||||
_Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
|
||||
_Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
|
||||
_Shape.CloseAllFigures();
|
||||
}
|
||||
|
||||
public void _TextChanged(object s, EventArgs e)
|
||||
{
|
||||
DungeonRTB.Text = Text;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void AddRichTextBox()
|
||||
{
|
||||
System.Windows.Forms.RichTextBox _RTB = DungeonRTB;
|
||||
_RTB.BackColor = _TextBackColor;
|
||||
_RTB.Size = new(Width - 10, 100);
|
||||
_RTB.Location = new(7, 5);
|
||||
_RTB.Text = string.Empty;
|
||||
_RTB.BorderStyle = BorderStyle.None;
|
||||
_RTB.Font = Font;
|
||||
_RTB.Multiline = true;
|
||||
}
|
||||
|
||||
public CrEaTiiOn_RichTextBox() : base()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
|
||||
AddRichTextBox();
|
||||
Controls.Add(DungeonRTB);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.White;
|
||||
|
||||
P1 = new(_BorderColor);
|
||||
Text = null;
|
||||
Font = new("Tahoma", 10);
|
||||
Size = new(150, 100);
|
||||
WordWrap = true;
|
||||
AutoWordSelection = false;
|
||||
DoubleBuffered = true;
|
||||
|
||||
DungeonRTB.Enter += _Enter;
|
||||
DungeonRTB.Leave += _Leave;
|
||||
TextChanged += _TextChanged;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
G.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
G.Clear(BackColor);
|
||||
G.FillPath(new SolidBrush(_EdgeColor), Shape);
|
||||
G.DrawPath(P1, Shape);
|
||||
G.Dispose();
|
||||
e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,252 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_RichTextBoxEdit
|
||||
|
||||
[DefaultEvent("TextChanged")]
|
||||
public class CrEaTiiOn_RichTextBoxEdit : Control
|
||||
{
|
||||
#region Variables
|
||||
|
||||
public System.Windows.Forms.RichTextBox RT_RTB = new();
|
||||
private bool _ReadOnly;
|
||||
private bool _WordWrap;
|
||||
private bool _AutoWordSelection;
|
||||
private GraphicsPath Shape;
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
|
||||
private Color _BaseColor = Color.Transparent;
|
||||
private Color _EdgeColor = Color.White;
|
||||
private Color _BorderColor = Color.FromArgb(180, 180, 180);
|
||||
private Color _TextBackColor = Color.White;
|
||||
private Font _TextFont = new("Tahoma", 10);
|
||||
private BorderStyle _TextBorderStyle = BorderStyle.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public override string Text
|
||||
{
|
||||
get => RT_RTB.Text;
|
||||
set
|
||||
{
|
||||
RT_RTB.Text = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReadOnly
|
||||
{
|
||||
get => _ReadOnly;
|
||||
set
|
||||
{
|
||||
_ReadOnly = value;
|
||||
if (RT_RTB != null)
|
||||
{
|
||||
RT_RTB.ReadOnly = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool WordWrap
|
||||
{
|
||||
get => _WordWrap;
|
||||
set
|
||||
{
|
||||
_WordWrap = value;
|
||||
if (RT_RTB != null)
|
||||
{
|
||||
RT_RTB.WordWrap = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool AutoWordSelection
|
||||
{
|
||||
get => _AutoWordSelection;
|
||||
set
|
||||
{
|
||||
_AutoWordSelection = value;
|
||||
if (RT_RTB != null)
|
||||
{
|
||||
RT_RTB.AutoWordSelection = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color BaseColor
|
||||
{
|
||||
get => _BaseColor;
|
||||
set
|
||||
{
|
||||
_BaseColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color EdgeColor
|
||||
{
|
||||
get => _EdgeColor;
|
||||
set
|
||||
{
|
||||
_EdgeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color BorderColor
|
||||
{
|
||||
get => _BorderColor;
|
||||
set
|
||||
{
|
||||
_BorderColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color TextBackColor
|
||||
{
|
||||
get => _TextBackColor;
|
||||
set
|
||||
{
|
||||
_TextBackColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Font TextFont
|
||||
{
|
||||
get => _TextFont;
|
||||
set
|
||||
{
|
||||
_TextFont = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public BorderStyle TextBorderStyle
|
||||
{
|
||||
get => _TextBorderStyle;
|
||||
set
|
||||
{
|
||||
_TextBorderStyle = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EventArgs
|
||||
|
||||
protected override void OnForeColorChanged(EventArgs e)
|
||||
{
|
||||
base.OnForeColorChanged(e);
|
||||
RT_RTB.ForeColor = ForeColor;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
{
|
||||
base.OnFontChanged(e);
|
||||
RT_RTB.Font = Font;
|
||||
}
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaintBackground(e);
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
RT_RTB.Size = new(Width - 13, Height - 11);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
Shape = new();
|
||||
GraphicsPath _Shape = Shape;
|
||||
_Shape.AddArc(0, 0, 10, 10, 180, 90);
|
||||
_Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
|
||||
_Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
|
||||
_Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
|
||||
_Shape.CloseAllFigures();
|
||||
}
|
||||
|
||||
public void _TextChanged(object s, EventArgs e)
|
||||
{
|
||||
RT_RTB.Text = Text;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void AddRichTextBox()
|
||||
{
|
||||
System.Windows.Forms.RichTextBox _RTB = RT_RTB;
|
||||
_RTB.BackColor = TextBackColor;
|
||||
_RTB.Size = new(Width - 10, 100);
|
||||
_RTB.Location = new(7, 5);
|
||||
_RTB.Text = string.Empty;
|
||||
_RTB.BorderStyle = TextBorderStyle;
|
||||
_RTB.Font = TextFont;
|
||||
_RTB.Multiline = true;
|
||||
}
|
||||
|
||||
public CrEaTiiOn_RichTextBoxEdit() : base()
|
||||
{
|
||||
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
|
||||
AddRichTextBox();
|
||||
Controls.Add(RT_RTB);
|
||||
BackColor = Color.Transparent;
|
||||
ForeColor = Color.DimGray;
|
||||
|
||||
Text = null;
|
||||
Font = new("Tahoma", 10);
|
||||
Size = new(150, 100);
|
||||
WordWrap = true;
|
||||
AutoWordSelection = false;
|
||||
DoubleBuffered = true;
|
||||
|
||||
TextChanged += _TextChanged;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Bitmap B = new(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
G.SmoothingMode = SmoothingType;
|
||||
G.Clear(BaseColor);
|
||||
G.FillPath(new SolidBrush(EdgeColor), Shape);
|
||||
G.DrawPath(new(BorderColor), Shape);
|
||||
G.Dispose();
|
||||
e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
|
||||
B.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,448 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Segment
|
||||
|
||||
public class CrEaTiiOn_Segment : Control
|
||||
{
|
||||
public CrEaTiiOn_Segment()
|
||||
{
|
||||
base.Size = new Size(240, 30);
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The items, split by ','.")]
|
||||
public string Items
|
||||
{
|
||||
get => items;
|
||||
set
|
||||
{
|
||||
items = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The selected index")]
|
||||
public int SelectedIndex
|
||||
{
|
||||
get => selectedIndex;
|
||||
set
|
||||
{
|
||||
selectedIndex = value;
|
||||
OnIndexChanged();
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The segment style")]
|
||||
public Style SegmentStyle
|
||||
{
|
||||
get => segmentStyle;
|
||||
set
|
||||
{
|
||||
segmentStyle = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The segment selected base color")]
|
||||
public Color SegmentColor
|
||||
{
|
||||
get => segmentColor;
|
||||
set
|
||||
{
|
||||
segmentColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The segment back color")]
|
||||
public Color SegmentBackColor
|
||||
{
|
||||
get => segmentBackColor;
|
||||
set
|
||||
{
|
||||
segmentBackColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The active segment text color")]
|
||||
public Color SegmentActiveTextColor
|
||||
{
|
||||
get => segmentActiveTextColor;
|
||||
set
|
||||
{
|
||||
segmentActiveTextColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The active segment android font color")]
|
||||
public Color SegmentActiveFontColor
|
||||
{
|
||||
get => segmentActiveFontColor;
|
||||
set
|
||||
{
|
||||
segmentActiveFontColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Theinactive segment android font color")]
|
||||
public Color SegmentInactiveFontColor
|
||||
{
|
||||
get => segmentInactiveFontColor;
|
||||
set
|
||||
{
|
||||
segmentInactiveFontColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The active segment ios back color")]
|
||||
public Color SegmentActiveBackColor
|
||||
{
|
||||
get => segmentActiveBackColor;
|
||||
set
|
||||
{
|
||||
segmentActiveBackColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Theinactive segment text color")]
|
||||
public Color SegmentInactiveTextColor
|
||||
{
|
||||
get => segmentInactiveTextColor;
|
||||
set
|
||||
{
|
||||
segmentInactiveTextColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Theinactive segment ios border color")]
|
||||
public Color SegmentInactiveBorderColor
|
||||
{
|
||||
get => segmentInactiveBorderColor;
|
||||
set
|
||||
{
|
||||
segmentInactiveBorderColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Theinactive segment android normal color")]
|
||||
public Color SegmentNormalBackColor
|
||||
{
|
||||
get => segmentNormalBackColor;
|
||||
set
|
||||
{
|
||||
segmentNormalBackColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The active segment android line color")]
|
||||
public Color SegmentActiveLineColor
|
||||
{
|
||||
get => segmentActiveLineColor;
|
||||
set
|
||||
{
|
||||
segmentActiveLineColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private InterpolationMode _InterpolationType = InterpolationMode.HighQualityBilinear;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public InterpolationMode InterpolationType
|
||||
{
|
||||
get => _InterpolationType;
|
||||
set
|
||||
{
|
||||
_InterpolationType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private CompositingQuality _CompositingQualityType = CompositingQuality.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public CompositingQuality CompositingQualityType
|
||||
{
|
||||
get => _CompositingQualityType;
|
||||
set
|
||||
{
|
||||
_CompositingQualityType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private TextRenderingHint _TextRenderingType = TextRenderingHint.ClearTypeGridFit;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public TextRenderingHint TextRenderingType
|
||||
{
|
||||
get => _TextRenderingType;
|
||||
set
|
||||
{
|
||||
_TextRenderingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler IndexChanged;
|
||||
|
||||
protected virtual void OnIndexChanged()
|
||||
{
|
||||
IndexChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
e.Graphics.InterpolationMode = InterpolationType;
|
||||
e.Graphics.CompositingQuality = CompositingQualityType;
|
||||
e.Graphics.TextRenderingHint = TextRenderingType;
|
||||
int num = 0;
|
||||
foreach (string text in items.Split(new char[]
|
||||
{
|
||||
','
|
||||
}))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
int num2 = base.Width / num;
|
||||
int num3 = 0;
|
||||
int num4 = 0;
|
||||
if (segmentStyle == Style.iOS)
|
||||
{
|
||||
foreach (string s in items.Split(new char[]
|
||||
{
|
||||
','
|
||||
}))
|
||||
{
|
||||
if (num3 <= num)
|
||||
{
|
||||
Rectangle r = new(num4, 0, num2, base.Height);
|
||||
StringFormat stringFormat = new()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
};
|
||||
e.Graphics.DrawRectangle(new Pen(SegmentInactiveBorderColor, 1f), 0, 0, base.Width - 1, base.Height - 1);
|
||||
if (selectedIndex == num3)
|
||||
{
|
||||
e.Graphics.FillRectangle(new SolidBrush(SegmentActiveBackColor), num4, 0, num2, base.Height);
|
||||
e.Graphics.DrawString(s, Font, new SolidBrush(SegmentActiveTextColor), r, stringFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawRectangle(new Pen(SegmentInactiveBorderColor, 1f), num4, 0, num4 + num2, base.Height - 1);
|
||||
e.Graphics.DrawString(s, Font, new SolidBrush(SegmentInactiveBorderColor), r, stringFormat);
|
||||
}
|
||||
}
|
||||
num4 += num2;
|
||||
num3++;
|
||||
}
|
||||
}
|
||||
if (segmentStyle == Style.Android)
|
||||
{
|
||||
e.Graphics.FillRectangle(new SolidBrush(SegmentNormalBackColor), 0, 0, base.Width, base.Height);
|
||||
foreach (string s2 in items.Split(new char[]
|
||||
{
|
||||
','
|
||||
}))
|
||||
{
|
||||
if (num3 <= num)
|
||||
{
|
||||
Rectangle r2 = new(num4, 0, num2, base.Height - 5);
|
||||
StringFormat stringFormat2 = new()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
};
|
||||
if (selectedIndex == num3)
|
||||
{
|
||||
e.Graphics.FillRectangle(new SolidBrush(SegmentActiveLineColor), num4, base.Height - 3, num2, 3);
|
||||
e.Graphics.DrawString(s2, Font, new SolidBrush(SegmentActiveFontColor), r2, stringFormat2);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawString(s2, Font, new SolidBrush(SegmentInactiveFontColor), r2, stringFormat2);
|
||||
}
|
||||
}
|
||||
num4 += num2;
|
||||
num3++;
|
||||
}
|
||||
}
|
||||
if (segmentStyle == Style.Material)
|
||||
{
|
||||
e.Graphics.FillRectangle(new SolidBrush(segmentBackColor), 0, 0, base.Width, base.Height);
|
||||
foreach (string s3 in items.Split(new char[]
|
||||
{
|
||||
','
|
||||
}))
|
||||
{
|
||||
if (num3 <= num)
|
||||
{
|
||||
Rectangle r3 = new(num4, 0, num2, base.Height - 5);
|
||||
StringFormat stringFormat3 = new()
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
};
|
||||
if (selectedIndex == num3)
|
||||
{
|
||||
e.Graphics.FillRectangle(new SolidBrush(segmentColor), num4, base.Height - 3, num2, 3);
|
||||
e.Graphics.DrawString(s3, Font, new SolidBrush(segmentActiveTextColor), r3, stringFormat3);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawString(s3, Font, new SolidBrush(segmentInactiveTextColor), r3, stringFormat3);
|
||||
}
|
||||
}
|
||||
num4 += num2;
|
||||
num3++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
foreach (string text in items.Split(new char[]
|
||||
{
|
||||
','
|
||||
}))
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
int num3 = base.Width / num2;
|
||||
if (e.X > 0)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
if (e.X > num3)
|
||||
{
|
||||
num = 1;
|
||||
}
|
||||
if (e.X > num3 * 2)
|
||||
{
|
||||
num = 2;
|
||||
}
|
||||
if (e.X > num3 * 3)
|
||||
{
|
||||
num = 3;
|
||||
}
|
||||
if (e.X > num3 * 4)
|
||||
{
|
||||
num = 4;
|
||||
}
|
||||
if (e.X > num3 * 5)
|
||||
{
|
||||
num = 5;
|
||||
}
|
||||
if (e.X > num3 * 6)
|
||||
{
|
||||
num = 6;
|
||||
}
|
||||
if (e.X > num3 * 7)
|
||||
{
|
||||
num = 7;
|
||||
}
|
||||
if (e.X > num3 * 8)
|
||||
{
|
||||
num = 8;
|
||||
}
|
||||
if (e.X > num3 * 9)
|
||||
{
|
||||
num = 9;
|
||||
}
|
||||
if (e.X > num3 * 10)
|
||||
{
|
||||
num = 10;
|
||||
}
|
||||
if (num != selectedIndex)
|
||||
{
|
||||
SelectedIndex = num;
|
||||
}
|
||||
}
|
||||
|
||||
private string items = "Contacts, Recents, Messages, Dialer";
|
||||
|
||||
private int selectedIndex;
|
||||
|
||||
private Style segmentStyle = Style.Material;
|
||||
|
||||
private Color segmentColor = Color.White;
|
||||
|
||||
private Color segmentBackColor = Color.FromArgb(0, 150, 135);
|
||||
|
||||
private Color segmentActiveTextColor = Color.White;
|
||||
|
||||
private Color segmentActiveFontColor = Color.FromArgb(65, 130, 205);
|
||||
|
||||
private Color segmentActiveBackColor = Color.FromArgb(0, 120, 255);
|
||||
|
||||
private Color segmentActiveLineColor = Color.FromArgb(65, 130, 205);
|
||||
|
||||
private Color segmentInactiveTextColor = Color.FromArgb(150, 210, 210);
|
||||
|
||||
private Color segmentInactiveFontColor = Color.FromArgb(153, 153, 153);
|
||||
|
||||
private Color segmentInactiveBorderColor = Color.FromArgb(0, 120, 255);
|
||||
|
||||
private Color segmentNormalBackColor = Color.White;
|
||||
|
||||
public enum Style
|
||||
{
|
||||
iOS,
|
||||
Android,
|
||||
Material
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_LightSeperator : Control
|
||||
{
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
g.Clear(Parent.BackColor);
|
||||
|
||||
Point p1 = new Point();
|
||||
Point p2 = new Point();
|
||||
p1 = new Point(0, (Height - 1) / 2);
|
||||
p2 = new Point(Width, (Height - 1) / 2);
|
||||
|
||||
ColorBlend lineCB = new ColorBlend(3);
|
||||
lineCB.Colors = new[] { Color.Transparent, _lineColor, Color.Transparent };
|
||||
lineCB.Positions = new[] { 0.0F, 0.5F, 1.0F };
|
||||
|
||||
LinearGradientBrush lineLGB = new LinearGradientBrush(p1, p2, Color.Transparent, Color.Transparent);
|
||||
lineLGB.InterpolationColors = lineCB;
|
||||
|
||||
g.DrawLine(new Pen(lineLGB), p1, p2);
|
||||
|
||||
}
|
||||
|
||||
public CrEaTiiOn_LightSeperator()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
|
||||
Size = new Size(400, 9);
|
||||
}
|
||||
|
||||
private Color _lineColor = Color.Silver;
|
||||
public Color LineColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _lineColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
_lineColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
#region Imports
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using CBH_Ultimate_Theme_Library;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
|
||||
public class CrEaTiiOn_ModernSeperator : ThemeControl154
|
||||
{
|
||||
|
||||
private Orientation _Orientation;
|
||||
public Orientation Orientation
|
||||
{
|
||||
get { return _Orientation; }
|
||||
set
|
||||
{
|
||||
_Orientation = value;
|
||||
|
||||
if (value == Orientation.Vertical)
|
||||
{
|
||||
LockHeight = 0;
|
||||
LockWidth = 14;
|
||||
}
|
||||
else
|
||||
{
|
||||
LockHeight = 14;
|
||||
LockWidth = 0;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_ModernSeperator()
|
||||
{
|
||||
Transparent = true;
|
||||
BackColor = Color.Transparent;
|
||||
|
||||
LockHeight = 14;
|
||||
}
|
||||
|
||||
|
||||
protected override void ColorHook()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void PaintHook()
|
||||
{
|
||||
G.Clear(BackColor);
|
||||
|
||||
ColorBlend BL1 = new ColorBlend();
|
||||
ColorBlend BL2 = new ColorBlend();
|
||||
BL1.Positions = new float[] {
|
||||
0f,
|
||||
0.15f,
|
||||
0.85f,
|
||||
1f
|
||||
};
|
||||
BL2.Positions = new float[] {
|
||||
0f,
|
||||
0.15f,
|
||||
0.5f,
|
||||
0.85f,
|
||||
1f
|
||||
};
|
||||
|
||||
BL1.Colors = new Color[] {
|
||||
Color.Transparent,
|
||||
Color.Black,
|
||||
Color.Black,
|
||||
Color.Transparent
|
||||
};
|
||||
BL2.Colors = new Color[] {
|
||||
Color.Transparent,
|
||||
Color.FromArgb(35, 35, 35),
|
||||
Color.FromArgb(45, 45, 45),
|
||||
Color.FromArgb(35, 35, 35),
|
||||
Color.Transparent
|
||||
};
|
||||
|
||||
if (_Orientation == Orientation.Vertical)
|
||||
{
|
||||
DrawGradient(BL1, 6, 0, 1, Height);
|
||||
DrawGradient(BL2, 7, 0, 1, Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawGradient(BL1, 0, 6, Width, 1, 0f);
|
||||
DrawGradient(BL2, 0, 7, Width, 1, 0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Separator
|
||||
|
||||
public class CrEaTiiOn_Separator : Control
|
||||
{
|
||||
#region Properties
|
||||
|
||||
private Color _LineColor = Color.Gray;
|
||||
public Color LineColor
|
||||
{
|
||||
get => _LineColor;
|
||||
set
|
||||
{
|
||||
_LineColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public CrEaTiiOn_Separator()
|
||||
{
|
||||
SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
Size = new(120, 10);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
e.Graphics.DrawLine(new(LineColor), 0, 5, Width, 5);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_Sleeper
|
||||
|
||||
public class CrEaTiiOn_Sleeper : Component
|
||||
{
|
||||
public void Sleep(int Milliseconds)
|
||||
{
|
||||
DateTime Time = DateTime.Now.AddMilliseconds(Milliseconds);
|
||||
|
||||
while (DateTime.Now < Time)
|
||||
{
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatSliderBar : Control
|
||||
{
|
||||
#region 变量
|
||||
private RectangleF valueBar = new RectangleF(7, 5, 0, 6);
|
||||
private RectangleF valueRect = new RectangleF(0, 1, 14, 14);
|
||||
private bool mouseFlat = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 属性
|
||||
private Color _themeColor = ThemeColors.PrimaryColor;
|
||||
[Description("主题颜色")]
|
||||
public Color ThemeColor
|
||||
{
|
||||
get { return _themeColor; }
|
||||
set
|
||||
{
|
||||
_themeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private int _minValue = 0;
|
||||
[Description("Slider的最小值")]
|
||||
public int MinValue
|
||||
{
|
||||
get { return _minValue; }
|
||||
set
|
||||
{
|
||||
if (value > _maxValue || value > _value) return;
|
||||
_minValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private int _maxValue = 10;
|
||||
[Description("Slider的最大值")]
|
||||
public int MaxValue
|
||||
{
|
||||
get { return _maxValue; }
|
||||
set
|
||||
{
|
||||
if (value < _minValue || value < _value) return;
|
||||
_maxValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private int _value = 0;
|
||||
[Description("Slider的当前值")]
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value >= _minValue && value <= _maxValue ? value : _minValue;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _showValue = false;
|
||||
[Description("是否显示数值")]
|
||||
public bool ShowValue
|
||||
{
|
||||
get { return _showValue; }
|
||||
set
|
||||
{
|
||||
_showValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private int ValueWidth
|
||||
{
|
||||
get { return Convert.ToInt32(_value * (Width - 30) / (_maxValue - _minValue)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事件
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = _showValue ? 45 : 16;
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
mouseFlat = new RectangleF(ValueWidth + 7, Height - 15, 14, 14).Contains(e.Location);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if (mouseFlat && e.X > -1 && e.X < (Width + 1))
|
||||
{
|
||||
_value = _minValue + Convert.ToInt32((float)(_maxValue - _minValue) * ((float)e.X / (float)Width));
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
mouseFlat = false;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
graphics.Clear(Parent.BackColor);
|
||||
|
||||
if (ShowValue && mouseFlat)
|
||||
{
|
||||
graphics.FillEllipse(new SolidBrush(_themeColor), new RectangleF(ValueWidth - 2 + 5, 1, 18, 18));
|
||||
graphics.FillPolygon(new SolidBrush(_themeColor), new PointF[]
|
||||
{
|
||||
new PointF(ValueWidth+1.305F-2+5,13.5F+1),
|
||||
new PointF(ValueWidth+7.794F+9-2+5,13.5F+1),
|
||||
new PointF(ValueWidth+9-2+5,28F)
|
||||
});
|
||||
graphics.DrawString(_value.ToString(), Font, new SolidBrush(Color.White), new RectangleF(ValueWidth - 2 + 5, 2, 18, 18), StringAlign.Center);
|
||||
}
|
||||
|
||||
graphics.FillRectangle(new SolidBrush(DrawHelper.BackColor), new RectangleF(15, Height - 10, Width - 30, 4));
|
||||
graphics.FillRectangle(new SolidBrush(Color.White), new RectangleF(15, Height - 10, ValueWidth, 4));
|
||||
graphics.FillRectangle(new SolidBrush(_themeColor), new RectangleF(15, Height - 10, ValueWidth, 4));
|
||||
graphics.FillEllipse(new SolidBrush(_themeColor), new RectangleF(ValueWidth + 5, Height - 17, 16, 16));
|
||||
graphics.FillEllipse(new SolidBrush(Color.White), new RectangleF(ValueWidth + 8, Height - 14, 10, 10));
|
||||
}
|
||||
|
||||
|
||||
public CrEaTiiOn_FlatSliderBar()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
DoubleBuffered = true;
|
||||
Height = 45;
|
||||
Font = new Font("Segoe UI", 8F);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,445 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_ModernSlider
|
||||
|
||||
public class CrEaTiiOn_ModernSlider : Control
|
||||
{
|
||||
public CrEaTiiOn_ModernSlider()
|
||||
{
|
||||
base.Size = new Size(250, 20);
|
||||
base.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
barRectangle = new(base.Height / 2 + 1, 1, base.Width - base.Height, base.Height - 1);
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The bar thickness")]
|
||||
public int BarThickness
|
||||
{
|
||||
get => barThickness;
|
||||
set
|
||||
{
|
||||
barThickness = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The increment incresed or decreased when not clicking in the handle")]
|
||||
public int BigStepIncrement
|
||||
{
|
||||
get => bigStepIncrement;
|
||||
set
|
||||
{
|
||||
bigStepIncrement = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The default percentage")]
|
||||
public int Percentage
|
||||
{
|
||||
get => percentage;
|
||||
set
|
||||
{
|
||||
percentage = value;
|
||||
OnScroll();
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The max percentage")]
|
||||
public int Max
|
||||
{
|
||||
get => max;
|
||||
set
|
||||
{
|
||||
max = value;
|
||||
OnScroll();
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The filled color")]
|
||||
public Color FilledColor
|
||||
{
|
||||
get => filledColor;
|
||||
set
|
||||
{
|
||||
filledColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The unfilled color")]
|
||||
public Color UnfilledColor
|
||||
{
|
||||
get => unfilledColor;
|
||||
set
|
||||
{
|
||||
unfilledColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The knob color")]
|
||||
public Color KnobColor
|
||||
{
|
||||
get => knobColor;
|
||||
set
|
||||
{
|
||||
knobColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The knob image")]
|
||||
public Image KnobImage
|
||||
{
|
||||
get => knobImage;
|
||||
set
|
||||
{
|
||||
knobImage = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("Allow instantly jumping to the position clicked")]
|
||||
public bool QuickHopping
|
||||
{
|
||||
get => quickHopping;
|
||||
set
|
||||
{
|
||||
quickHopping = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The slider style")]
|
||||
public Style SliderStyle
|
||||
{
|
||||
get => sliderStyle;
|
||||
set
|
||||
{
|
||||
sliderStyle = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The positions")]
|
||||
public List<float> Positions
|
||||
{
|
||||
get => _Positions;
|
||||
set
|
||||
{
|
||||
_Positions = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
[Description("The colors")]
|
||||
public List<Color> Colors
|
||||
{
|
||||
get => _Colors;
|
||||
set
|
||||
{
|
||||
_Colors = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private PixelOffsetMode _PixelOffsetType = PixelOffsetMode.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public PixelOffsetMode PixelOffsetType
|
||||
{
|
||||
get => _PixelOffsetType;
|
||||
set
|
||||
{
|
||||
_PixelOffsetType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private CompositingQuality _CompositingQualityType = CompositingQuality.HighQuality;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public CompositingQuality CompositingQualityType
|
||||
{
|
||||
get => _CompositingQualityType;
|
||||
set
|
||||
{
|
||||
_CompositingQualityType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private InterpolationMode _InterpolationType = InterpolationMode.HighQualityBilinear;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public InterpolationMode InterpolationType
|
||||
{
|
||||
get => _InterpolationType;
|
||||
set
|
||||
{
|
||||
_InterpolationType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler Scroll;
|
||||
|
||||
protected virtual void OnScroll()
|
||||
{
|
||||
Scroll?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
if (quickHopping)
|
||||
{
|
||||
Percentage = (int)Math.Round(max * e.X / (double)base.Width);
|
||||
onHandle = true;
|
||||
return;
|
||||
}
|
||||
|
||||
int num = Percentage * base.Width / max;
|
||||
|
||||
if (e.X > num - base.Height / 2 && e.X < num + base.Height / 2)
|
||||
{
|
||||
onHandle = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.X < num - base.Height / 2)
|
||||
{
|
||||
Percentage -= bigStepIncrement;
|
||||
if (Percentage < 0)
|
||||
{
|
||||
Percentage = 0;
|
||||
}
|
||||
base.Invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.X > num + base.Height / 2)
|
||||
{
|
||||
Percentage += bigStepIncrement;
|
||||
if (Percentage > max)
|
||||
{
|
||||
Percentage = max;
|
||||
}
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if (onHandle)
|
||||
{
|
||||
Percentage = (int)Math.Round(max * e.X / (double)base.Width);
|
||||
if (Percentage < 0)
|
||||
{
|
||||
Percentage = 0;
|
||||
}
|
||||
if (Percentage > max)
|
||||
{
|
||||
Percentage = max;
|
||||
}
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
onHandle = false;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
BufferedGraphicsContext bufferedGraphicsContext = BufferedGraphicsManager.Current;
|
||||
bufferedGraphicsContext.MaximumBuffer = new Size(base.Width + 1, base.Height + 1);
|
||||
|
||||
bufferedGraphics = bufferedGraphicsContext.Allocate(base.CreateGraphics(), base.ClientRectangle);
|
||||
|
||||
bufferedGraphics.Graphics.SmoothingMode = SmoothingType;
|
||||
bufferedGraphics.Graphics.InterpolationMode = InterpolationType;
|
||||
bufferedGraphics.Graphics.CompositingQuality = CompositingQualityType;
|
||||
bufferedGraphics.Graphics.PixelOffsetMode = PixelOffsetType;
|
||||
|
||||
int num = Percentage * base.Width / max;
|
||||
int num2 = Percentage * barRectangle.Width / max;
|
||||
|
||||
bufferedGraphics.Graphics.Clear(BackColor);
|
||||
|
||||
if (sliderStyle == Style.Flat)
|
||||
{
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(unfilledColor), base.Height / 2 + 1, base.Height / 2 - barThickness / 2, base.Width - base.Height - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(filledColor), 1 + base.Height / 2, base.Height / 2 - barThickness / 2, num2 - 2, barThickness);
|
||||
|
||||
if (knobImage == null)
|
||||
{
|
||||
bufferedGraphics.Graphics.FillEllipse(new SolidBrush(knobColor), num2 + 1, 1, base.Height - 2, base.Height - 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufferedGraphics.Graphics.DrawImage(new Bitmap(knobImage, base.Height - 2, base.Height - 2), num2 + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (sliderStyle == Style.MacOS)
|
||||
{
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(185, 185, 185)), base.Height / 2 + 1, base.Height / 2 - barThickness / 2, base.Width - base.Height - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(80, 150, 230)), 1 + base.Height / 2, base.Height / 2 - barThickness / 2, num2 - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillEllipse(new SolidBrush(Color.White), num2 + 1, 1, base.Height - 2, base.Height - 2);
|
||||
bufferedGraphics.Graphics.DrawEllipse(new Pen(Color.FromArgb(190, 200, 200)), num2 + 1, 1, base.Height - 2, base.Height - 2);
|
||||
}
|
||||
|
||||
if (sliderStyle == Style.Windows10)
|
||||
{
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(146, 147, 148)), base.Height / 2 + 1, base.Height / 2 - barThickness / 2, base.Width - base.Height - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(65, 155, 225)), 1 + base.Height / 2, base.Height / 2 - barThickness / 2, num2 - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(0, 120, 215)), num2 + 1 + base.Height / 3, 3, base.Height / 2 - 2, base.Height - 6);
|
||||
bufferedGraphics.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(0, 120, 215)), num2 + 1 + base.Height / 3, 0, base.Height / 2 - 2, 4);
|
||||
bufferedGraphics.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(0, 120, 215)), num2 + 1 + base.Height / 3, base.Height - 5, base.Height / 2 - 2, 4);
|
||||
}
|
||||
|
||||
if (sliderStyle == Style.Android)
|
||||
{
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(20, 20, 20)), base.Height / 2 + 1, base.Height / 2 - barThickness / 2, base.Width - base.Height - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(250, 36, 38)), 1 + base.Height / 2, base.Height / 2 - barThickness / 2, num2 - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(250, 36, 38)), num2 + 1 + barThickness / 3 * 5, base.Height / 2 - barThickness / 3 * 4, barThickness * 2, barThickness * 2);
|
||||
bufferedGraphics.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(20, 20, 20)), num2 + 1, 1, base.Height - 2, base.Height - 2);
|
||||
}
|
||||
|
||||
if (sliderStyle == Style.Material && Positions.Count == Colors.Count)
|
||||
{
|
||||
LinearGradientBrush linearGradientBrush = new(new Rectangle(0, 0, base.Width, base.Height), Color.Black, Color.Black, 0f, false)
|
||||
{
|
||||
InterpolationColors = new ColorBlend
|
||||
{
|
||||
Positions = Positions.ToArray(),
|
||||
Colors = Colors.ToArray()
|
||||
}
|
||||
};
|
||||
|
||||
linearGradientBrush.RotateTransform(1f);
|
||||
|
||||
bufferedGraphics.Graphics.FillRectangle(linearGradientBrush, base.Height / 2 + 1, base.Height / 2 - barThickness / 2, base.Width - base.Height - 2, barThickness);
|
||||
bufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.LightGray), 1 + base.Height / 2 + num2, base.Height / 2 - barThickness / 2, base.Width - base.Height - 2 - num2, barThickness);
|
||||
bufferedGraphics.Graphics.FillEllipse(new SolidBrush(Color.White), num2 + 1, 1, base.Height - 2, base.Height - 2);
|
||||
bufferedGraphics.Graphics.DrawEllipse(new Pen(Color.FromArgb(200, 200, 200)), num2 + 1, 1, base.Height - 2, base.Height - 2);
|
||||
}
|
||||
|
||||
bufferedGraphics.Render(e.Graphics);
|
||||
}
|
||||
|
||||
private Rectangle barRectangle;
|
||||
|
||||
private BufferedGraphics bufferedGraphics;
|
||||
|
||||
private bool onHandle;
|
||||
|
||||
private int barThickness = 4;
|
||||
|
||||
private int bigStepIncrement = 10;
|
||||
|
||||
private int max = 100;
|
||||
|
||||
private int percentage = 50;
|
||||
|
||||
private Color filledColor = Color.FromArgb(1, 119, 215);
|
||||
|
||||
private Color unfilledColor = Color.FromArgb(26, 169, 219);
|
||||
|
||||
private Color knobColor = Color.Gray;
|
||||
|
||||
private Image knobImage;
|
||||
|
||||
private bool quickHopping;
|
||||
|
||||
private Style sliderStyle = Style.Windows10;
|
||||
|
||||
private List<float> _Positions = new()
|
||||
{
|
||||
0f,
|
||||
0.2f,
|
||||
0.4f,
|
||||
0.6f,
|
||||
0.8f,
|
||||
1f
|
||||
};
|
||||
|
||||
private List<Color> _Colors = new()
|
||||
{
|
||||
Color.FromArgb(76, 217, 100),
|
||||
Color.FromArgb(85, 205, 205),
|
||||
Color.FromArgb(2, 124, 255),
|
||||
Color.FromArgb(130, 75, 180),
|
||||
Color.FromArgb(255, 0, 150),
|
||||
Color.FromArgb(255, 45, 85)
|
||||
};
|
||||
|
||||
public enum Style
|
||||
{
|
||||
Flat,
|
||||
Material,
|
||||
MacOS,
|
||||
Android,
|
||||
Windows10
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,253 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatStatusBar : ContainerControl
|
||||
{
|
||||
private bool mouseFlag = false;//鼠标状态
|
||||
private Point mousePoint;//鼠标位置
|
||||
private Rectangle minRectangle;//最小化按钮区域
|
||||
private Rectangle maxRectangle;//最大化按钮区域
|
||||
private Rectangle closeRectangle;//关闭按钮区域
|
||||
|
||||
private Color _themeColor = ThemeColors.LightPrimary;//主题颜色
|
||||
private Image _iconImage = null;//应用图标
|
||||
#region 属性
|
||||
|
||||
[Category("背景颜色")]
|
||||
public Color ThemeColor
|
||||
{
|
||||
get { return _themeColor; }
|
||||
set
|
||||
{
|
||||
_themeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示最小化
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
[Category("获取或设置一个值,该值指示是否在窗体的标题栏中显示“最小化”按钮。")]
|
||||
public bool MinimizeBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return ParentForm.MinimizeBox;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示最大化
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
[Category("获取或设置一个值,该值指示是否在窗体的标题栏中显示“最大化”按钮。")]
|
||||
public bool MaximizeBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return ParentForm.MaximizeBox;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 控件框是否显示在标题中
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
[Category("获取或设置一个值,该值指示控件框是否显示在标题中")]
|
||||
public bool ControlBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return ParentForm.ControlBox;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 事件
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
mouseFlag = true;
|
||||
mousePoint = e.Location;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if (mouseFlag)
|
||||
{
|
||||
Parent.Location = new Point(
|
||||
MousePosition.X - mousePoint.X,
|
||||
MousePosition.Y - mousePoint.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
mousePoint = e.Location;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
mouseFlag = false;
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
{
|
||||
base.OnClick(e);
|
||||
if (minRectangle.Contains(mousePoint))
|
||||
{
|
||||
ParentForm.WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
if (maxRectangle.Contains(mousePoint))
|
||||
{
|
||||
if (ParentForm.WindowState == FormWindowState.Maximized)
|
||||
{
|
||||
ParentForm.WindowState = FormWindowState.Normal;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentForm.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
}
|
||||
if (closeRectangle.Contains(mousePoint))
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
Height = 40;
|
||||
}
|
||||
|
||||
protected override void OnCreateControl()
|
||||
{
|
||||
base.OnCreateControl();
|
||||
ParentForm.FormBorderStyle = FormBorderStyle.None;
|
||||
ParentForm.AllowTransparency = false;
|
||||
ParentForm.FindForm().StartPosition = FormStartPosition.CenterScreen;
|
||||
ParentForm.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
|
||||
Invalidate();
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Location = new Point(0, 0);
|
||||
Width = ParentForm.Width;
|
||||
|
||||
Bitmap bitmap = new Bitmap(Width, Height);
|
||||
Graphics graphics = Graphics.FromImage(bitmap);
|
||||
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;//消除锯齿
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;//高质量显示
|
||||
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;//最高质量显示文本
|
||||
graphics.Clear(_themeColor);
|
||||
|
||||
var icoFont = new Font("Marlett", 12);
|
||||
//
|
||||
//绘制应用图标
|
||||
//
|
||||
if (_iconImage != null)
|
||||
{
|
||||
graphics.DrawImage(_iconImage, new Rectangle(10, 10, 25, 25));
|
||||
//
|
||||
//绘制标题
|
||||
//
|
||||
graphics.DrawString(Text, new Font("Segoe UI", 12f), new SolidBrush(ThemeColors.FourLevelBorder), new Rectangle(45, 1, Width - 100, Height), StringAlign.Left);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
//绘制标题
|
||||
//
|
||||
graphics.DrawString(Text, new Font("微软雅黑", 12f), new SolidBrush(ThemeColors.FourLevelBorder), new Rectangle(15, 1, Width - 100, Height), StringAlign.Left);
|
||||
}
|
||||
|
||||
if (ControlBox)
|
||||
{
|
||||
if (MinimizeBox)
|
||||
{
|
||||
minRectangle = new Rectangle(Width - 54 - (MaximizeBox ? 1 : 0) * 22, (Height - 16) / 2, 18, 18);
|
||||
//
|
||||
//最小化按钮
|
||||
//
|
||||
if (minRectangle.Contains(mousePoint))
|
||||
{
|
||||
graphics.DrawString("0", icoFont, new SolidBrush(ThemeColors.TwoLevelBorder), minRectangle, StringAlign.Center);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.DrawString("0", icoFont, new SolidBrush(Color.White), minRectangle, StringAlign.Center);
|
||||
}
|
||||
}
|
||||
if (MaximizeBox)
|
||||
{
|
||||
maxRectangle = new Rectangle(Width - 54, (Height - 16) / 2, 18, 18);
|
||||
//
|
||||
//最大化按钮
|
||||
//
|
||||
if (maxRectangle.Contains(mousePoint))
|
||||
{
|
||||
if (ParentForm.WindowState == FormWindowState.Normal)
|
||||
graphics.DrawString("1", icoFont, new SolidBrush(ThemeColors.TwoLevelBorder), maxRectangle, StringAlign.Center);
|
||||
else
|
||||
graphics.DrawString("2", icoFont, new SolidBrush(ThemeColors.TwoLevelBorder), maxRectangle, StringAlign.Center);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ParentForm.WindowState == FormWindowState.Normal)
|
||||
graphics.DrawString("1", icoFont, new SolidBrush(Color.White), maxRectangle, StringAlign.Center);
|
||||
else
|
||||
graphics.DrawString("2", icoFont, new SolidBrush(Color.White), maxRectangle, StringAlign.Center);
|
||||
}
|
||||
}
|
||||
|
||||
closeRectangle = new Rectangle(Width - 32, (Height - 16) / 2, 18, 18);
|
||||
//
|
||||
//关闭按钮
|
||||
//
|
||||
if (closeRectangle.Contains(mousePoint))
|
||||
{
|
||||
graphics.DrawString("r", icoFont, new SolidBrush(ThemeColors.Danger), closeRectangle, StringAlign.Center);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.DrawString("r", icoFont, new SolidBrush(Color.White), closeRectangle, StringAlign.Center);
|
||||
}
|
||||
}
|
||||
|
||||
base.OnPaint(e);
|
||||
graphics.Dispose();
|
||||
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
e.Graphics.DrawImageUnscaled(bitmap, 0, 0);
|
||||
bitmap.Dispose();
|
||||
}
|
||||
|
||||
public CrEaTiiOn_FlatStatusBar()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
|
||||
DoubleBuffered = true;
|
||||
Font = new Font("Segoe UI", 12);
|
||||
Height = 40;
|
||||
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,482 +0,0 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
#region CrEaTiiOn_JoyStick
|
||||
|
||||
public class CrEaTiiOn_JoyStick : Control
|
||||
{
|
||||
public CrEaTiiOn_JoyStick()
|
||||
{
|
||||
base.Size = new Size(122, 122);
|
||||
BackColor = Color.FromArgb(20, 20, 20);
|
||||
BackgroundImage = new Bitmap(base.Width, base.Height);
|
||||
ng = base.CreateGraphics();
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public Direction JoystickDirection => joystickDirection;
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public Control MovableObject
|
||||
{
|
||||
get => movableObject;
|
||||
set => movableObject = value;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public bool KeepOnScreen
|
||||
{
|
||||
get => keepOnScreen;
|
||||
set => keepOnScreen = value;
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public int Sensitivity
|
||||
{
|
||||
get => sensitivity;
|
||||
set
|
||||
{
|
||||
sensitivity = value;
|
||||
|
||||
if (sensitivity > 10)
|
||||
{
|
||||
sensitivity = 10;
|
||||
}
|
||||
|
||||
if (sensitivity < 1)
|
||||
{
|
||||
sensitivity = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public override Image BackgroundImage
|
||||
{
|
||||
get => backgroundImage;
|
||||
set
|
||||
{
|
||||
backgroundImage = value;
|
||||
backgroundImage = new Bitmap(BackgroundImage, new Size(base.Width, base.Height));
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public Color JoyStickColor
|
||||
{
|
||||
get => joyStickColor;
|
||||
set
|
||||
{
|
||||
joyStickColor = value;
|
||||
base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
|
||||
[Category("CrEaTiiOn")]
|
||||
[Browsable(true)]
|
||||
public SmoothingMode SmoothingType
|
||||
{
|
||||
get => _SmoothingType;
|
||||
set
|
||||
{
|
||||
_SmoothingType = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
moveStick = true;
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
if (moveStick)
|
||||
{
|
||||
int num;
|
||||
|
||||
if (e.X - base.Width / 6 * 2 / 2 < 0)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else if (e.X - base.Width / 6 * 2 / 2 + base.Width / 6 * 2 > base.Width)
|
||||
{
|
||||
num = base.Width - base.Width / 6 * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = e.X - base.Width / 6 * 2 / 2;
|
||||
}
|
||||
|
||||
int num2;
|
||||
|
||||
if (e.Y - base.Width / 6 * 2 / 2 < 0)
|
||||
{
|
||||
num2 = 0;
|
||||
}
|
||||
else if (e.Y - base.Width / 6 * 2 / 2 + base.Height / 6 * 2 > base.Height)
|
||||
{
|
||||
num2 = base.Height - base.Height / 6 * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = e.Y - base.Height / 6 * 2 / 2;
|
||||
}
|
||||
|
||||
int num3 = num + base.Width / 6;
|
||||
int num4 = num2 + base.Height / 6;
|
||||
|
||||
if (num4 < base.Height / 3 * 3)
|
||||
{
|
||||
if (num3 < base.Width / 3 * 3)
|
||||
{
|
||||
joystickDirection = Direction.LowerRight;
|
||||
}
|
||||
|
||||
if (num3 < base.Width / 3 * 2)
|
||||
{
|
||||
joystickDirection = Direction.LowerCenter;
|
||||
}
|
||||
|
||||
if (num3 < base.Width / 3)
|
||||
{
|
||||
joystickDirection = Direction.LowerLeft;
|
||||
}
|
||||
}
|
||||
|
||||
if (num4 < base.Height / 3 * 2)
|
||||
{
|
||||
if (num3 < base.Width / 3 * 3)
|
||||
{
|
||||
joystickDirection = Direction.MiddleRight;
|
||||
}
|
||||
|
||||
if (num3 < base.Width / 3 * 2)
|
||||
{
|
||||
joystickDirection = Direction.MiddleCenter;
|
||||
}
|
||||
|
||||
if (num3 < base.Width / 3)
|
||||
{
|
||||
joystickDirection = Direction.MiddleLeft;
|
||||
}
|
||||
}
|
||||
if (num4 < base.Height / 3)
|
||||
{
|
||||
if (num3 < base.Width / 3 * 3)
|
||||
{
|
||||
joystickDirection = Direction.UpperRight;
|
||||
}
|
||||
|
||||
if (num3 < base.Width / 3 * 2)
|
||||
{
|
||||
joystickDirection = Direction.UpperCenter;
|
||||
}
|
||||
|
||||
if (num3 < base.Width / 3)
|
||||
{
|
||||
joystickDirection = Direction.UpperLeft;
|
||||
}
|
||||
}
|
||||
|
||||
OnDirectionChanged();
|
||||
|
||||
Image image = new Bitmap(base.Width, base.Height);
|
||||
Graphics graphics = Graphics.FromImage(image);
|
||||
|
||||
graphics.SmoothingMode = SmoothingType;
|
||||
|
||||
graphics.FillRectangle(new SolidBrush(BackColor), -1, -1, base.Width + 1, base.Height + 1);
|
||||
graphics.DrawImage(new Bitmap(BackgroundImage, new Size(base.Width, base.Height)), 0, 0);
|
||||
graphics.FillPie(new SolidBrush(joyStickColor), new Rectangle(num, num2, base.Width / 6 * 2, base.Height / 6 * 2), 0f, 360f);
|
||||
|
||||
ng.DrawImage(image, 0, 0);
|
||||
|
||||
MoveObject();
|
||||
}
|
||||
|
||||
base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
moveStick = false;
|
||||
|
||||
joystickDirection = Direction.MiddleCenter;
|
||||
|
||||
OnDirectionChanged();
|
||||
|
||||
Image image = new Bitmap(base.Width, base.Height);
|
||||
Graphics graphics = Graphics.FromImage(image);
|
||||
|
||||
graphics.SmoothingMode = SmoothingType;
|
||||
|
||||
graphics.FillRectangle(new SolidBrush(BackColor), -1, -1, base.Width + 1, base.Height + 1);
|
||||
graphics.DrawImage(new Bitmap(BackgroundImage, new Size(base.Width, base.Height)), 0, 0);
|
||||
graphics.FillPie(new SolidBrush(joyStickColor), new Rectangle(base.Width / 6 * 2, base.Height / 6 * 2, base.Width / 6 * 2, base.Height / 6 * 2), 0f, 360f);
|
||||
|
||||
ng.DrawImage(image, 0, 0);
|
||||
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Image image = new Bitmap(base.Width, base.Height);
|
||||
Graphics graphics = Graphics.FromImage(image);
|
||||
|
||||
graphics.SmoothingMode = SmoothingType;
|
||||
|
||||
graphics.FillRectangle(new SolidBrush(BackColor), -1, -1, base.Width + 1, base.Height + 1);
|
||||
graphics.DrawImage(new Bitmap(BackgroundImage, new Size(base.Width, base.Height)), 0, 0);
|
||||
graphics.FillPie(new SolidBrush(joyStickColor), new Rectangle(base.Width / 6 * 2, base.Height / 6 * 2, base.Width / 6 * 2, base.Height / 6 * 2), 0f, 360f);
|
||||
|
||||
graphics.DrawImage(image, 0, 0);
|
||||
|
||||
e.Graphics.DrawImage(image, 0, 0);
|
||||
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
public event EventHandler DirectionChanged;
|
||||
|
||||
protected virtual void OnDirectionChanged()
|
||||
{
|
||||
DirectionChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void MoveObject()
|
||||
{
|
||||
if (movableObject != null)
|
||||
{
|
||||
if (keepOnScreen)
|
||||
{
|
||||
if (joystickDirection == Direction.UpperLeft)
|
||||
{
|
||||
if (movableObject.Location.X - sensitivity > -1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X - sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(0, movableObject.Location.Y);
|
||||
}
|
||||
|
||||
if (movableObject.Location.Y - sensitivity > -1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y - sensitivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.UpperCenter)
|
||||
{
|
||||
if (movableObject.Location.Y - sensitivity > -1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y - sensitivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.UpperRight)
|
||||
{
|
||||
if (movableObject.Location.X + movableObject.Width + sensitivity < movableObject.Parent.Width - 1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X + sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Parent.Width - movableObject.Width, movableObject.Location.Y);
|
||||
}
|
||||
|
||||
if (movableObject.Location.Y - sensitivity > -1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y - sensitivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.MiddleLeft)
|
||||
{
|
||||
if (movableObject.Location.X - sensitivity > -1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X - sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(0, movableObject.Location.Y);
|
||||
}
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.MiddleRight)
|
||||
{
|
||||
if (movableObject.Location.X + movableObject.Width + sensitivity < movableObject.Parent.Width - 1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X + sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Parent.Width - movableObject.Width, movableObject.Location.Y);
|
||||
}
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.LowerLeft)
|
||||
{
|
||||
if (movableObject.Location.X - sensitivity > -1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X - sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(0, movableObject.Location.Y);
|
||||
}
|
||||
|
||||
if (movableObject.Location.Y + movableObject.Height + sensitivity < movableObject.Parent.Height - 1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y + sensitivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Parent.Height - movableObject.Height);
|
||||
}
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.LowerCenter)
|
||||
{
|
||||
if (movableObject.Location.Y + movableObject.Height + sensitivity < movableObject.Parent.Height - 1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y + sensitivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Parent.Height - movableObject.Height);
|
||||
}
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.LowerRight)
|
||||
{
|
||||
if (movableObject.Location.X + movableObject.Width + sensitivity < movableObject.Parent.Width - 1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X + sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Parent.Width - movableObject.Width, movableObject.Location.Y);
|
||||
}
|
||||
|
||||
if (movableObject.Location.Y + movableObject.Height + sensitivity < movableObject.Parent.Height - 1)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y + sensitivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Parent.Height - movableObject.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (joystickDirection == Direction.UpperCenter)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y - sensitivity);
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.UpperLeft)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X - sensitivity, movableObject.Location.Y - sensitivity);
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.UpperRight)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X + sensitivity, movableObject.Location.Y - sensitivity);
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.MiddleLeft)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X - sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.MiddleRight)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X + sensitivity, movableObject.Location.Y);
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.LowerLeft)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X - sensitivity, movableObject.Location.Y + sensitivity);
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.LowerCenter)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X, movableObject.Location.Y + sensitivity);
|
||||
}
|
||||
|
||||
if (joystickDirection == Direction.LowerRight)
|
||||
{
|
||||
movableObject.Location = new Point(movableObject.Location.X + sensitivity, movableObject.Location.Y + sensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
movableObject.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Graphics ng;
|
||||
|
||||
private Direction joystickDirection = Direction.MiddleCenter;
|
||||
|
||||
private Control movableObject;
|
||||
|
||||
private bool keepOnScreen = true;
|
||||
|
||||
private int sensitivity = 3;
|
||||
|
||||
private Image backgroundImage;
|
||||
|
||||
private Color joyStickColor = Color.FromArgb(250, 36, 38);
|
||||
|
||||
private bool moveStick;
|
||||
|
||||
public enum Direction
|
||||
{
|
||||
UpperLeft,
|
||||
MiddleLeft,
|
||||
LowerLeft,
|
||||
UpperCenter,
|
||||
MiddleCenter,
|
||||
LowerCenter,
|
||||
UpperRight,
|
||||
MiddleRight,
|
||||
LowerRight
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
#region Imports
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_ContextMenuStrip : System.Windows.Forms.ContextMenuStrip
|
||||
{
|
||||
private Rectangle Rect;
|
||||
|
||||
private Graphics G;
|
||||
public CrEaTiiOn_ContextMenuStrip()
|
||||
{
|
||||
base.Renderer = Renderer;
|
||||
}
|
||||
|
||||
public CrEaTiiOn_ContextMenuStrip(IContainer container) : base(container)
|
||||
{
|
||||
}
|
||||
|
||||
private void Renderer_PaintMenuBackground(object sender, ToolStripRenderEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
G.Clear(Color.FromArgb(44, 44, 43));
|
||||
}
|
||||
|
||||
|
||||
private void Renderer_PaintMenuBorder(object sender, ToolStripRenderEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
using (Pen Border = new Pen(Color.FromArgb(42, 42, 41)))
|
||||
{
|
||||
G.DrawRectangle(Border, new Rectangle(e.AffectedBounds.X, e.AffectedBounds.Y, e.AffectedBounds.Width - 1, e.AffectedBounds.Height - 1));
|
||||
}
|
||||
}
|
||||
|
||||
private void Renderer_PaintItemArrow(object sender, ToolStripArrowRenderEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
using (Font TextFont = new Font("Marlett", 12))
|
||||
{
|
||||
using (SolidBrush TextBrush = new SolidBrush(Color.FromArgb(200, 200, 200)))
|
||||
{
|
||||
G.DrawString("8", TextFont, TextBrush, new Point(e.ArrowRectangle.X - 2, e.ArrowRectangle.Y + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Renderer_PaintItemImage(object sender, ToolStripItemImageRenderEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
G.DrawImage(e.Image, new Rectangle(4, 1, 16, 16));
|
||||
}
|
||||
|
||||
private void Renderer_PaintItemText(object sender, ToolStripItemTextRenderEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
using (Font ItemFont = new Font("Segoe UI", 9))
|
||||
{
|
||||
using (SolidBrush ItemBrush = new SolidBrush(Color.FromArgb(220, 220, 220)))
|
||||
{
|
||||
G.DrawString(e.Text, ItemFont, ItemBrush, new Point(e.TextRectangle.X, e.TextRectangle.Y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Renderer_PaintItemBackground(object sender, ToolStripItemRenderEventArgs e)
|
||||
{
|
||||
G = e.Graphics;
|
||||
|
||||
Rect = e.Item.ContentRectangle;
|
||||
|
||||
if (e.Item.Selected)
|
||||
{
|
||||
using (SolidBrush Fill = new SolidBrush(Color.FromArgb(54, 54, 53)))
|
||||
{
|
||||
G.FillRectangle(Fill, new Rectangle(Rect.X - 1, Rect.Y - 1, Rect.Width + 4, Rect.Height - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatContextMenuStrip : ContextMenuStrip
|
||||
{
|
||||
protected override void OnTextChanged( EventArgs e )
|
||||
{
|
||||
base.OnTextChanged( e );
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
public CrEaTiiOn_FlatContextMenuStrip()
|
||||
: base()
|
||||
{
|
||||
Renderer = new ToolStripProfessionalRenderer( new TColorTable() );
|
||||
ShowImageMargin = false;
|
||||
ForeColor = Color.White;
|
||||
Font = new Font( "Tahoma", 8 );
|
||||
}
|
||||
|
||||
protected override void OnPaint( PaintEventArgs e )
|
||||
{
|
||||
base.OnPaint( e );
|
||||
e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
}
|
||||
|
||||
public class TColorTable : ProfessionalColorTable
|
||||
{
|
||||
[Category( "Colors" )]
|
||||
public Color _BackColor { get; set; } = Color.FromArgb( 24, 22, 43 );
|
||||
|
||||
[Category( "Colors" )]
|
||||
public Color _CheckedColor { get; set; } = Color.FromArgb(250, 36, 38);
|
||||
|
||||
[Category( "Colors" )]
|
||||
public Color _BorderColor { get; set; } = Color.FromArgb( 53, 58, 60 );
|
||||
|
||||
public override Color ButtonSelectedBorder => _BackColor;
|
||||
|
||||
public override Color CheckBackground => _CheckedColor;
|
||||
|
||||
public override Color CheckPressedBackground => _CheckedColor;
|
||||
|
||||
public override Color CheckSelectedBackground => _CheckedColor;
|
||||
|
||||
public override Color ImageMarginGradientBegin => _CheckedColor;
|
||||
|
||||
public override Color ImageMarginGradientEnd => _CheckedColor;
|
||||
|
||||
public override Color ImageMarginGradientMiddle => _CheckedColor;
|
||||
|
||||
public override Color MenuBorder => _BorderColor;
|
||||
|
||||
public override Color MenuItemBorder => _BorderColor;
|
||||
|
||||
public override Color MenuItemSelected => _CheckedColor;
|
||||
|
||||
public override Color SeparatorDark => _BorderColor;
|
||||
|
||||
public override Color ToolStripDropDownBackground => _BackColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace CBH_Ultimate_Theme_Library.Theme.Controls.Strip.Support
|
||||
{
|
||||
public class cStripRenderer : ToolStripRenderer
|
||||
{
|
||||
|
||||
public event PaintMenuBackgroundEventHandler PaintMenuBackground;
|
||||
public delegate void PaintMenuBackgroundEventHandler(object sender, ToolStripRenderEventArgs e);
|
||||
public event PaintMenuBorderEventHandler PaintMenuBorder;
|
||||
public delegate void PaintMenuBorderEventHandler(object sender, ToolStripRenderEventArgs e);
|
||||
public event PaintMenuImageMarginEventHandler PaintMenuImageMargin;
|
||||
public delegate void PaintMenuImageMarginEventHandler(object sender, ToolStripRenderEventArgs e);
|
||||
public event PaintItemCheckEventHandler PaintItemCheck;
|
||||
public delegate void PaintItemCheckEventHandler(object sender, ToolStripItemImageRenderEventArgs e);
|
||||
public event PaintItemImageEventHandler PaintItemImage;
|
||||
public delegate void PaintItemImageEventHandler(object sender, ToolStripItemImageRenderEventArgs e);
|
||||
public event PaintItemTextEventHandler PaintItemText;
|
||||
public delegate void PaintItemTextEventHandler(object sender, ToolStripItemTextRenderEventArgs e);
|
||||
public event PaintItemBackgroundEventHandler PaintItemBackground;
|
||||
public delegate void PaintItemBackgroundEventHandler(object sender, ToolStripItemRenderEventArgs e);
|
||||
public event PaintItemArrowEventHandler PaintItemArrow;
|
||||
public delegate void PaintItemArrowEventHandler(object sender, ToolStripArrowRenderEventArgs e);
|
||||
public event PaintSeparatorEventHandler PaintSeparator;
|
||||
public delegate void PaintSeparatorEventHandler(object sender, ToolStripSeparatorRenderEventArgs e);
|
||||
|
||||
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
|
||||
{
|
||||
if (PaintMenuBackground != null)
|
||||
{
|
||||
PaintMenuBackground(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
|
||||
{
|
||||
if (PaintMenuImageMargin != null)
|
||||
{
|
||||
PaintMenuImageMargin(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
|
||||
{
|
||||
if (PaintMenuBorder != null)
|
||||
{
|
||||
PaintMenuBorder(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
|
||||
{
|
||||
if (PaintItemCheck != null)
|
||||
{
|
||||
PaintItemCheck(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
|
||||
{
|
||||
if (PaintItemImage != null)
|
||||
{
|
||||
PaintItemImage(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
|
||||
{
|
||||
if (PaintItemText != null)
|
||||
{
|
||||
PaintItemText(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
|
||||
{
|
||||
if (PaintItemBackground != null)
|
||||
{
|
||||
PaintItemBackground(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
|
||||
{
|
||||
if (PaintItemArrow != null)
|
||||
{
|
||||
PaintItemArrow(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
|
||||
{
|
||||
if (PaintSeparator != null)
|
||||
{
|
||||
PaintSeparator(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
#region
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_BarTabControl : TabControl
|
||||
{
|
||||
|
||||
public CrEaTiiOn_BarTabControl()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
|
||||
DoubleBuffered = true;
|
||||
SizeMode = TabSizeMode.Fixed;
|
||||
ItemSize = new Size(44, 136);
|
||||
}
|
||||
|
||||
protected override void CreateHandle()
|
||||
{
|
||||
base.CreateHandle();
|
||||
Alignment = TabAlignment.Left;
|
||||
}
|
||||
|
||||
public Pen ToPen(Color color)
|
||||
{
|
||||
return new Pen(color);
|
||||
}
|
||||
|
||||
public Brush ToBrush(Color color)
|
||||
{
|
||||
return new SolidBrush(color);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Bitmap B = new Bitmap(Width, Height);
|
||||
Graphics G = Graphics.FromImage(B);
|
||||
try
|
||||
{
|
||||
SelectedTab.BackColor = Color.FromArgb(15, 15, 15);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
G.Clear(Color.FromArgb(15, 15, 15));
|
||||
G.FillRectangle(new SolidBrush(Color.FromArgb(15, 15, 15)), new Rectangle(0, 0, ItemSize.Height + 4, Height));
|
||||
G.DrawLine(new Pen(Color.FromArgb(10, 10, 10)), new Point(ItemSize.Height + 3, 0), new Point(ItemSize.Height + 3, 999));
|
||||
for (int i = 0; i <= TabCount - 1; i++)
|
||||
{
|
||||
if (i == SelectedIndex)
|
||||
{
|
||||
Rectangle x2 = new Rectangle(new Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), new Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1));
|
||||
ColorBlend myBlend = new ColorBlend();
|
||||
myBlend.Colors = new Color[] {
|
||||
Color.FromArgb(250, 36, 38),
|
||||
Color.FromArgb(250, 36, 38),
|
||||
Color.FromArgb(250, 36, 38)
|
||||
};
|
||||
myBlend.Positions = new float[] {
|
||||
0f,
|
||||
0.5f,
|
||||
1f
|
||||
};
|
||||
LinearGradientBrush lgBrush = new LinearGradientBrush(x2, Color.Black, Color.Black, 90f);
|
||||
lgBrush.InterpolationColors = myBlend;
|
||||
G.FillRectangle(lgBrush, x2);
|
||||
G.DrawRectangle(new Pen(Color.FromArgb(15, 15, 15)), x2);
|
||||
|
||||
G.SmoothingMode = SmoothingMode.HighQuality;
|
||||
Point[] p = {
|
||||
new Point(ItemSize.Height - 3, GetTabRect(i).Location.Y + 20),
|
||||
new Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 14),
|
||||
new Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 27)
|
||||
};
|
||||
|
||||
if (ImageList != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (ImageList.Images[TabPages[i].ImageIndex] != null)
|
||||
{
|
||||
G.DrawImage(ImageList.Images[TabPages[i].ImageIndex], new Point(x2.Location.X + 8, x2.Location.Y + 6));
|
||||
G.DrawString(" " + TabPages[i].Text, Font, Brushes.Black, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString(TabPages[i].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.Black, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
G.DrawString(TabPages[i].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.Black, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString(TabPages[i].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.Black, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
|
||||
G.DrawLine(new Pen(Color.FromArgb(250, 36, 38)), new Point(x2.Location.X - 1, x2.Location.Y - 1), new Point(x2.Location.X, x2.Location.Y));
|
||||
G.DrawLine(new Pen(Color.FromArgb(250, 36, 38)), new Point(x2.Location.X - 1, x2.Bottom - 1), new Point(x2.Location.X, x2.Bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
Rectangle x2 = new Rectangle(new Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), new Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1));
|
||||
G.FillRectangle(new SolidBrush(Color.FromArgb(15, 15, 15)), x2);
|
||||
G.DrawLine(new Pen(Color.FromArgb(15, 15, 15)), new Point(x2.Right, x2.Top), new Point(x2.Right, x2.Bottom));
|
||||
if (ImageList != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ImageList.Images[TabPages[i].ImageIndex] != null)
|
||||
{
|
||||
G.DrawImage(ImageList.Images[TabPages[i].ImageIndex], new Point(x2.Location.X + 8, x2.Location.Y + 6));
|
||||
G.DrawString(" " + TabPages[i].Text, Font, Brushes.DimGray, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString(TabPages[i].Text, Font, Brushes.DimGray, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
G.DrawString(TabPages[i].Text, Font, Brushes.DimGray, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G.DrawString(TabPages[i].Text, Font, Brushes.DimGray, x2, new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center,
|
||||
Alignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
|
||||
G.Dispose();
|
||||
B.Dispose();
|
||||
}
|
||||
|
||||
|
||||
int OldIndex;
|
||||
private int _Speed = 8;
|
||||
public int Speed
|
||||
{
|
||||
get { return _Speed; }
|
||||
set
|
||||
{
|
||||
if (value > 20 | value < -20)
|
||||
{
|
||||
MessageBox.Show("Speed needs to be in between -20 and 20.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_Speed = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DoAnimationScrollLeft(Control Control1, Control Control2)
|
||||
{
|
||||
Graphics G = Control1.CreateGraphics();
|
||||
Bitmap P1 = new Bitmap(Control1.Width, Control1.Height);
|
||||
Bitmap P2 = new Bitmap(Control2.Width, Control2.Height);
|
||||
Control1.DrawToBitmap(P1, new Rectangle(0, 0, Control1.Width, Control1.Height));
|
||||
Control2.DrawToBitmap(P2, new Rectangle(0, 0, Control2.Width, Control2.Height));
|
||||
|
||||
foreach (Control c in Control1.Controls)
|
||||
{
|
||||
c.Hide();
|
||||
}
|
||||
|
||||
int Slide = Control1.Width - (Control1.Width % _Speed);
|
||||
|
||||
int a = 0;
|
||||
for (a = 0; a <= Slide; a += _Speed)
|
||||
{
|
||||
G.DrawImage(P1, new Rectangle(a, 0, Control1.Width, Control1.Height));
|
||||
G.DrawImage(P2, new Rectangle(a - Control2.Width, 0, Control2.Width, Control2.Height));
|
||||
}
|
||||
a = Control1.Width;
|
||||
G.DrawImage(P1, new Rectangle(a, 0, Control1.Width, Control1.Height));
|
||||
G.DrawImage(P2, new Rectangle(a - Control2.Width, 0, Control2.Width, Control2.Height));
|
||||
|
||||
SelectedTab = (TabPage)Control2;
|
||||
|
||||
foreach (Control c in Control2.Controls)
|
||||
{
|
||||
c.Show();
|
||||
}
|
||||
|
||||
foreach (Control c in Control1.Controls)
|
||||
{
|
||||
c.Show();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSelecting(System.Windows.Forms.TabControlCancelEventArgs e)
|
||||
{
|
||||
if (OldIndex < e.TabPageIndex)
|
||||
{
|
||||
DoAnimationScrollRight(TabPages[OldIndex], TabPages[e.TabPageIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoAnimationScrollLeft(TabPages[OldIndex], TabPages[e.TabPageIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDeselecting(System.Windows.Forms.TabControlCancelEventArgs e)
|
||||
{
|
||||
OldIndex = e.TabPageIndex;
|
||||
}
|
||||
|
||||
public void DoAnimationScrollRight(Control Control1, Control Control2)
|
||||
{
|
||||
Graphics G = Control1.CreateGraphics();
|
||||
Bitmap P1 = new Bitmap(Control1.Width, Control1.Height);
|
||||
Bitmap P2 = new Bitmap(Control2.Width, Control2.Height);
|
||||
Control1.DrawToBitmap(P1, new Rectangle(0, 0, Control1.Width, Control1.Height));
|
||||
Control2.DrawToBitmap(P2, new Rectangle(0, 0, Control2.Width, Control2.Height));
|
||||
|
||||
foreach (Control c in Control1.Controls)
|
||||
{
|
||||
c.Hide();
|
||||
}
|
||||
|
||||
int Slide = Control1.Width - (Control1.Width % _Speed);
|
||||
|
||||
int a = 0;
|
||||
for (a = 0; a >= -Slide; a += -_Speed)
|
||||
{
|
||||
G.DrawImage(P1, new Rectangle(a, 0, Control1.Width, Control1.Height));
|
||||
G.DrawImage(P2, new Rectangle(a + Control2.Width, 0, Control2.Width, Control2.Height));
|
||||
}
|
||||
a = Control1.Width;
|
||||
G.DrawImage(P1, new Rectangle(a, 0, Control1.Width, Control1.Height));
|
||||
G.DrawImage(P2, new Rectangle(a + Control2.Width, 0, Control2.Width, Control2.Height));
|
||||
|
||||
SelectedTab = (TabPage)Control2;
|
||||
|
||||
foreach (Control c in Control2.Controls)
|
||||
{
|
||||
c.Show();
|
||||
}
|
||||
|
||||
foreach (Control c in Control1.Controls)
|
||||
{
|
||||
c.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
#region Imports
|
||||
using CBH_Ultimate_Theme_Library.Theme.Helpers;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace CBH.Controls
|
||||
{
|
||||
public class CrEaTiiOn_FlatTabControl : TabControl
|
||||
{
|
||||
#region 变量
|
||||
int enterIndex;
|
||||
bool enterFlag = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 属性
|
||||
|
||||
private Color _themeColor = ThemeColors.PrimaryColor;
|
||||
public Color ThemeColor
|
||||
{
|
||||
get { return _themeColor; }
|
||||
set
|
||||
{
|
||||
_themeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override Rectangle DisplayRectangle
|
||||
{
|
||||
get
|
||||
{
|
||||
Rectangle rect = base.DisplayRectangle;
|
||||
return new Rectangle(rect.Left - 4, rect.Top - 4, rect.Width + 8, rect.Height + 8);
|
||||
}
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
CreateParams cp = base.CreateParams;
|
||||
cp.ExStyle |= 0x02000000;
|
||||
return cp;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
enterFlag = true;
|
||||
for (int i = 0; i < TabCount; i++)
|
||||
{
|
||||
var tempRect = GetTabRect(i);
|
||||
if (tempRect.Contains(e.Location))
|
||||
{
|
||||
enterIndex = i;
|
||||
}
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
enterFlag = false;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
var graphics = e.Graphics;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
graphics.Clear(Parent.BackColor);
|
||||
|
||||
for (int i = 0; i < TabCount; i++)
|
||||
{
|
||||
if (i == SelectedIndex)
|
||||
{
|
||||
graphics.FillRectangle(new SolidBrush(_themeColor), GetTabRect(i).X + 3, ItemSize.Height - 3, ItemSize.Width - 6, 3);
|
||||
graphics.DrawString(TabPages[i].Text.ToUpper(), Font, new SolidBrush(_themeColor), GetTabRect(i), StringAlign.Center);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == enterIndex && enterFlag)
|
||||
{
|
||||
graphics.FillRectangle(new SolidBrush(Color.FromArgb(250, 36, 38)), GetTabRect(i).X + 3, ItemSize.Height - 3, ItemSize.Width - 6, 3);
|
||||
}
|
||||
|
||||
graphics.DrawString(TabPages[i].Text.ToUpper(), Font, new SolidBrush(Color.Black), GetTabRect(i), StringAlign.Center);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CrEaTiiOn_FlatTabControl()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
DoubleBuffered = true;
|
||||
Font = new Font("Segoe UI", 12F);
|
||||
SizeMode = TabSizeMode.Fixed;
|
||||
ItemSize = new Size(120, 40);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
#region Imports
|
||||
using System;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Zeroit.Framework.UIThemes.AdvancedCore
|
||||
{
|
||||
|
||||
public class CrEaTiiOn_MetroTabControl : TabControl
|
||||
{
|
||||
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
|
||||
private static extern IntPtr CreateRoundRectRgn
|
||||
(
|
||||
int nLeftRect, // x-coordinate of upper-left corner
|
||||
int nTopRect, // y-coordinate of upper-left corner
|
||||
int nRightRect, // x-coordinate of lower-right corner
|
||||
int nBottomRect, // y-coordinate of lower-right corner
|
||||
int nWidthEllipse, // width of ellipse
|
||||
int nHeightEllipse // height of ellipse
|
||||
);
|
||||
|
||||
public CrEaTiiOn_MetroTabControl()
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
|
||||
ItemSize = new Size(0, 34);
|
||||
Padding = new Point(24, 0);
|
||||
Font = new Font("Segoe UI", 12);
|
||||
}
|
||||
|
||||
protected override void CreateHandle()
|
||||
{
|
||||
base.CreateHandle();
|
||||
Alignment = TabAlignment.Top;
|
||||
}
|
||||
|
||||
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics G = e.Graphics;
|
||||
|
||||
G.SmoothingMode = SmoothingMode.HighQuality;
|
||||
G.Clear(Parent.BackColor);
|
||||
|
||||
Color FontColor = new Color();
|
||||
|
||||
|
||||
for (int i = 0; i <= TabCount - 1; i++)
|
||||
{
|
||||
Rectangle mainRect = GetTabRect(i);
|
||||
|
||||
if (i == SelectedIndex)
|
||||
{
|
||||
FontColor = Color.White;
|
||||
G.DrawLine(new Pen(Color.FromArgb(250, 36, 38)), new Point(mainRect.X - 2, mainRect.Height - 1), new Point(mainRect.X + mainRect.Width - 2, mainRect.Height - 1));
|
||||
G.DrawLine(new Pen(Color.FromArgb(250, 36, 38)), new Point(mainRect.X - 2, mainRect.Height), new Point(mainRect.X + mainRect.Width - 2, mainRect.Height));
|
||||
}
|
||||
else
|
||||
{
|
||||
FontColor = Color.White;
|
||||
G.DrawLine(new Pen(Color.FromArgb(250, 36, 38)), new Point(mainRect.X - 2, mainRect.Height - 1), new Point(mainRect.X + mainRect.Width - 2, mainRect.Height - 1));
|
||||
G.DrawLine(new Pen(Color.FromArgb(250, 36, 38)), new Point(mainRect.X - 2, mainRect.Height), new Point(mainRect.X + mainRect.Width - 2, mainRect.Height));
|
||||
}
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
G.DrawLine(new Pen(Color.FromArgb(250, 36, 38)), new Point(mainRect.X - 4, mainRect.Height - 7), new Point(mainRect.X + 4, mainRect.Y + 6));
|
||||
}
|
||||
|
||||
int titleX = (mainRect.Location.X + mainRect.Width / 2) - Convert.ToInt32((G.MeasureString(TabPages[i].Text, Font).Width / 2));
|
||||
int titleY = (mainRect.Location.Y + mainRect.Height / 2) - Convert.ToInt32((G.MeasureString(TabPages[i].Text, Font).Height / 2));
|
||||
G.DrawString(TabPages[i].Text, Font, new SolidBrush(FontColor), new Point(titleX, titleY));
|
||||
|
||||
try
|
||||
{
|
||||
TabPages[i].BackColor = Parent.BackColor;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 10, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user