-
Автор темы
- #1
Сидел я тут на просторах интернета, смотрел хентай скины на WindowsForms C# (c++ для лохов ) и набрел на данный скин, подходит под C# WinForms и VB.Net. Прошу вас, уважаемые пастеры! Делайте лоадеры хотя бы красивыми, а то они и так крякаются за 1.337 секунд, так еще и вырвиглазные! Ниже будет гайд для пастеров низшей пробы, которые так и не смогли установить стиль
Код:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
#endregion
#region Helper Methods
public class HelperMethods
{
public GraphicsPath GP = null;
public enum MouseMode
{
NormalMode,
Hovered,
Pushed
};
public void DrawImageFromBase64(Graphics G, string Base64Image, Rectangle Rect)
{
Image IM = null;
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(Convert.FromBase64String(Base64Image)))
{
IM = System.Drawing.Image.FromStream(ms);
}
G.DrawImage(IM, Rect);
}
public GraphicsPath RoundRec(Rectangle r, int Curve, bool TopLeft = true, bool TopRight = true, bool BottomLeft = true, bool BottomRight = true)
{
GraphicsPath CreateRoundPath = new GraphicsPath(FillMode.Winding);
if (TopLeft)
{
CreateRoundPath.AddArc(r.X, r.Y, Curve, Curve, 180f, 90f);
}
else
{
CreateRoundPath.AddLine(r.X, r.Y, r.X, r.Y);
}
if (TopRight)
{
CreateRoundPath.AddArc(r.Right - Curve, r.Y, Curve, Curve, 270f, 90f);
}
else
{
CreateRoundPath.AddLine(r.Right - r.Width, r.Y, r.Width, r.Y);
}
if (BottomRight)
{
CreateRoundPath.AddArc(r.Right - Curve, r.Bottom - Curve, Curve, Curve, 0f, 90f);
}
else
{
CreateRoundPath.AddLine(r.Right, r.Bottom, r.Right, r.Bottom);
}
if (BottomLeft)
{
CreateRoundPath.AddArc(r.X, r.Bottom - Curve, Curve, Curve, 90f, 90f);
}
else
{
CreateRoundPath.AddLine(r.X, r.Bottom, r.X, r.Bottom);
}
CreateRoundPath.CloseFigure();
return CreateRoundPath;
}
public void FillRoundedPath(Graphics G, Color C, Rectangle Rect, int Curve)
{
G.FillPath(new SolidBrush(C), RoundRec(Rect, Curve));
}
public void FillRoundedPath(Graphics G, Brush B, Rectangle Rect, int Curve)
{
G.FillPath(B, RoundRec(Rect, Curve));
}
public void DrawRoundedPath(Graphics G, Color C, Single Size, Rectangle Rect, int Curve)
{
G.DrawPath(new Pen(C, Size), RoundRec(Rect, Curve));
}
public void DrawTriangle(Graphics G, Color C, Single Size, Point P1_0, Point P1_1, Point P2_0, Point P2_1, Point P3_0, Point P3_1)
{
G.DrawLine(new Pen(C, Size), P1_0, P1_1);
G.DrawLine(new Pen(C, Size), P2_0, P2_1);
G.DrawLine(new Pen(C, Size), P3_0, P3_1);
}
public Pen PenRGBColor(int R, int G, int B, Single size)
{ return new Pen(System.Drawing.Color.FromArgb(R, G, B), size); }
public Pen PenHTMlColor(String C_WithoutHash, float Thick)
{ return new Pen(GetHTMLColor(C_WithoutHash), Thick); }
public SolidBrush SolidBrushRGBColor(int R, int G, int B, int A = 0)
{ return new SolidBrush(System.Drawing.Color.FromArgb(A, R, G, B)); }
public SolidBrush SolidBrushHTMlColor(String C_WithoutHash)
{ return new SolidBrush(GetHTMLColor(C_WithoutHash)); }
public Color GetHTMLColor(String C_WithoutHash)
{ return ColorTranslator.FromHtml("#" + C_WithoutHash); }
public String ColorToHTML(Color C)
{ return ColorTranslator.ToHtml(C); }
public Color SetARGB(int A, int R, int G, int B)
{ return System.Drawing.Color.FromArgb(A, R, G, B); }
public Color SetRGB(int R, int G, int B)
{ return System.Drawing.Color.FromArgb(R, G, B); }
public void CentreString(Graphics G, String Text, Font font, Brush brush, Rectangle Rect)
{ G.DrawString(Text, font, brush, new Rectangle(0, Rect.Y + Convert.ToInt32(Rect.Height / 2) - Convert.ToInt32(G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), new StringFormat() { Alignment = StringAlignment.Center }); }
public void LeftString(Graphics G, String Text, Font font, Brush brush, Rectangle Rect)
{
G.DrawString(Text, font, brush, new Rectangle(4, Rect.Y + Convert.ToInt32(Rect.Height / 2) - Convert.ToInt32(G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), new StringFormat { Alignment = StringAlignment.Near });
}
public void RightString(Graphics G, string Text, Font font, Brush brush, Rectangle Rect)
{
G.DrawString(Text, font, brush, new Rectangle(4, Convert.ToInt32(Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2)), Rect.Width - Rect.Height + 10, Rect.Height), new StringFormat { Alignment = StringAlignment.Far });
}
}
#endregion
#region Form
public class AcaciaSkin : ContainerControl
{
#region Variables
bool Movable = false;
private TitlePostion _TitleTextPostion = TitlePostion.Left;
private Point MousePoint = new Point(0, 0);
private int MoveHeight = 50;
private static HelperMethods H = new HelperMethods();
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.Clear(Color.Fuchsia);
G.FillRectangle(H.SolidBrushHTMlColor("24273e"), new Rectangle(0, 0, Width, Height));
G.FillRectangle(H.SolidBrushHTMlColor("1e2137"), new Rectangle(0, 0, Width, 55));
G.DrawLine(H.PenHTMlColor("1d1f38", 1), new Point(0, 55), new Point(Width, 55));
G.DrawRectangle(H.PenHTMlColor("1d1f38", 1), new Rectangle(0, 0, Width - 1, Height - 1));
if (FindForm().ShowIcon)
{
if (FindForm().Icon != null)
{
switch (TitleTextPostion)
{
case TitlePostion.Left:
G.DrawString(Text, Font, H.SolidBrushHTMlColor("e4ecf2"), 27, 16);
G.DrawIcon(FindForm().Icon, new Rectangle(5, 16, 20, 20));
break;
case TitlePostion.Center:
H.CentreString(G, Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(0, 0, Width, 50));
G.DrawIcon(FindForm().Icon, new Rectangle(5, 16, 20, 20));
break;
case TitlePostion.Right:
H.RightString(G, Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(0, 0, Width, 50));
G.DrawIcon(FindForm().Icon, new Rectangle(Width - 30, 17, 20, 20));
break;
}
}
}
else
{
switch (TitleTextPostion)
{
case TitlePostion.Left:
G.DrawString(Text, Font, H.SolidBrushHTMlColor("e4ecf2"), 5, 16);
break;
case TitlePostion.Center:
H.CentreString(G, Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(0, 0, Width, 50));
break;
case TitlePostion.Right:
H.RightString(G, Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(0, 0, Width, 50));
break;
}
}
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Initialization
public AcaciaSkin()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.ContainerControl, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Font = new Font("Arial", 12, FontStyle.Bold);
UpdateStyles();
}
#endregion
#region Properties
private bool _ShowIcon = false;
public bool ShowIcon
{
get { return _ShowIcon; }
set
{
if (value == _ShowIcon) { return; }
FindForm().ShowIcon = value;
Invalidate();
_ShowIcon = value;
}
}
public TitlePostion TitleTextPostion
{
get { return _TitleTextPostion; }
set
{
_TitleTextPostion = value;
Invalidate();
}
}
public enum TitlePostion
{
Left,
Center,
Right
};
#endregion
#region Events
protected override void OnCreateControl()
{
base.OnCreateControl();
ParentForm.FormBorderStyle = FormBorderStyle.None;
ParentForm.Dock = DockStyle.None;
Dock = DockStyle.Fill;
Invalidate();
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
int x = MousePosition.X;
int y = MousePosition.Y;
int x1 = MousePoint.X;
int y1 = MousePoint.Y;
if (Movable)
Parent.Location = new Point(x - x1, y - y1);
Focus();
}
protected override void OnMouseDown(MouseEventArgs e)
{
try
{
base.OnMouseDown(e);
if (e.Button == System.Windows.Forms.MouseButtons.Left && new Rectangle(0, 0, Width, MoveHeight).Contains(e.Location))
{
Movable = true;
MousePoint = e.Location;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
MessageBox.Show(ex.StackTrace);
}
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
Movable = false;
}
#endregion
}
#endregion
#region Button
public class AcaciaButton : Control
{
#region Variables
private HelperMethods.MouseMode State;
private Image _SideImage;
private SideAligin _SideImageAlign = SideAligin.Left;
private static HelperMethods H = new HelperMethods();
private int _RoundRadius = 10;
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.SmoothingMode = SmoothingMode.AntiAlias;
G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
Rectangle R = new Rectangle(2, 2, Width - 5, Height - 5);
switch(State)
{
case HelperMethods.MouseMode.NormalMode:
using(PathGradientBrush HB = new PathGradientBrush(H.RoundRec(new Rectangle(0, 0, Width, Height), 2)))
{
H.FillRoundedPath(G, H.SolidBrushHTMlColor("fc3955"), R, 2);
HB.WrapMode = WrapMode.Clamp;
ColorBlend CB=new ColorBlend(4);
CB.Colors = new Color[] {Color.FromArgb(220, H.GetHTMLColor("fc3955")), Color.FromArgb(220, H.GetHTMLColor("fc3955")), Color.FromArgb(220, H.GetHTMLColor("fc3955")), Color.FromArgb(220, H.GetHTMLColor("fc3955"))};
CB.Positions = new Single[] {0.0F, 0.2F, 0.8F, 1.0F};
HB.InterpolationColors = CB;
H.FillRoundedPath(G, HB, new Rectangle(0, 0, Width - 1, Height - 1), 2);
}
break;
case HelperMethods.MouseMode.Hovered:
using (PathGradientBrush HB = new PathGradientBrush(H.RoundRec(new Rectangle(0, 0, Width, Height), 2)))
{
H.FillRoundedPath(G,new SolidBrush(Color.FromArgb(150, H.GetHTMLColor("fc3955"))), R, 2);
HB.WrapMode = WrapMode.Clamp;
ColorBlend CB = new ColorBlend(4);
CB.Colors = new Color[] { Color.FromArgb(150, H.GetHTMLColor("fc3955")), Color.FromArgb(150, H.GetHTMLColor("fc3955")), Color.FromArgb(150, H.GetHTMLColor("fc3955")), Color.FromArgb(150, H.GetHTMLColor("fc3955")) };
CB.Positions = new Single[] { 0.0F, 0.2F, 0.8F, 1.0F };
HB.InterpolationColors = CB;
H.FillRoundedPath(G, HB, new Rectangle(0, 0, Width - 1, Height - 1), 2);
}
break;
case HelperMethods.MouseMode.Pushed:
using (PathGradientBrush HB = new PathGradientBrush(H.RoundRec(new Rectangle(0, 0, Width, Height), 2)))
{
H.FillRoundedPath(G, H.SolidBrushHTMlColor("fc3955"), R, 2);
HB.WrapMode = WrapMode.Clamp;
ColorBlend CB = new ColorBlend(4);
CB.Colors = new Color[] { Color.FromArgb(220, H.GetHTMLColor("fc3955")), Color.FromArgb(220, H.GetHTMLColor("fc3955")), Color.FromArgb(220, H.GetHTMLColor("fc3955")), Color.FromArgb(220, H.GetHTMLColor("fc3955")) };
CB.Positions = new Single[] { 0.0F, 0.2F, 0.8F, 1.0F };
HB.InterpolationColors = CB;
H.FillRoundedPath(G, HB, new Rectangle(0, 0, Width - 1, Height - 1), 2);
}
break;
}
if (SideImage !=null)
{
if (SideImageAlign == SideAligin.Right)
{
G.DrawImage(SideImage, new Rectangle(R.Width - 24, R.Y + 7, 16, 16));
}
else
{
G.DrawImage(SideImage, new Rectangle(8, R.Y + 7, 16, 16));
}
}
H.CentreString(G, Text, Font, H.SolidBrushHTMlColor("e4ecf2"), R);
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Properties
public Image SideImage
{
get
{
return _SideImage;
}
set
{
_SideImage = value;
Invalidate();
}
}
[Browsable(true)]
public SideAligin SideImageAlign
{
get
{
return _SideImageAlign;
}
set
{
_SideImageAlign = value;
Invalidate();
}
}
public int RoundRadius
{
get
{
return _RoundRadius;
}
set
{
_RoundRadius = value;
Invalidate();
}
}
#endregion
#region Initialization
public AcaciaButton()
{
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
ControlStyles.Selectable | ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Font = new Font("Myriad Pro", 12, FontStyle.Bold);
UpdateStyles();
}
#endregion
#region Mouse Events
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
State = HelperMethods.MouseMode.Hovered;
Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
State = HelperMethods.MouseMode.Hovered;
Invalidate();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
State = HelperMethods.MouseMode.Pushed;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
State = HelperMethods.MouseMode.NormalMode;
Invalidate();
}
#endregion
#region Enumerators
public enum SideAligin
{
Left,
Right
};
#endregion
}
#endregion
#region Textbox
[DefaultEvent("TextChanged")]public class AcaciaTextbox : Control
{
#region Variables
private TextBox T = new TextBox();
private HorizontalAlignment _TextAlign = HorizontalAlignment.Left;
private int _MaxLength = 32767;
private bool _ReadOnly;
private bool _UseSystemPasswordChar = false;
private string _WatermarkText = "";
private Image _SideImage;
private bool _Multiline = false;
protected HelperMethods.MouseMode State = HelperMethods.MouseMode.NormalMode;
private static HelperMethods H = new HelperMethods();
private static Color TBC = H.GetHTMLColor("24273e");
private static Color TFC = H.GetHTMLColor("585c73");
private SideAligin _SideImageAlign = SideAligin.Left;
private Color _BackColor = TBC;
#endregion
#region Native Methods
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
string lParam);
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.SmoothingMode = SmoothingMode.HighQuality;
G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
Rectangle Rect = new Rectangle(0, 0, Width - 1, Height - 1);
Height = 30;
switch (State)
{
case HelperMethods.MouseMode.NormalMode:
G.DrawLine(H.PenHTMlColor("585c73", 1), new Point(0, 29), new Point(Width, 29));
break;
case HelperMethods.MouseMode.Hovered:
G.DrawLine(H.PenHTMlColor("fc3955", 1), new Point(0, 29), new Point(Width, 29));
break;
case HelperMethods.MouseMode.Pushed:
G.DrawLine(new Pen(Color.FromArgb(150, H.GetHTMLColor("fc3955")), 1), new Point(0, 29), new Point(Width, 29));
break;
}
if (SideImage != null)
{
T.Location = new Point(33, Convert.ToInt32(4.5));
T.Width = Width - 60;
G.InterpolationMode = InterpolationMode.HighQualityBicubic;
G.DrawImage(SideImage, new Rectangle(8, 6, 16, 16));
}
else
{
T.Location = new Point(7, Convert.ToInt32(4.5));
T.Width = Width - 10;
}
if (ContextMenuStrip != null) { T.ContextMenuStrip = ContextMenuStrip; }
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Initialization
public AcaciaTextbox()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
UpdateStyles();
Font = new Font("Arial", 11, FontStyle.Regular);
Size = new Size(135, 30);
T.Multiline = _Multiline;
T.Cursor = Cursors.IBeam;
T.BackColor = TBC;
T.ForeColor = TFC;
T.BorderStyle = BorderStyle.None;
T.Location = new Point(7, 7);
T.Font = Font;
T.Size = new Size(Width - 10, 30);
T.UseSystemPasswordChar = _UseSystemPasswordChar;
T.TextChanged += T_TextChanged;
T.MouseDown += T_MouseDown;
T.MouseEnter += T_MouseEnter;
T.MouseUp += T_MouseUp;
T.MouseLeave += T_MouseLeave;
T.MouseHover += T_MouseHover;
T.KeyDown += T_KeyDown;
}
#endregion
#region Properties
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public BorderStyle BorderStyle
{
get
{
return BorderStyle.None;
}
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool Multiline
{
get
{
return _Multiline;
}
set
{
_Multiline = value;
if (T != null)
{
T.Multiline = value;
}
}
}
public HorizontalAlignment TextAlign
{
get
{
return _TextAlign;
}
set
{
_TextAlign = value;
if (T != null)
{
T.TextAlign = value;
}
}
}
public int MaxLength
{
get
{
return _MaxLength;
}
set
{
_MaxLength = value;
if (T != null)
{
T.MaxLength = value;
}
}
}
public bool ReadOnly
{
get
{
return _ReadOnly;
}
set
{
_ReadOnly = value;
if (T != null)
{
T.ReadOnly = value;
}
}
}
public bool UseSystemPasswordChar
{
get
{
return _UseSystemPasswordChar;
}
set
{
_UseSystemPasswordChar = value;
if (T != null)
{
T.UseSystemPasswordChar = value;
}
}
}
public string WatermarkText
{
get
{
return _WatermarkText;
}
set
{
_WatermarkText = value;
SendMessage(T.Handle, 0x1501, 0, value);
Invalidate();
}
}
public Image SideImage
{
get
{
return _SideImage;
}
set
{
_SideImage = value;
Invalidate();
}
}
[Browsable(false)]
public override Image BackgroundImage
{
get
{
return base.BackgroundImage;
}
set
{
base.BackgroundImage = value;
}
}
[Browsable(false)]
public override ImageLayout BackgroundImageLayout
{
get
{
return base.BackgroundImageLayout;
}
set
{
base.BackgroundImageLayout = value;
}
}
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
public enum SideAligin
{
Left,
Right
}
public SideAligin SideImageAlign
{
get
{
return _SideImageAlign;
}
set
{
_SideImageAlign = value;
Invalidate();
}
}
override public Color BackColor
{
get { return _BackColor; }
set
{
base.BackColor = value;
_BackColor = value;
T.BackColor = value;
Invalidate();
}
}
#endregion
#region Events
private void T_MouseHover(object sender, EventArgs e)
{
State = HelperMethods.MouseMode.Hovered;
Invalidate();
}
private void T_MouseLeave(object sender, EventArgs e)
{
State = HelperMethods.MouseMode.NormalMode;
Invalidate();
}
private void T_MouseUp(object sender, EventArgs e)
{
State = HelperMethods.MouseMode.Pushed;
Invalidate();
}
private void T_MouseEnter(object sender, EventArgs e)
{
State = HelperMethods.MouseMode.Pushed;
Invalidate();
}
private void T_MouseDown(object sender, EventArgs e)
{
State = HelperMethods.MouseMode.Pushed;
Invalidate();
}
private void T_TextChanged(object sender, EventArgs e)
{
Text = T.Text;
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
T.Text = Text;
}
private void T_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.A) { e.SuppressKeyPress = true; }
if (e.Control && e.KeyCode == Keys.C)
{
T.Copy();
e.SuppressKeyPress = true;
}
}
protected override void OnCreateControl()
{
base.OnCreateControl();
if (!Controls.Contains(T))
Controls.Add(T);
if (T.Text == "" && WatermarkText != "")
T.Text = WatermarkText;
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
if (_Multiline == false)
Height = 30;
}
#endregion
}
#endregion
#region Panel
public class AcaciaPanel : ContainerControl
{
#region Variables
private static HelperMethods H = new HelperMethods();
#endregion
#region Initialization
public AcaciaPanel()
{
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
UpdateStyles();
}
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
Rectangle Rect = new Rectangle(0,0,Width-1,Height-1);
G.FillRectangle(H.SolidBrushHTMlColor("24273e"), Rect);
G.DrawRectangle(H.PenHTMlColor("1d1f38", 1), Rect);
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Events
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Invalidate();
}
protected override void OnCreateControl()
{
base.OnCreateControl();
Invalidate();
}
#endregion
}
#endregion
#region CheckBox
[DefaultEvent("CheckedChanged")]public class AcaciaCheckBox : Control
{
#region Variables
protected bool _Checked;
protected HelperMethods.MouseMode State = HelperMethods.MouseMode.NormalMode;
public event CheckedChangedEventHandler CheckedChanged;
public delegate void CheckedChangedEventHandler(object sender);
private static HelperMethods H = new HelperMethods();
#endregion
#region Properties
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
Invalidate();
}
public bool Checked
{
get
{
return _Checked;
}
set
{
_Checked = value;
Invalidate();
}
}
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.SmoothingMode = SmoothingMode.AntiAlias;
G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
if(Checked)
{
H.DrawRoundedPath(G, H.GetHTMLColor("fc3955"),Convert.ToSingle(2.5), new Rectangle(1, 1, 17, 17), 1);
H.FillRoundedPath(G, H.SolidBrushHTMlColor("fc3955"), new Rectangle(5, 5, 9, 9), 1);
G.DrawString(Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(22, Convert.ToInt32(1.6), Width, Height - 2), new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
}
else
{
switch(State)
{
case HelperMethods.MouseMode.NormalMode:
H.DrawRoundedPath(G, Color.FromArgb(150, H.GetHTMLColor("fc3955")), Convert.ToSingle(2.5), new Rectangle(1, 1, 17, 17), 1);
G.DrawString(Text, Font, new SolidBrush(Color.Silver), new Rectangle(22,Convert.ToInt32(1.6), Width, Height - 2), new StringFormat {Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center});
break;
case HelperMethods.MouseMode.Hovered:
H.DrawRoundedPath(G, H.GetHTMLColor("fc3955"), Convert.ToSingle(2.5), new Rectangle(1, 1, 17, 17), 1);
H.FillRoundedPath(G, H.SolidBrushHTMlColor("fc3955"), new Rectangle(5, 5, 9, 9), 1);
G.DrawString(Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(22, Convert.ToInt32(1.6), Width, Height - 2), new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
break;
}
}
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Initialization
public AcaciaCheckBox()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Font = new Font("Arial", 11, FontStyle.Regular);
Cursor = Cursors.Hand;
UpdateStyles();
}
#endregion
#region Events
protected override void OnMouseHover(EventArgs e)
{
base.OnMouseHover(e);
State = HelperMethods.MouseMode.Hovered;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
State = HelperMethods.MouseMode.NormalMode;
Invalidate();
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Height = 20;
Invalidate();
}
protected override void OnCreateControl()
{
base.OnCreateControl();
}
protected override void OnClick(EventArgs e)
{
_Checked = !_Checked;
if (CheckedChanged != null)
{
CheckedChanged(this);
}
base.OnClick(e);
Invalidate();
}
#endregion
}
#endregion
#region RadioButton
[DefaultEvent("CheckedChanged")]public class AcaciaRadioButton : Control
{
#region Variables
protected bool _Checked;
protected HelperMethods.MouseMode State = HelperMethods.MouseMode.NormalMode;
protected static int _Group = 1;
public event CheckedChangedEventHandler CheckedChanged;
public delegate void CheckedChangedEventHandler(object sender);
private static HelperMethods H = new HelperMethods();
#endregion
#region Properties
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
Invalidate();
}
public bool Checked
{
get
{
return _Checked;
}
set
{
_Checked = value;
UpdateCheckState();
Invalidate();
}
}
public int Group
{
get
{
return _Group;
}
set
{
_Group = value;
}
}
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.SmoothingMode = SmoothingMode.AntiAlias;
G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
if(Checked)
{
G.DrawEllipse(H.PenHTMlColor("fc3955", Convert.ToInt32(2.8)), new Rectangle(1, 1, 18, 18));
G.FillEllipse(H.SolidBrushHTMlColor("fc3955"), new Rectangle(5, 5, 10, 10));
G.DrawString(Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(22, Convert.ToInt32(1.6), Width, Height - 2), new StringFormat {Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center});
}
else
{
switch(State)
{
case HelperMethods.MouseMode.NormalMode:
G.DrawEllipse(new Pen(Color.FromArgb(150, H.GetHTMLColor("fc3955")), Convert.ToInt32(2.8)), new Rectangle(1, 1, 18, 18));
G.DrawString(Text, Font, new SolidBrush(Color.Silver), new Rectangle(22, Convert.ToInt32(1.6), Width, Height - 2), new StringFormat {Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center});
break;
case HelperMethods.MouseMode.Hovered:
G.DrawEllipse(H.PenHTMlColor("fc3955",Convert.ToInt32(2.8)), new Rectangle(1, 1, 18, 18));
G.FillEllipse(H.SolidBrushHTMlColor("fc3955"), new Rectangle(5, 5, 10, 10));
G.DrawString(Text, Font, H.SolidBrushHTMlColor("e4ecf2"), new Rectangle(22, Convert.ToInt32(1.6), Width, Height - 2), new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
break;
}
}
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Initialization
public AcaciaRadioButton()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
Cursor = Cursors.Hand;
BackColor = Color.Transparent;
Font = new Font("Arial", 11, FontStyle.Regular);
UpdateStyles();
}
#endregion
#region Events
private void UpdateCheckState()
{
if (!IsHandleCreated || !_Checked)
return;
foreach (Control C in Parent.Controls)
{
if (!object.ReferenceEquals(C, this) && C is AcaciaRadioButton && ((AcaciaRadioButton)C).Group == _Group)
{
((AcaciaRadioButton)C).Checked = false;
}
}
if (CheckedChanged != null)
{
CheckedChanged(this);
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (!_Checked)
Checked = true;
base.OnMouseDown(e);
}
protected override void OnMouseHover(EventArgs e)
{
base.OnMouseHover(e);
State = HelperMethods.MouseMode.Hovered;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
State = HelperMethods.MouseMode.NormalMode;
Invalidate();
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Height = 21;
Invalidate();
}
protected override void OnCreateControl()
{
base.OnCreateControl();
UpdateCheckState();
}
#endregion
}
#endregion
#region ControlButton
public class AcaciaControlButton : Control
{
#region Variables
private HelperMethods.MouseMode State;
private Style _ControlStyle = Style.Close;
private static HelperMethods H = new HelperMethods();
#endregion
#region Enumenators
public enum Style
{
Close,
Minimize,
Maximize
}
#endregion
#region Constructors
public AcaciaControlButton()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
UpdateStyles();
Anchor = AnchorStyles.Top | AnchorStyles.Right;
Size = new Size(18, 18);
}
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.SmoothingMode = SmoothingMode.HighQuality;
switch(State)
{
case HelperMethods.MouseMode.NormalMode:
G.DrawEllipse(new Pen(Color.FromArgb(150, H.GetHTMLColor("fc3955")), 2), new Rectangle(1, 1, 15, 15));
G.FillEllipse(new SolidBrush(Color.FromArgb(150, H.GetHTMLColor("fc3955"))), new Rectangle(5, 5, 7, 7));
break;
case HelperMethods.MouseMode.Hovered:
Cursor = Cursors.Hand;
G.DrawEllipse(H.PenHTMlColor("fc3955", 2), new Rectangle(1, 1, 15, 15));
G.FillEllipse(H.SolidBrushHTMlColor("fc3955"), new Rectangle(5, 5, 7, 7));
break;
case HelperMethods.MouseMode.Pushed:
G.DrawEllipse(H.PenHTMlColor("24273e", 2), new Rectangle(1, 1, 15, 15));
G.FillEllipse(H.SolidBrushHTMlColor("24273e"), new Rectangle(5, 5, 7, 7));
break;
}
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Properties
public Style ControlStyle
{
get
{
return _ControlStyle;
}
set
{
_ControlStyle = value;
Invalidate();
}
}
#endregion
#region Events
protected override void OnClick(EventArgs e)
{
base.OnClick(e);
if (ControlStyle == Style.Close)
{
Environment.Exit(0);
Application.Exit();
}
else if(ControlStyle == Style.Minimize)
{
if (FindForm().WindowState == FormWindowState.Normal)
{
FindForm().WindowState = FormWindowState.Minimized;
}
}
else if (ControlStyle == Style.Maximize)
{
if (FindForm().WindowState == FormWindowState.Normal)
{
FindForm().WindowState = FormWindowState.Maximized;
}
else if (FindForm().WindowState == FormWindowState.Maximized)
{
FindForm().WindowState = FormWindowState.Normal;
}
}
}
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
State = HelperMethods.MouseMode.Hovered;
Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
State = HelperMethods.MouseMode.Hovered;
Invalidate();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
State = HelperMethods.MouseMode.Pushed;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
State = HelperMethods.MouseMode.NormalMode;
Invalidate();
}
#endregion
}
#endregion
#region Trackbar
[DefaultEvent("Scroll")]public class AcaciaTrackBar : Control
{
#region Variables
private int _Maximum = 100;
private int _Minimum;
private int _Value;
private int CurrentValue;
bool Variable;
Rectangle Track, TrackSide;
private static HelperMethods H = new HelperMethods();
#endregion
#region properties
public int Minimum
{
get
{
return _Minimum;
}
set
{
if (!(value < 0))
{
_Minimum = value;
RenewCurrentValue();
MoveTrack();
Invalidate();
}
}
}
public int Maximum
{
get
{
return _Maximum;
}
set
{
_Maximum = value;
RenewCurrentValue();
MoveTrack();
Invalidate();
}
}
public int Value
{
get
{
return _Value;
}
set
{
if (value != _Value)
{
_Value = value;
RenewCurrentValue();
MoveTrack();
Invalidate();
if (Scroll != null)
Scroll(this);
}
}
}
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
Cursor = Cursors.Hand;
G.SmoothingMode = SmoothingMode.HighQuality;
H.FillRoundedPath(G, H.SolidBrushHTMlColor("1e2137"), new Rectangle(0, Convert.ToInt32(5.5), Width, 8), 8);
if (CurrentValue != 0)
{
H.FillRoundedPath(G, H.GetHTMLColor("fc3955"), new Rectangle(0, Convert.ToInt32(5.5), CurrentValue + 4, 8), 6);
}
G.FillEllipse(H.SolidBrushHTMlColor("fc3955"), Track);
G.FillEllipse(H.SolidBrushHTMlColor("1e2137"), TrackSide);
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Initialization
public AcaciaTrackBar()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
UpdateStyles();
CurrentValue = Convert.ToInt32((Math.Round(Convert.ToDouble(Value / Maximum - 2) * Convert.ToDouble(Width))));
}
#endregion
#region Events
public event ScrollEventHandler Scroll;
public delegate void ScrollEventHandler(object sender);
protected override void OnMouseMove(MouseEventArgs e)
{
if (Variable && e.X > -1 && e.X < Width + 1)
{
Value = Minimum + (int)Math.Round((double)(Maximum - Minimum) * (double)e.X / Width);
}
base.OnMouseMove(e);
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && Height > 0)
{
RenewCurrentValue();
if (Width > 0 && Height > 0) Track = new Rectangle(Convert.ToInt32(CurrentValue + 0.8), 0, 25, 24);
Variable = new Rectangle(CurrentValue, 0, 24, Height).Contains(e.Location);
}
base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
Variable = false;
base.OnMouseUp(e);
}
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Subtract || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left)
{
if (Value != 0)
{
Value -= 1;
}
}
else if (e.KeyCode == Keys.Add || e.KeyCode == Keys.Up || e.KeyCode == Keys.Right)
{
if (Value != Maximum)
{
Value += 1;
}
}
base.OnKeyDown(e);
}
protected override void OnResize(EventArgs e)
{
if (Width > 0 && Height > 0)
{
RenewCurrentValue();
MoveTrack();
}
Height = 23;
Invalidate();
base.OnResize(e);
}
private void MoveTrack()
{
if (Height > 0 && Width > 0) { Track = new Rectangle(CurrentValue + 1, 0, 21, 20); }
TrackSide = new Rectangle(CurrentValue + Convert.ToInt32(8.5), 7, 6, 6);
}
public void RenewCurrentValue()
{
CurrentValue = Convert.ToInt32(Math.Round((double)(Value - Minimum) / (double)(Maximum - Minimum) * (double)(Width - 23.5)));
}
#endregion
}
#endregion
#region Progress
public class AcaciaProgressBar : Control
{
#region Variables
private int _Maximum = 100;
private int _Value;
protected int CurrentValue;
private static HelperMethods H = new HelperMethods();
#endregion
#region Properties
public int Value
{
get
{
if (_Value < 0)
{
return 0;
}
else
{
return _Value;
}
}
set
{
if (value > Maximum)
{
_Value = Maximum;
}
_Value = value;
RenewCurrentValue();
Invalidate();
if (ValueChanged != null)
ValueChanged(this);
Invalidate();
}
}
public int Maximum
{
get
{
return _Maximum;
}
set
{
if (_Maximum < value)
{
_Value = value;
}
_Maximum = value;
Invalidate();
}
}
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Rectangle Rect = new Rectangle(0, 0, Width - 1, Height - 1);
H.FillRoundedPath(G, H.GetHTMLColor("1e2137"), Rect, 1);
if (CurrentValue != 0)
{
H.FillRoundedPath(G, H.GetHTMLColor("fc3955"), new Rectangle(Rect.X, Rect.Y, CurrentValue, Rect.Height), 1);
}
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Initialization
public AcaciaProgressBar()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw |
ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
UpdateStyles();
CurrentValue = Convert.ToInt32(_Value / _Maximum * Width);
}
#endregion
#region Events
public event ValueChangedEventHandler ValueChanged;
public delegate void ValueChangedEventHandler(object sender);
public void RenewCurrentValue()
{
CurrentValue = (int)Math.Round((double)(Value) / (double)(Maximum) * (double)(Width));
}
#endregion
}
#endregion
#region ComboBox
public class AcaciaComboBox : ComboBox
{
#region Variables
private int _StartIndex = 0;
private static HelperMethods H = new HelperMethods();
#endregion
#region Initialization
public AcaciaComboBox()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
DoubleBuffered = true;
BackColor = Color.Transparent;
StartIndex = 0;
Font = new Font("Arial", 12);
DropDownStyle = ComboBoxStyle.DropDownList;
UpdateStyles();
}
#endregion
#region Properties
public int StartIndex
{
get
{
return _StartIndex;
}
set
{
_StartIndex = value;
try
{
base.SelectedIndex = value;
}
catch
{
}
Invalidate();
}
}
#endregion
#region Draw Control
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
Rectangle Rect = new Rectangle(1, 1, Width - Convert.ToInt32(2.5), Height - Convert.ToInt32(2.5));
G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
H.DrawRoundedPath(G, H.GetHTMLColor("585c73"), (int)(1.7), Rect, 1);
G.SmoothingMode = SmoothingMode.AntiAlias;
H.DrawTriangle(G, H.GetHTMLColor("fc3955"), Convert.ToInt32(1.5),
new Point(Width - 20, 12), new Point(Width - 16, 16),
new Point(Width - 16, 16), new Point(Width - 12, 12),
new Point(Width - 16, 17), new Point(Width - 16, 16)
);
G.SmoothingMode = SmoothingMode.None;
G.DrawString(Text, Font, new SolidBrush(H.GetHTMLColor("585c73")), new Rectangle(7, 1, Width - 1, Height - 1), new StringFormat {LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Near});
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
protected override void OnDrawItem(DrawItemEventArgs e)
{
try
{
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
if (System.Convert.ToInt32((e.State & DrawItemState.Selected)) == (int)DrawItemState.Selected)
{
if (!(e.Index == -1))
{
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(120, H.GetHTMLColor("fc3955"))), e.Bounds);
e.Graphics.DrawString(GetItemText(Items[e.Index]), Font, H.SolidBrushHTMlColor("585c73"), e.Bounds);
}
}
else
{
if (!(e.Index == -1))
{
e.Graphics.FillRectangle(Brushes.WhiteSmoke, e.Bounds);
e.Graphics.DrawString(GetItemText(Items[e.Index]), Font, H.SolidBrushHTMlColor("585c73"), e.Bounds);
}
}
}
catch
{
}
Invalidate();
}
#endregion
#region Events
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
}
protected override void OnCreateControl()
{
base.OnCreateControl();
}
#endregion
}
#endregion
#region Seperator
public class AcaciaSeperator : Control
{
#region Variables
private Style _SepStyle = Style.Horizental;
private static HelperMethods H = new HelperMethods();
#endregion
#region Initialization
public AcaciaSeperator()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
ForeColor = Color.FromArgb(150, H.GetHTMLColor("fc3955"));
UpdateStyles();
}
#endregion
#region Enumerators
public enum Style
{
Horizental,
Vertiacal
};
#endregion
#region Properties
public Style SepStyle
{
get
{
return _SepStyle;
}
set
{
_SepStyle = value;
if (value == Style.Horizental)
{
Height = 4;
}
else
{
Width = 4;
}
Invalidate();
}
}
#endregion
#region DrawControl
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap B = new Bitmap(Width, Height))
using (Graphics G = Graphics.FromImage(B))
{
G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
System.Drawing.Drawing2D.ColorBlend BL1 = new System.Drawing.Drawing2D.ColorBlend();
BL1.Positions = new Single[] { 0.0F, 0.15F, 0.85F, 1.0F };
BL1.Colors = new Color[] { Color.Transparent, ForeColor, ForeColor, Color.Transparent };
switch (SepStyle)
{
case Style.Horizental:
using (System.Drawing.Drawing2D.LinearGradientBrush lb1 = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 0.0F))
{
lb1.InterpolationColors = BL1;
G.DrawLine(new Pen(lb1), 0, 1, Width, 1);
}
break;
case Style.Vertiacal:
using (System.Drawing.Drawing2D.LinearGradientBrush lb1 = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 90.0F))
{
lb1.InterpolationColors = BL1;
G.DrawLine(new Pen(lb1), 1, 0, 1, Height);
}
break;
}
e.Graphics.DrawImage(B, 0, 0);
G.Dispose();
B.Dispose();
}
}
#endregion
#region Events
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
if (SepStyle == Style.Horizental) { Height = 4; } else { Width = 4; }
}
#endregion
}
#endregion
#region Label
[DefaultEvent("TextChanged")] public class AcaciaLabel : Control
{
#region Variables
private static HelperMethods H = new HelperMethods();
#endregion
#region Initialization
public AcaciaLabel()
{
SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Font = new Font("Arial", 10, FontStyle.Bold);
UpdateStyles();
}
#endregion
#region DrawControl
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
e.Graphics.DrawString(Text, Font, H.SolidBrushHTMlColor("e4ecf2"), ClientRectangle);
}
#endregion
#region Events
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Height = Font.Height;
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
}
#endregion;
}
Код:
Imports System.Drawing.Drawing2D
Imports System.ComponentModel
#End Region
#Region " Helper Methods "
Public Module HelperMethods
Public GP As GraphicsPath
Public Enum MouseMode As Byte
NormalMode
Hovered
Pushed
End Enum
Public Sub DrawImageFromBase64(ByVal G As Graphics, ByVal Base64Image As String, ByVal Rect As Rectangle)
Dim IM As Image = Nothing
With G
Using ms As New System.IO.MemoryStream(Convert.FromBase64String(Base64Image))
IM = Image.FromStream(ms) : ms.Close()
End Using
.DrawImage(IM, Rect)
End With
End Sub
Public Sub FillRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Rect As Rectangle, ByVal Curve As Integer, _
Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
With G
.FillPath(New SolidBrush(C), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
End With
End Sub
Public Sub FillRoundedPath(ByVal G As Graphics, ByVal B As Brush, ByVal Rect As Rectangle, ByVal Curve As Integer, _
Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
With G
.FillPath(B, RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
End With
End Sub
Public Sub DrawRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Size As Single, ByVal Rect As Rectangle, ByVal Curve As Integer, _
Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
With G
.DrawPath(New Pen(C, Size), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
End With
End Sub
Public Sub DrawTriangle(ByVal G As Graphics, ByVal C As Color, ByVal Size As Integer, ByVal P1_0 As Point, ByVal P1_1 As Point, ByVal P2_0 As Point, ByVal P2_1 As Point, ByVal P3_0 As Point, ByVal P3_1 As Point)
With G
.DrawLine(New Pen(C, Size), P1_0, P1_1)
.DrawLine(New Pen(C, Size), P2_0, P2_1)
.DrawLine(New Pen(C, Size), P3_0, P3_1)
End With
End Sub
Public Function Triangle(ByVal Clr As Color, ByVal P1 As Point, ByVal P2 As Point, ByVal P3 As Point) As Point()
Return New Point() {P1, P2, P3}
End Function
Public Function PenRGBColor(ByVal GR As Graphics, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, ByVal Size As Single) As Pen
Return New Pen(Color.FromArgb(R, G, B), Size)
End Function
Public Function PenHTMlColor(ByVal C_WithoutHash As String, ByVal Size As Single) As Pen
Return New Pen(GetHTMLColor(C_WithoutHash), Size)
End Function
Public Function SolidBrushRGBColor(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, Optional ByVal A As Integer = 0) As SolidBrush
Return New SolidBrush(Color.FromArgb(A, R, G, B))
End Function
Public Function SolidBrushHTMlColor(ByVal C_WithoutHash As String) As SolidBrush
Return New SolidBrush(GetHTMLColor(C_WithoutHash))
End Function
Public Function GetHTMLColor(ByVal C_WithoutHash As String) As Color
Return ColorTranslator.FromHtml("#" & C_WithoutHash)
End Function
Public Function ColorToHTML(ByVal C As Color) As String
Return ColorTranslator.ToHtml(C)
End Function
Public Sub CentreString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
G.DrawString(Text, font, brush, New Rectangle(0, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Center})
End Sub
Public Sub LeftString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
G.DrawString(Text, font, brush, New Rectangle(4, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Near})
End Sub
Public Sub RightString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
G.DrawString(Text, font, brush, New Rectangle(4, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2), Rect.Width - Rect.Height + 10, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Far})
End Sub
#Region " Round Border "
''' <summary>
''' Credits : AeonHack
''' </summary>
Public Function RoundRec(ByVal r As Rectangle, ByVal Curve As Integer, _
Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True) As GraphicsPath
Dim CreateRoundPath As New GraphicsPath(FillMode.Winding)
If TopLeft Then
CreateRoundPath.AddArc(r.X, r.Y, Curve, Curve, 180.0F, 90.0F)
Else
CreateRoundPath.AddLine(r.X, r.Y, r.X, r.Y)
End If
If TopRight Then
CreateRoundPath.AddArc(r.Right - Curve, r.Y, Curve, Curve, 270.0F, 90.0F)
Else
CreateRoundPath.AddLine(r.Right - r.Width, r.Y, r.Width, r.Y)
End If
If BottomRight Then
CreateRoundPath.AddArc(r.Right - Curve, r.Bottom - Curve, Curve, Curve, 0.0F, 90.0F)
Else
CreateRoundPath.AddLine(r.Right, r.Bottom, r.Right, r.Bottom)
End If
If BottomLeft Then
CreateRoundPath.AddArc(r.X, r.Bottom - Curve, Curve, Curve, 90.0F, 90.0F)
Else
CreateRoundPath.AddLine(r.X, r.Bottom, r.X, r.Bottom)
End If
CreateRoundPath.CloseFigure()
Return CreateRoundPath
End Function
#End Region
End Module
#End Region
#Region " Skin "
Public Class AcaciaSkin : Inherits ContainerControl
#Region " Variables "
Private Movable As Boolean = False
Private MousePoint As New Point(0, 0)
Private MoveHeight = 50
Private _TitleTextPostion As TitlePostion = TitlePostion.Left
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.ResizeRedraw, True)
DoubleBuffered = True
Font = New Font("Arial", 12, FontStyle.Bold)
UpdateStyles()
End Sub
#End Region
#Region " Properties "
Private _ShowIcon As Boolean
Property ShowIcon As Boolean
Get
Return _ShowIcon
End Get
Set(ByVal value As Boolean)
If value = _ShowIcon Then Return
FindForm.ShowIcon = value
_ShowIcon = value
Invalidate()
End Set
End Property
Public Overridable Property TitleTextPostion As TitlePostion
Get
Return _TitleTextPostion
End Get
Set(value As TitlePostion)
_TitleTextPostion = value
Invalidate()
End Set
End Property
Enum TitlePostion
Left
Center
Right
End Enum
#End Region
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
G.Clear(Color.Fuchsia)
G.FillRectangle(SolidBrushHTMlColor("24273e"), New Rectangle(0, 0, Width, Height))
G.FillRectangle(SolidBrushHTMlColor("1e2137"), New Rectangle(0, 0, Width, 55))
G.DrawLine(PenHTMlColor("1d1f38", 1), New Point(0, 55), New Point(Width, 55))
G.DrawRectangle(PenHTMlColor("1d1f38", 1), New Rectangle(0, 0, Width - 1, Height - 1))
If FindForm.ShowIcon Then
If Not FindForm.Icon Is Nothing Then
Select Case TitleTextPostion
Case TitlePostion.Left
G.DrawString(Text, Font, SolidBrushHTMlColor("e4ecf2"), 27, 18)
G.DrawIcon(FindForm.Icon, New Rectangle(5, 16, 20, 20))
Case TitlePostion.Center
CentreString(G, Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(0, 0, Width, 50))
G.DrawIcon(FindForm.Icon, New Rectangle(5, 16, 20, 20))
Case TitlePostion.Right
RightString(G, Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(0, 0, Width, 50))
G.DrawIcon(FindForm.Icon, New Rectangle(Width - 30, 16, 20, 20))
End Select
End If
Else
Select Case TitleTextPostion
Case TitlePostion.Left
G.DrawString(Text, Font, SolidBrushHTMlColor("e4ecf2"), 5, 18)
Case TitlePostion.Center
CentreString(G, Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(0, 0, Width, 50))
Case TitlePostion.Right
RightString(G, Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(0, 0, Width, 50))
End Select
End If
e.Graphics.DrawImage(B, 0, 0)
G.Dispose() : B.Dispose()
End Using
End Sub
#Region " Events "
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseDown(e)
If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
Movable = True
MousePoint = e.Location
End If
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
Movable = False
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
MyBase.OnMouseMove(e)
If Movable Then Parent.Location = MousePosition - MousePoint
End Sub
Protected NotOverridable Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
ParentForm.FormBorderStyle = FormBorderStyle.None
ParentForm.Dock = DockStyle.None
Dock = DockStyle.Fill
Invalidate()
End Sub
#End Region
End Class
#End Region
#Region " Button "
Public Class AcaciaButton : Inherits Control
#Region " Variables "
Private State As MouseMode
Private _SideImage As Image
Private _SideImageAlign As SideAligin = SideAligin.Left
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.Transparent
UpdateStyles()
End Sub
#End Region
#Region " Properties "
<Browsable(True)>
Public Property SideImage As Image
Get
Return _SideImage
End Get
Set(value As Image)
_SideImage = value
Invalidate()
End Set
End Property
<Browsable(True)>
Public Property SideImageAlign As SideAligin
Get
Return _SideImageAlign
End Get
Set(value As SideAligin)
_SideImageAlign = value
Invalidate()
End Set
End Property
#End Region
#Region " Enumerators "
Enum SideAligin
Left
Right
End Enum
#End Region
#Region " Draw Control "
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
G.SmoothingMode = SmoothingMode.AntiAlias
G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
Dim Rect As New Rectangle(2, 2, Width - 5, Height - 5)
Select Case State
Case MouseMode.NormalMode
Using HB As PathGradientBrush = New PathGradientBrush(RoundRec(New Rectangle(0, 0, Width, Height), 2))
FillRoundedPath(G, SolidBrushHTMlColor("fc3955"), Rect, 2)
HB.WrapMode = WrapMode.Clamp
Dim CB As New ColorBlend(4)
CB.Colors = New Color() {Color.FromArgb(220, GetHTMLColor("fc3955")), Color.FromArgb(220, GetHTMLColor("fc3955")), Color.FromArgb(220, GetHTMLColor("fc3955")), Color.FromArgb(220, GetHTMLColor("fc3955"))}
CB.Positions = New Single() {0.0F, 0.2F, 0.8F, 1.0F}
HB.InterpolationColors = CB
FillRoundedPath(G, HB, New Rectangle(0, 0, Width - 1, Height - 1), 2)
End Using
Case MouseMode.Hovered
Cursor = Cursors.Hand
Using HB As PathGradientBrush = New PathGradientBrush(RoundRec(New Rectangle(0, 0, Width, Height), 2))
FillRoundedPath(G, New SolidBrush(Color.FromArgb(150, GetHTMLColor("fc3955"))), Rect, 2)
HB.WrapMode = WrapMode.Clamp
Dim CB As New ColorBlend(4)
CB.Colors = New Color() {Color.FromArgb(150, GetHTMLColor("fc3955")), Color.FromArgb(150, GetHTMLColor("fc3955")), Color.FromArgb(150, GetHTMLColor("fc3955")), Color.FromArgb(150, GetHTMLColor("fc3955"))}
CB.Positions = New Single() {0.0F, 0.2F, 0.8F, 1.0F}
HB.InterpolationColors = CB
FillRoundedPath(G, HB, New Rectangle(0, 0, Width - 1, Height - 1), 2)
End Using
Case MouseMode.Pushed
Using HB As PathGradientBrush = New PathGradientBrush(RoundRec(New Rectangle(0, 0, Width, Height), 2))
FillRoundedPath(G, SolidBrushHTMlColor("fc3955"), Rect, 2)
HB.WrapMode = WrapMode.Clamp
Dim CB As New ColorBlend(4)
CB.Colors = New Color() {Color.FromArgb(220, GetHTMLColor("fc3955")), Color.FromArgb(220, GetHTMLColor("fc3955")), Color.FromArgb(220, GetHTMLColor("fc3955")), Color.FromArgb(220, GetHTMLColor("fc3955"))}
CB.Positions = New Single() {0.0F, 0.2F, 0.8F, 1.0F}
HB.InterpolationColors = CB
FillRoundedPath(G, HB, New Rectangle(0, 0, Width - 1, Height - 1), 2)
End Using
End Select
If Not SideImage Is Nothing Then
If SideImageAlign = SideAligin.Right Then
G.DrawImage(SideImage, New Rectangle(Rect.Width - 24, Rect.Y + 7, 16, 16))
Else
G.DrawImage(SideImage, New Rectangle(8, Rect.Y + 7, 16, 16))
End If
End If
CentreString(G, Text, Font, SolidBrushHTMlColor("e4ecf2"), Rect)
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#End Region
#Region " Events "
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
State = MouseMode.Hovered : Invalidate()
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
State = MouseMode.Pushed : Invalidate()
End Sub
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
MyBase.OnMouseEnter(e)
State = MouseMode.Hovered : Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
MyBase.OnMouseEnter(e)
State = MouseMode.NormalMode : Invalidate()
End Sub
#End Region
End Class
#End Region
#Region " TextBox "
Public Class AcaciaTextbox : Inherits Control
#Region " Variables "
Protected WithEvents T As New TextBox
Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
Private _MaxLength As Integer = 32767
Private _ReadOnly As Boolean = False
Private _UseSystemPasswordChar As Boolean = False
Private _WatermarkText As String = String.Empty
Private _SideImage As Image
Protected TBC As Color = GetHTMLColor("24273e")
Protected TFC As Color = GetHTMLColor("585c73")
Protected State As MouseMode = MouseMode.NormalMode
Private _BackColor As Color = TBC
#End Region
#Region " Native Methods "
Private Declare Auto Function SendMessage Lib "user32.dll" (hWnd As IntPtr, msg As Integer, wParam As Integer, <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)> lParam As String) As Int32
#End Region
#Region " Properties "
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
ReadOnly Property BorderStyle As BorderStyle
Get
Return BorderStyle.None
End Get
End Property
Public Overridable Shadows Property TextAlign() As HorizontalAlignment
Get
Return _TextAlign
End Get
Set(ByVal value As HorizontalAlignment)
_TextAlign = value
If T IsNot Nothing Then
T.TextAlign = value
End If
End Set
End Property
Public Overridable Shadows Property MaxLength() As Integer
Get
Return _MaxLength
End Get
Set(ByVal value As Integer)
_MaxLength = value
If T IsNot Nothing Then
T.MaxLength = value
End If
End Set
End Property
Public Shadows Property BackColor As Color
Get
Return _BackColor
End Get
Set(value As Color)
MyBase.BackColor = value
_BackColor = value
T.BackColor = value
Invalidate()
End Set
End Property
Public Overridable Shadows Property [ReadOnly]() As Boolean
Get
Return _ReadOnly
End Get
Set(ByVal value As Boolean)
_ReadOnly = value
If T IsNot Nothing Then
T.ReadOnly = value
End If
End Set
End Property
Public Overridable Shadows Property UseSystemPasswordChar() As Boolean
Get
Return _UseSystemPasswordChar
End Get
Set(ByVal value As Boolean)
_UseSystemPasswordChar = value
If T IsNot Nothing Then
T.UseSystemPasswordChar = value
End If
End Set
End Property
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Overridable Shadows ReadOnly Property Multiline() As Boolean
Get
Return False
End Get
End Property
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Overridable Shadows ReadOnly Property BackgroundImage() As Image
Get
Return Nothing
End Get
End Property
Public Overridable Shadows Property Text As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
If T IsNot Nothing Then
T.Text = value
End If
End Set
End Property
Public Property WatermarkText As String
Get
Return _WatermarkText
End Get
Set(value As String)
_WatermarkText = value
SendMessage(T.Handle, &H1501, 0, value)
Invalidate()
End Set
End Property
<Browsable(True)>
Public Property SideImage As Image
Get
Return _SideImage
End Get
Set(value As Image)
_SideImage = value
Invalidate()
End Set
End Property
Enum SideAligin
Left
Right
End Enum
Private _SideImageAlign As SideAligin = SideAligin.Left
<Browsable(True)>
Public Property SideImageAlign As SideAligin
Get
Return _SideImageAlign
End Get
Set(value As SideAligin)
_SideImageAlign = value
Invalidate()
End Set
End Property
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = TBC
Font = New Font("Arial", 11, FontStyle.Regular)
With T
.Multiline = False
.Cursor = Cursors.IBeam
.BackColor = BackColor
.ForeColor = TFC
.BorderStyle = BorderStyle.None
.Location = New Point(7, 7)
.Font = Font
.Size = New Size(Width - 10, 30)
.UseSystemPasswordChar = _UseSystemPasswordChar
End With
Size = New Size(135, 30)
UpdateStyles()
End Sub
#End Region
#Region " Events "
Private Sub T_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles T.TextChanged
Text = T.Text
End Sub
Private Sub T_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles T.KeyDown
If e.Control AndAlso e.KeyCode = Keys.A Then e.SuppressKeyPress = True
If e.Control AndAlso e.KeyCode = Keys.C Then
T.Copy()
e.SuppressKeyPress = True
End If
End Sub
Protected NotOverridable Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
If Not Controls.Contains(T) Then Controls.Add(T)
End Sub
Protected NotOverridable Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Height = 30
End Sub
Private Sub T_MouseHover(ByVal sender As Object, e As EventArgs) Handles T.MouseHover
State = MouseMode.Hovered
Invalidate()
End Sub
Private Sub T_MouseLeave(ByVal sender As Object, e As EventArgs) Handles T.MouseLeave
State = MouseMode.NormalMode
Invalidate()
End Sub
Private Sub T_MouseUp(ByVal sender As Object, e As MouseEventArgs) Handles T.MouseUp
State = MouseMode.NormalMode
Invalidate()
End Sub
Private Sub T_MouseEnter(ByVal sender As Object, e As EventArgs) Handles T.MouseEnter
State = MouseMode.NormalMode
Invalidate()
End Sub
Private Sub T_MouseDown(ByVal sender As Object, e As EventArgs) Handles T.MouseDown
State = MouseMode.Pushed
Invalidate()
End Sub
#End Region
#Region " Draw Control "
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
With G
.SmoothingMode = SmoothingMode.HighQuality
.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
Select Case State
Case MouseMode.NormalMode
.DrawLine(PenHTMlColor("585c73", 1), New Point(0, 29), New Point(Width, 29))
Case MouseMode.Hovered
.DrawLine(New Pen(GetHTMLColor("fc3955"), 1), New Point(0, 29), New Point(Width, 29))
Case MouseMode.Pushed
.DrawLine(New Pen(Color.FromArgb(150, GetHTMLColor("fc3955")), 1), New Point(0, 29), New Point(Width, 29))
End Select
If Not SideImage Is Nothing Then
T.Location = New Point(33, 4.5)
T.Width = Width - 60
.InterpolationMode = InterpolationMode.HighQualityBicubic
.DrawImage(SideImage, New Rectangle(8, 4, 16, 16))
Else
T.Location = New Point(7, 4.5)
T.Width = Width - 10
End If
If Not ContextMenuStrip Is Nothing Then T.ContextMenuStrip = ContextMenuStrip
End With
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#End Region
End Class
#End Region
#Region " Control Button "
Class AcaciaControlButton : Inherits Control
#Region " Variables "
Private State As MouseMode
Private _ControlStyle As Style = Style.Close
#End Region
#Region " Draw Control "
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
With G
.SmoothingMode = SmoothingMode.HighQuality
Select Case State
Case MouseMode.NormalMode
.DrawEllipse(New Pen(Color.FromArgb(150, GetHTMLColor("fc3955")), 2), New Rectangle(1, 1, 15, 15))
.FillEllipse(New SolidBrush(Color.FromArgb(150, GetHTMLColor("fc3955"))), New Rectangle(5, 5, 7, 7))
Case MouseMode.Hovered
Cursor = Cursors.Hand
.DrawEllipse(PenHTMlColor("fc3955", 2), New Rectangle(1, 1, 15, 15))
.FillEllipse(SolidBrushHTMlColor("fc3955"), New Rectangle(5, 5, 7, 7))
Case MouseMode.Pushed
.DrawEllipse(PenHTMlColor("24273e", 2), New Rectangle(1, 1, 15, 15))
.FillEllipse(SolidBrushHTMlColor("24273e"), New Rectangle(5, 5, 7, 7))
End Select
End With
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#End Region
#Region " Properties "
Public Property ControlStyle As Style
Get
Return _ControlStyle
End Get
Set(value As Style)
_ControlStyle = value
Invalidate()
End Set
End Property
#End Region
#Region " Enumerators "
Enum Style
Close
Minimize
Maximize
End Enum
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.Transparent
UpdateStyles()
Anchor = AnchorStyles.Top Or AnchorStyles.Right
Size = New Size(18, 18)
End Sub
#End Region
#Region " Events "
Protected Overrides Sub OnClick(e As EventArgs)
MyBase.OnClick(e)
If ControlStyle = Style.Close Then
Environment.Exit(0)
Application.Exit()
ElseIf ControlStyle = Style.Minimize Then
If FindForm.WindowState = FormWindowState.Normal Then
FindForm.WindowState = FormWindowState.Minimized
End If
ElseIf ControlStyle = Style.Maximize Then
If FindForm.WindowState = FormWindowState.Normal Then
FindForm.WindowState = FormWindowState.Maximized
ElseIf FindForm.WindowState = FormWindowState.Maximized Then
FindForm.WindowState = FormWindowState.Normal
End If
End If
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
State = MouseMode.Hovered : Invalidate()
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
State = MouseMode.Pushed : Invalidate()
End Sub
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
MyBase.OnMouseEnter(e)
State = MouseMode.Hovered : Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
MyBase.OnMouseEnter(e)
State = MouseMode.NormalMode : Invalidate()
End Sub
#End Region
End Class
#End Region
#Region " CheckBox "
<DefaultEvent("CheckedChanged")> Public Class AcaciaCheckBox : Inherits Control
#Region " Variables "
Private _Checked As Boolean
Protected State As MouseMode = MouseMode.NormalMode
#End Region
#Region " Events "
Event CheckedChanged(ByVal sender As Object)
#End Region
#Region " Properties "
Property Checked As Boolean
Get
Return _Checked
End Get
Set(ByVal value As Boolean)
_Checked = value
RaiseEvent CheckedChanged(Me)
Invalidate()
End Set
End Property
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
DoubleBuffered = True
Cursor = Cursors.Hand
BackColor = Color.Transparent
Font = New Font("Arial", 11, FontStyle.Regular)
UpdateStyles()
End Sub
#End Region
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
G.SmoothingMode = SmoothingMode.AntiAlias
G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
If Checked Then
DrawRoundedPath(G, GetHTMLColor("fc3955"), 2.5, New Rectangle(1, 1, 17, 17), 1)
FillRoundedPath(G, SolidBrushHTMlColor("fc3955"), New Rectangle(5, 5, 9, 9), 1)
G.DrawString(Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(22, 1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
Else
Select Case State
Case MouseMode.NormalMode
DrawRoundedPath(G, Color.FromArgb(150, GetHTMLColor("fc3955")), 2.5, New Rectangle(1, 1, 17, 17), 1)
G.DrawString(Text, Font, New SolidBrush(Color.Silver), New Rectangle(22, 1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
Case MouseMode.Hovered
DrawRoundedPath(G, GetHTMLColor("fc3955"), 2.5, New Rectangle(1, 1, 17, 17), 1)
FillRoundedPath(G, SolidBrushHTMlColor("fc3955"), New Rectangle(5, 5, 9, 9), 1)
G.DrawString(Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(22, 1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
End Select
End If
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#Region " Events "
Protected Overrides Sub OnClick(ByVal e As EventArgs)
_Checked = Not Checked
RaiseEvent CheckedChanged(Me)
MyBase.OnClick(e)
Invalidate()
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
Invalidate() : MyBase.OnTextChanged(e)
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)
Height = 20
Invalidate()
End Sub
Protected Overrides Sub OnMouseHover(e As EventArgs)
MyBase.OnMouseHover(e)
State = MouseMode.Hovered
Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(e As EventArgs)
MyBase.OnMouseLeave(e)
State = MouseMode.NormalMode
Invalidate()
End Sub
#End Region
End Class
#End Region
#Region " Radio Button "
<DefaultEvent("TextChanged")> Public Class AcaciaRadioButton : Inherits Control
#Region " Variables "
Private _Checked As Boolean
Protected _Group As Integer = 1
Protected State As MouseMode = MouseMode.NormalMode
#End Region
#Region " Events "
Event CheckedChanged(ByVal sender As Object)
#End Region
#Region " Properties "
Property Checked As Boolean
Get
Return _Checked
End Get
Set(ByVal value As Boolean)
_Checked = value
RaiseEvent CheckedChanged(Me)
Invalidate()
End Set
End Property
Property Group As Integer
Get
Return _Group
End Get
Set(ByVal value As Integer)
_Group = value
Invalidate()
End Set
End Property
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
DoubleBuffered = True
Cursor = Cursors.Hand
BackColor = Color.Transparent
Font = New Font("Arial", 11, FontStyle.Regular)
UpdateStyles()
End Sub
#End Region
#Region " Draw Control "
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
G.SmoothingMode = SmoothingMode.AntiAlias
G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
If Checked Then
G.DrawEllipse(PenHTMlColor("fc3955", 2.8), New Rectangle(1, 1, 18, 18))
G.FillEllipse(SolidBrushHTMlColor("fc3955"), New Rectangle(5, 5, 10, 10))
G.DrawString(Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(22, 1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
Else
Select Case State
Case MouseMode.NormalMode
G.DrawEllipse(New Pen(Color.FromArgb(150, GetHTMLColor("fc3955")), 2.8), New Rectangle(1, 1, 18, 18))
G.DrawString(Text, Font, New SolidBrush(Color.Silver), New Rectangle(22, 1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
Case MouseMode.Hovered
G.DrawEllipse(PenHTMlColor("fc3955", 2.8), New Rectangle(1, 1, 18, 18))
G.FillEllipse(SolidBrushHTMlColor("fc3955"), New Rectangle(5, 5, 10, 10))
G.DrawString(Text, Font, SolidBrushHTMlColor("e4ecf2"), New Rectangle(22, 1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
End Select
End If
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#End Region
#Region " Events "
Private Sub UpdateState()
If Not IsHandleCreated OrElse Not Checked Then Return
For Each C As Control In Parent.Controls
If C IsNot Me AndAlso TypeOf C Is AcaciaRadioButton AndAlso DirectCast(C, AcaciaRadioButton).Group = _Group Then
DirectCast(C, AcaciaRadioButton).Checked = False
End If
Next
End Sub
Protected Overrides Sub OnClick(ByVal e As EventArgs)
_Checked = Not Checked
UpdateState()
MyBase.OnClick(e)
Invalidate()
End Sub
Protected Overrides Sub OnCreateControl()
UpdateState()
MyBase.OnCreateControl()
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
Invalidate() : MyBase.OnTextChanged(e)
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)
Height = 21
Invalidate()
End Sub
Protected Overrides Sub OnMouseHover(e As EventArgs)
MyBase.OnMouseHover(e)
State = MouseMode.Hovered
Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(e As EventArgs)
MyBase.OnMouseLeave(e)
State = MouseMode.NormalMode
Invalidate()
End Sub
#End Region
End Class
#End Region
#Region " Label "
<DefaultEvent("TextChanged")> Public Class AcaciaLabel : Inherits Control
Protected Overrides Sub OnPaint(e As PaintEventArgs)
With e.Graphics
.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
.DrawString(Text, Font, SolidBrushHTMlColor("e4ecf2"), ClientRectangle)
End With
End Sub
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
DoubleBuffered = True
BackColor = Color.Transparent
Font = New Font("Arial", 10, FontStyle.Bold)
UpdateStyles()
End Sub
#End Region
Protected Overrides Sub OnResize(e As EventArgs)
Height = Font.Height
End Sub
Protected Overrides Sub OnTextChanged(e As EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub
End Class
#End Region
#Region " Seperator "
Public Class AcaciaSeperator : Inherits Control
#Region " Variables "
Private _SepStyle As Style = Style.Horizental
#End Region
#Region " Enumerators "
Enum Style
Horizental
Vertiacal
End Enum
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
DoubleBuffered = True
BackColor = Color.Transparent
ForeColor = Color.FromArgb(150, GetHTMLColor("fc3955"))
UpdateStyles()
End Sub
#End Region
#Region " Draw Control "
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
With G
.SmoothingMode = SmoothingMode.HighQuality
Dim BL1, BL2 As New ColorBlend
BL1.Positions = New Single() {0.0F, 0.15F, 0.85F, 1.0F}
BL1.Colors = New Color() {Color.Transparent, ForeColor, ForeColor, Color.Transparent}
Select Case SepStyle
Case Style.Horizental
Using lb1 As New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 0.0F)
lb1.InterpolationColors = BL1
.DrawLine(New Pen(lb1), 0, 1, Width, 1)
End Using
Case Style.Vertiacal
Using lb1 As New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 0.0F)
lb1.InterpolationColors = BL1
.DrawLine(New Pen(lb1), 1, 0, 1, Height)
End Using
End Select
End With
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#End Region
Protected Overrides Sub OnResize(e As EventArgs)
If SepStyle = Style.Horizental Then
Height = 4
Else
Width = 4
End If
End Sub
#Region " Properties "
Public Property SepStyle As Style
Get
Return _SepStyle
End Get
Set(value As Style)
_SepStyle = value
If value = Style.Horizental Then
Height = 4
Else
Width = 4
End If
End Set
End Property
#End Region
End Class
#End Region
#Region " Combo Box "
Public Class AcaciaComboBox : Inherits ComboBox
#Region " Variables "
Private _StartIndex As Integer = 0
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
Font = New Font("Arial", 12)
DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
DoubleBuffered = True
StartIndex = 0
DropDownStyle = ComboBoxStyle.DropDownList
UpdateStyles()
End Sub
#End Region
#Region " Properties "
Private Property StartIndex As Integer
Get
Return _StartIndex
End Get
Set(ByVal value As Integer)
_StartIndex = value
Try
MyBase.SelectedIndex = value
Catch
End Try
Invalidate()
End Set
End Property
#End Region
Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
Try
Dim G As Graphics = e.Graphics
With G
.SmoothingMode = SmoothingMode.AntiAlias
.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
.FillRectangle(New SolidBrush(Color.FromArgb(120, GetHTMLColor("fc3955"))), e.Bounds)
.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), Font, SolidBrushHTMlColor("585c73"), 1, e.Bounds.Y + 4)
Else
.FillRectangle(Brushes.WhiteSmoke, e.Bounds)
.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), Font, SolidBrushHTMlColor("585c73"), 1, e.Bounds.Y + 4)
End If
End With
Catch
End Try
Invalidate()
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
Dim Rect As New Rectangle(1, 1, Width - 2.5, Height - 2.5)
With G
.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
DrawRoundedPath(G, GetHTMLColor("585c73"), 1.7, Rect, 1)
.SmoothingMode = SmoothingMode.AntiAlias
DrawTriangle(G, GetHTMLColor("fc3955"), 1.5, _
New Point(Width - 20, 12), New Point(Width - 16, 16), _
New Point(Width - 16, 16), New Point(Width - 12, 12), _
New Point(Width - 16, 17), New Point(Width - 16, 16) _
)
.SmoothingMode = SmoothingMode.None
.DrawString(Text, Font, New SolidBrush(GetHTMLColor("585c73")), New Rectangle(7, 1, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
End With
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#Region " Events "
Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Invalidate()
End Sub
#End Region
End Class
#End Region
#Region " ProgressBar "
Public Class AcaciaProgressBar : Inherits Control
#Region " Variables "
Private _Maximum As Integer = 100
Private _Value As Integer = 0
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or _
ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.Transparent
UpdateStyles()
End Sub
#End Region
#Region " Properties "
Public Property Value() As Integer
Get
If _Value < 0 Then
Return 0
Else
Return _Value
End If
End Get
Set(ByVal Value As Integer)
If Value > Maximum Then
Value = Maximum
End If
_Value = Value
Invalidate()
End Set
End Property
Public Property Maximum() As Integer
Get
Return _Maximum
End Get
Set(ByVal Value As Integer)
Select Case Value
Case Is < _Value
_Value = Value
End Select
_Maximum = Value
Invalidate()
End Set
End Property
#End Region
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
With G
.SmoothingMode = SmoothingMode.HighQuality
Dim CurrentValue As Integer = CInt(Value / Maximum * Width)
Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
FillRoundedPath(G, SolidBrushHTMlColor("1e2137"), Rect, 1)
If Not CurrentValue = 0 Then
FillRoundedPath(G, GetHTMLColor("fc3955"), New Rectangle(Rect.X, Rect.Y, CurrentValue, Rect.Height), 1)
End If
End With
e.Graphics.DrawImage(B.Clone, 0, 0)
G.Dispose() : B.Dispose()
End Using
End Sub
Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Height = 20
End Sub
End Class
#End Region
#Region " TrackBar "
<DefaultEvent("Scroll")> Public Class AcaciaTrackBar : Inherits Control
#Region " Variables "
Protected Variable As Boolean
Private Track, TrackSide As Rectangle
Protected _Maximum As Integer = 100
Private _Minimum As Integer
Private _Value As Integer
Private CurrentValue As Integer = CInt(Value / Maximum - 2 * (Width))
#End Region
#Region " Events "
Event Scroll(ByVal sender As Object)
Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
If e.KeyCode = Keys.Subtract OrElse e.KeyCode = Keys.Down OrElse e.KeyCode = Keys.Left Then
If Value = 0 Then Exit Sub
Value -= 1
ElseIf e.KeyCode = Keys.Add OrElse e.KeyCode = Keys.Up OrElse e.KeyCode = Keys.Right Then
If Value = Maximum Then Exit Sub
Value += 1
End If
MyBase.OnKeyDown(e)
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
If e.Button = MouseButtons.Left AndAlso Height > 0 Then
RenewCurrentValue()
If Width > 0 AndAlso Height > 0 Then
Try
Track = New Rectangle(CurrentValue + 0.8, 0, 25, 24)
Catch
End Try
End If
Variable = New Rectangle(CurrentValue, 0, 24, Height).Contains(e.Location)
End If
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
If Variable AndAlso e.X > -1 AndAlso e.X < Width + 1 Then Value = Minimum + CInt((Maximum - Minimum) * (e.X / Width))
MyBase.OnMouseMove(e)
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
Variable = False : MyBase.OnMouseUp(e)
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
If Width > 0 AndAlso Height > 0 Then
RenewCurrentValue()
MoveTrack()
End If
Invalidate()
MyBase.OnResize(e)
End Sub
Sub RenewCurrentValue()
CurrentValue = CInt((Value - Minimum) / (Maximum - Minimum) * (Width - 23.5))
End Sub
Protected Sub MoveTrack()
If Height > 0 AndAlso Width > 0 Then Track = New Rectangle(CurrentValue + 1, 0, 21, 20)
TrackSide = New Rectangle(CurrentValue + 8.5, 7, 6, 6)
End Sub
#End Region
#Region " Properties "
Property Maximum As Integer
Get
Return _Maximum
End Get
Set(ByVal value As Integer)
_Maximum = value
RenewCurrentValue()
MoveTrack()
Invalidate()
End Set
End Property
Property Minimum As Integer
Get
Return _Minimum
End Get
Set(ByVal value As Integer)
If Not value < 0 Then
_Minimum = value
RenewCurrentValue()
MoveTrack()
Invalidate()
End If
End Set
End Property
Property Value As Integer
Get
Return _Value
End Get
Set(ByVal value As Integer)
If value <> _Value Then
_Value = value
RenewCurrentValue()
MoveTrack()
Invalidate()
RaiseEvent Scroll(Me)
End If
End Set
End Property
#End Region
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
DoubleBuffered = True
Cursor = Cursors.Hand
BackColor = Color.Transparent
UpdateStyles()
End Sub
#End Region
#Region " Draw Control "
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
With G
Cursor = Cursors.Hand
.SmoothingMode = SmoothingMode.HighQuality
.PixelOffsetMode = PixelOffsetMode.HighQuality
FillRoundedPath(G, SolidBrushHTMlColor("1e2137"), New Rectangle(0, 5.5, Width, 8), 8)
If Not CurrentValue = 0 Then
FillRoundedPath(G, GetHTMLColor("fc3955"), New Rectangle(0, 5.5, CurrentValue + 4, 8), 6)
End If
.PixelOffsetMode = PixelOffsetMode.Half
.FillEllipse(SolidBrushHTMlColor("fc3955"), Track)
.FillEllipse(SolidBrushHTMlColor("1e2137"), TrackSide)
End With
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#End Region
End Class
#End Region
#Region " Panel "
Public Class AcaciaPanel : Inherits ContainerControl
#Region " Constructors "
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.Transparent
UpdateStyles()
End Sub
#End Region
#Region " Draw Control "
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
With G
.FillRectangle(SolidBrushHTMlColor("24273e"), Rect)
.DrawRectangle(PenHTMlColor("1d1f38", 1), Rect)
End With
e.Graphics.DrawImage(B, 0, 0)
G.Dispose()
B.Dispose()
End Using
End Sub
#End Region
End Class
А теперь я покажу вам, мои дорогие дауны начинающие программисты, как же это добавить в ваш топ лоадер!
1) Выбираем нужный язык программирования (VB.Net или C#), узнать ваш язык можно по наличию
2) Открываем нужный спойлер
3) Копируем код из спойлера
4) Заходим в ваш проект
5) Нажимаем Ctrl+Shift+A
6) В vb мы пишем в имени файла
В c# мы пишем в имени файла
7) Вставляем в файл код, который мы скопировали
8) Нажимаем F5
9) Закрываем запустившееся
PROFIT, в панели слева появились новые элементы!
1) Выбираем нужный язык программирования (VB.Net или C#), узнать ваш язык можно по наличию
;
в конце строк2) Открываем нужный спойлер
3) Копируем код из спойлера
4) Заходим в ваш проект
5) Нажимаем Ctrl+Shift+A
6) В vb мы пишем в имени файла
zalupa.vb
(название очень важно!!! ), нажимаем ДобавитьВ c# мы пишем в имени файла
chlen.cs
(название очень важно!!! ), нажимаем Добавить7) Вставляем в файл код, который мы скопировали
8) Нажимаем F5
9) Закрываем запустившееся
PROFIT, в панели слева появились новые элементы!
Последнее редактирование: