THE_LORD

Ethereal Theme

Dec 26th, 2016
747
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 78.92 KB | None | 0 0
  1.     /// <summary>
  2. /// Ethereal Theme
  3. /// Author : THE LORD
  4. /// Credits : Aeonhack(Round Rectangle Function)
  5. /// Credits : Mavamaarten(TabPage Mouse Hover & Mouse Leave Event)
  6. /// Release Date : Tuesday, December 27, 2016
  7. /// Last Update : Monday, January 9, 2017
  8. /// Update Purpose : Customizable Colors
  9. /// </summary>
  10.  
  11.     #region Namespaces
  12.  
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Diagnostics;
  16. using System.Drawing;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Threading;
  20. using System.Threading.Tasks;
  21. using System.Windows.Forms;
  22.  
  23. #endregion
  24.  
  25.     #region Helper Methods
  26.  
  27.     public class HelperMethods
  28.     {
  29.  
  30.         public static System.Drawing.Drawing2D.GraphicsPath GP = null;
  31.  
  32.         public enum MouseMode
  33.         {
  34.             NormalMode,
  35.             Hovered,
  36.             Pushed
  37.         };
  38.  
  39.         public static void DrawImageFromBase64(Graphics G, string Base64Image, Rectangle Rect)
  40.         {
  41.             Image IM = null;
  42.             using (System.IO.MemoryStream ms = new System.IO.MemoryStream(Convert.FromBase64String(Base64Image)))
  43.             {
  44.                 IM = System.Drawing.Image.FromStream(ms);
  45.             }
  46.             G.DrawImage(IM, Rect);
  47.         }
  48.  
  49.         public static System.Drawing.Drawing2D.GraphicsPath RoundRec(Rectangle r, int Curve)
  50.         {
  51.             System.Drawing.Drawing2D.GraphicsPath CreateRoundPath = new System.Drawing.Drawing2D.GraphicsPath(System.Drawing.Drawing2D.FillMode.Winding);
  52.             CreateRoundPath.AddArc(r.X, r.Y, Curve, Curve, 180f, 90f);
  53.             CreateRoundPath.AddArc(r.Right - Curve, r.Y, Curve, Curve, 270f, 90f);
  54.             CreateRoundPath.AddArc(r.Right - Curve, r.Bottom - Curve, Curve, Curve, 0f, 90f);
  55.             CreateRoundPath.AddArc(r.X, r.Bottom - Curve, Curve, Curve, 90f, 90f);
  56.             CreateRoundPath.CloseFigure();
  57.             return CreateRoundPath;
  58.         }
  59.  
  60.         public static void FillRoundedPath(Graphics G, Color C, Rectangle Rect, int Curve)
  61.         {
  62.             G.FillPath(new SolidBrush(C), RoundRec(Rect, Curve));
  63.         }
  64.  
  65.         public static void FillRoundedPath(Graphics G, Brush B, Rectangle Rect, int Curve)
  66.         {
  67.             G.FillPath(B, RoundRec(Rect, Curve));
  68.         }
  69.        
  70.         public static void DrawRoundedPath(Graphics G, Color C, Single Size, Rectangle Rect, int Curve)
  71.         {
  72.             G.DrawPath(new Pen(C, Size), RoundRec(Rect, Curve));
  73.  
  74.         }
  75.  
  76.         public static 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)
  77.         {
  78.  
  79.             G.DrawLine(new Pen(C, Size), P1_0, P1_1);
  80.             G.DrawLine(new Pen(C, Size), P2_0, P2_1);
  81.             G.DrawLine(new Pen(C, Size), P3_0, P3_1);
  82.  
  83.         }
  84.  
  85.         public static Pen PenRGBColor(int R, int G, int B, Single size)
  86.         { return new Pen(System.Drawing.Color.FromArgb(R, G, B), size); }
  87.  
  88.         public static Pen PenHTMlColor(String C_WithoutHash, Single size)
  89.         { return new Pen(GetHTMLColor(C_WithoutHash), size); }
  90.  
  91.         public static SolidBrush SolidBrushRGBColor(int R, int G, int B, int A = 0)
  92.         { return new SolidBrush(System.Drawing.Color.FromArgb(A, R, G, B)); }
  93.  
  94.         public static SolidBrush SolidBrushHTMlColor(String C_WithoutHash)
  95.         { return new SolidBrush(GetHTMLColor(C_WithoutHash)); }
  96.  
  97.         public static Color GetHTMLColor(String C_WithoutHash)
  98.         { return ColorTranslator.FromHtml("#" + C_WithoutHash); }
  99.  
  100.         public static String ColorToHTML(Color C)
  101.         { return ColorTranslator.ToHtml(C); }
  102.  
  103.         public static Color SetARGB(int A, int R, int G, int B)
  104.         { return System.Drawing.Color.FromArgb(A, R, G, B); }
  105.  
  106.         public static Color SetRGB(int R, int G, int B)
  107.         { return System.Drawing.Color.FromArgb(R, G, B); }
  108.  
  109.         public static Font FontByName(String NameOfFont, Single size, FontStyle Style)
  110.         { return new Font(NameOfFont, size, Style); }
  111.  
  112.         public static void CentreString(Graphics G, String Text, Font font, Brush brush, Rectangle Rect)
  113.         { 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 }); }
  114.  
  115.         public static void LeftString(Graphics G, String Text, Font font, Brush brush, Rectangle Rect)
  116.         {
  117.             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 });
  118.         }
  119.  
  120.         public static void FillRect(Graphics G, Brush Br, Rectangle Rect)
  121.         { G.FillRectangle(Br, Rect); }
  122.  
  123.     }
  124.  
  125.     #endregion
  126.  
  127.     #region Skin
  128.  
  129.     public class EtherealTheme : ContainerControl
  130.     {
  131.  
  132.         #region    Variables
  133.  
  134.         bool Movable = false;
  135.         private TitlePostion _TitleTextPostion = TitlePostion.Left;
  136.         static Point MousePoint = new Point(0, 0);
  137.         private int MoveHeight = 50;
  138.         private bool _ShowIcon = false;
  139.         private Color _HeaderColor = HelperMethods.GetHTMLColor("3f2153");
  140.         private Color _BackColor = Color.White;
  141.         private Color _BorderColor = HelperMethods.GetHTMLColor("3f2153");
  142.  
  143.         #endregion
  144.  
  145.         #region  Properties
  146.  
  147.        
  148.         public bool ShowIcon
  149.         {
  150.             get { return _ShowIcon; }
  151.             set
  152.             {
  153.                 if (value == _ShowIcon) { return; }
  154.                 FindForm().ShowIcon = value;            
  155.                 Invalidate();
  156.                 _ShowIcon = value;
  157.             }
  158.         }
  159.  
  160.  
  161.         public TitlePostion TitleTextPostion
  162.         {
  163.             get { return _TitleTextPostion; }
  164.  
  165.             set
  166.             {
  167.                 _TitleTextPostion = value;
  168.                 Invalidate();
  169.             }
  170.  
  171.         }
  172.  
  173.  
  174.         public enum TitlePostion
  175.         {
  176.             Left,
  177.             Center
  178.         };
  179.  
  180.         public Color HeaderColor
  181.         {
  182.             get
  183.             {
  184.                 return _HeaderColor;
  185.             }
  186.             set
  187.             {
  188.                 _HeaderColor = value;
  189.                 Invalidate();
  190.             }
  191.         }
  192.  
  193.         override public Color BackColor
  194.         {
  195.             get
  196.             {
  197.                 return _BackColor;
  198.             }
  199.             set
  200.             {
  201.                 _BackColor = value;
  202.                 base.BackColor = value;
  203.                 Invalidate();
  204.             }
  205.         }
  206.  
  207.         public Color BorderColor
  208.         {
  209.             get
  210.             {
  211.                 return _BorderColor;
  212.             }
  213.             set
  214.             {
  215.                 _BorderColor = value;
  216.                 Invalidate();
  217.             }
  218.         }
  219.  
  220.         #endregion
  221.  
  222.         #region  Initialization
  223.  
  224.         public EtherealTheme()
  225.         {
  226.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
  227.             DoubleBuffered = true;
  228.             UpdateStyles();
  229.             Font = new Font("Proxima Nova", 14, FontStyle.Bold);            
  230.  
  231.         }
  232.  
  233.         #endregion
  234.  
  235.         #region Mouse & other Events
  236.  
  237.         protected override void OnCreateControl()
  238.         {
  239.             base.OnCreateControl();
  240.             ParentForm.FormBorderStyle = FormBorderStyle.None;
  241.             ParentForm.TransparencyKey = Color.Fuchsia;
  242.             Dock = DockStyle.Fill;
  243.         }
  244.  
  245.  
  246.         protected override void OnMouseMove(MouseEventArgs e)
  247.         {
  248.             base.OnMouseMove(e);
  249.             int x = MousePosition.X;
  250.             int y = MousePosition.Y;
  251.             int x1 = MousePoint.X;
  252.             int y1 = MousePoint.Y;
  253.             if (Movable)
  254.  
  255.                 Parent.Location = new Point(x - x1, y - y1);
  256.             Focus();
  257.         }
  258.  
  259.         protected override void OnMouseDown(MouseEventArgs e)
  260.         {
  261.             base.OnMouseDown(e);
  262.             if (e.Button == System.Windows.Forms.MouseButtons.Left && new Rectangle(0, 0, Width, MoveHeight).Contains(e.Location))
  263.             {
  264.                 Movable = true;
  265.                 MousePoint = e.Location;
  266.             }
  267.  
  268.         }
  269.  
  270.         protected override void OnMouseUp(MouseEventArgs e)
  271.         {
  272.             base.OnMouseUp(e);
  273.             Movable = false;
  274.         }
  275.  
  276.         #endregion
  277.  
  278.         #region Draw Control
  279.  
  280.         protected override void OnPaint(PaintEventArgs e)
  281.         {
  282.             base.OnPaint(e);
  283.             Rectangle Rect = new Rectangle(1, 1, (int)(Width - 2.5), (int)(Height - 2.5));
  284.             Bitmap B = new Bitmap(Width, Height);
  285.             using (Graphics G = Graphics.FromImage(B))
  286.             {
  287.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  288.  
  289.                 HelperMethods.FillRect(G, new SolidBrush(HeaderColor), new Rectangle(0, 0, Width, 50));
  290.                 G.DrawRectangle(new Pen(BorderColor, 2), new Rectangle(1, 1, Width - 2, Height - 2));
  291.                
  292.  
  293.                 if (FindForm().ShowIcon==true)
  294.                 {
  295.                     G.DrawIcon(FindForm().Icon, new Rectangle(5, 13, 20, 20));
  296.                     switch (TitleTextPostion)
  297.                     {
  298.                         case TitlePostion.Left:
  299.                             G.DrawString(Text, Font, Brushes.White, 27, 10);
  300.                             break;
  301.                         case TitlePostion.Center:
  302.                             HelperMethods.CentreString(G, Text, Font, Brushes.White, new Rectangle(0, 0, Width, 50));
  303.                             break;
  304.                     }
  305.                 }
  306.                 else
  307.                 {
  308.                     switch (TitleTextPostion)
  309.                     {
  310.                         case TitlePostion.Left:
  311.                             G.DrawString(Text, Font, Brushes.White, 5, 10);
  312.                             break;
  313.                         case TitlePostion.Center:
  314.                             HelperMethods.CentreString(G, Text, Font, Brushes.White, new Rectangle(0, 0, Width, 50));
  315.                             break;
  316.                     }
  317.                 }
  318.  
  319.  
  320.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  321.                 G.Dispose();
  322.                 B.Dispose();
  323.  
  324.             }
  325.  
  326.         }
  327.  
  328.         #endregion
  329.  
  330.     }
  331.  
  332.     #endregion
  333.  
  334.     #region TabControl
  335.  
  336.     public class EtherealTabControl : TabControl
  337.     {
  338.  
  339.         #region  Variables
  340.  
  341.         private MouseState State;
  342.         private Color _TabsColor = HelperMethods.GetHTMLColor("432e58");
  343.         private Color _SeletedTabTriangleColor = Color.White;
  344.         private Color _LeftColor = HelperMethods.GetHTMLColor("4e3a62");
  345.         private Color _RightColor = Color.White;
  346.         private Color _LineColor = HelperMethods.GetHTMLColor("3b2551");
  347.         private Color _NoneSelectedTabColors = HelperMethods.GetHTMLColor("432e58");
  348.         private Color _HoverColor = HelperMethods.GetHTMLColor("3b2551");
  349.         private Color _TextColor = Color.White;
  350.         private Color _TabPageColor = Color.White;
  351.  
  352.         #endregion
  353.  
  354.         #region  Stractures
  355.  
  356.         public struct MouseState
  357.         {
  358.             public bool Hover;
  359.             public Point Coordinates;
  360.         };
  361.  
  362.         #endregion
  363.  
  364.         #region  Initialization
  365.  
  366.         public EtherealTabControl()
  367.         {
  368.  
  369.             SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor, true);
  370.             DoubleBuffered = true;
  371.             SizeMode = TabSizeMode.Fixed;
  372.             Dock = DockStyle.None;
  373.             ItemSize = new Size(40, 150);
  374.             Alignment = TabAlignment.Left;
  375.            
  376.         }
  377.  
  378.         #endregion
  379.  
  380.         #region Properties
  381.  
  382.         public Color TabsColor
  383.         {
  384.             get
  385.             {
  386.                 return _TabsColor;
  387.             }
  388.             set
  389.             {
  390.                 _TabsColor = value;
  391.                 Invalidate();
  392.             }
  393.         }
  394.  
  395.         public Color SeletedTabTriangleColor
  396.         {
  397.             get
  398.             {
  399.                 return _SeletedTabTriangleColor;
  400.             }
  401.             set
  402.             {
  403.                 _SeletedTabTriangleColor = value;
  404.                 Invalidate();
  405.             }
  406.         }
  407.  
  408.         public Color LeftColor
  409.         {
  410.             get
  411.             {
  412.                 return _LeftColor;
  413.             }
  414.             set
  415.             {
  416.                 _LeftColor = value;
  417.                 Invalidate();
  418.             }
  419.         }
  420.  
  421.         public Color RightColor
  422.         {
  423.             get
  424.             {
  425.                 return _RightColor;
  426.             }
  427.             set
  428.             {
  429.                 _RightColor = value;
  430.                 Invalidate();
  431.             }
  432.         }
  433.  
  434.         public Color LineColor
  435.         {
  436.             get
  437.             {
  438.                 return _LineColor;
  439.             }
  440.             set
  441.             {
  442.                 _LineColor = value;
  443.                 Invalidate();
  444.             }
  445.         }
  446.  
  447.         public Color NoneSelectedTabColors
  448.         {
  449.             get
  450.             {
  451.                 return _NoneSelectedTabColors;
  452.             }
  453.             set
  454.             {
  455.                 _NoneSelectedTabColors = value;
  456.                 Invalidate();
  457.             }
  458.         }
  459.  
  460.         public Color HoverColor
  461.         {
  462.             get
  463.             {
  464.                 return _HoverColor;
  465.             }
  466.             set
  467.             {
  468.                 _HoverColor = value;
  469.                 Invalidate();
  470.             }
  471.         }
  472.  
  473.         public Color TextColor
  474.         {
  475.             get
  476.             {
  477.                 return _TextColor;
  478.             }
  479.             set
  480.             {
  481.                 _TextColor = value;
  482.                 Invalidate();
  483.             }
  484.         }
  485.  
  486.         public Color TabPageColor
  487.         {
  488.             get
  489.             {
  490.                 return _TabPageColor;
  491.             }
  492.             set
  493.             {
  494.                 _TabPageColor = value;
  495.                 Invalidate();
  496.             }
  497.         }
  498.  
  499.         #endregion
  500.  
  501.         #region  Events
  502.  
  503.         protected override void OnMouseEnter(EventArgs e)
  504.         {
  505.             State.Hover = true;
  506.             base.OnMouseEnter(e);
  507.         }
  508.  
  509.         protected override void OnMouseLeave(EventArgs e)
  510.         {
  511.             State.Hover = false;
  512.             foreach (TabPage Tab in base.TabPages)
  513.             {
  514.                 if (Tab.DisplayRectangle.Contains(State.Coordinates))
  515.                 {
  516.                     base.Invalidate();
  517.                     break;
  518.                 }
  519.  
  520.  
  521.             }
  522.             base.OnMouseLeave(e);
  523.         }
  524.  
  525.         protected override void OnMouseMove(MouseEventArgs e)
  526.         {
  527.             State.Coordinates = e.Location;
  528.             foreach (TabPage Tab in base.TabPages)
  529.             {
  530.                 if (Tab.DisplayRectangle.Contains(e.Location))
  531.                 {
  532.                     base.Invalidate();
  533.                     break;
  534.                 }
  535.  
  536.             }
  537.             base.OnMouseMove(e);
  538.         }
  539.  
  540.         protected override void OnCreateControl()
  541.         {
  542.             base.OnCreateControl();
  543.             foreach(TabPage T in TabPages)
  544.             {
  545.                 T.BackColor = TabPageColor;
  546.             }
  547.         }
  548.  
  549.         #endregion
  550.  
  551.         #region  DrawControl
  552.  
  553.         protected override void OnPaint(PaintEventArgs e)
  554.         {
  555.             Bitmap B = new Bitmap(Width, Height);
  556.             using (Graphics G = Graphics.FromImage(B))
  557.             {
  558.  
  559.                 G.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
  560.  
  561.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  562.  
  563.                 HelperMethods.FillRect(G, new SolidBrush(LeftColor), new Rectangle(0, 1, 150, Height));
  564.            
  565.                 for (int i = 0; i <= TabPages.Count - 1; i++)
  566.                 {
  567.                     Rectangle R = GetTabRect(i);
  568.                     HelperMethods.FillRect(G, new SolidBrush(NoneSelectedTabColors), new Rectangle(R.X - 1, R.Y - 1, R.Width - 3, R.Height));
  569.                     if (i == SelectedIndex)
  570.                     {
  571.                         G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  572.                         Point P1 = new Point(ItemSize.Height - 12, R.Location.Y + 20);
  573.                         Point P2 = new Point(ItemSize.Height + 2, R.Location.Y + 10);
  574.                         Point P3 = new Point(ItemSize.Height + 2, R.Location.Y + 30);
  575.                         G.FillPolygon(new SolidBrush(SeletedTabTriangleColor), new Point[] { P1, P2, P3 });
  576.  
  577.                     }
  578.                     else
  579.                     {
  580.                         if (State.Hover & R.Contains(State.Coordinates))
  581.                         {
  582.                             Cursor = Cursors.Hand;
  583.  
  584.                             HelperMethods.FillRect(G, new SolidBrush(HoverColor), new Rectangle(R.X, R.Y, R.Width - 3, R.Height));
  585.                          
  586.                         }
  587.                        
  588.                     }
  589.  
  590.                     G.DrawString(TabPages[i].Text, new Font("Segoe UI", 8, FontStyle.Bold), new SolidBrush(TextColor), R.X + 28, R.Y + 13);
  591.  
  592.  
  593.                     if (!(ImageList == null))
  594.                     { G.DrawImage(ImageList.Images[i], new Rectangle(R.X + 6, R.Y + 11, 16, 16)); }
  595.  
  596.                     G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
  597.  
  598.                     G.DrawLine(new Pen(LineColor, 1), new Point(R.X - 1, R.Bottom - 2), new Point(R.Width - 2, R.Bottom - 2));
  599.  
  600.                 }
  601.                 G.FillRectangle(new SolidBrush(RightColor), new Rectangle(150, Convert.ToInt32(1.3), Width, Height - 2));
  602.                 G.DrawRectangle(new Pen(LineColor, 1), new Rectangle(0, 0, Width - 1, Height - 1));
  603.  
  604.                 e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  605.                 G.Dispose();
  606.                 B.Dispose();
  607.  
  608.             }
  609.         }
  610.  
  611.         #endregion
  612.  
  613.     }
  614.  
  615. #endregion
  616.  
  617.     #region Button
  618.  
  619.     public class EtherealButton : Control
  620.     {
  621.         #region   Variables
  622.  
  623.     private HelperMethods.MouseMode State;
  624.     private Style _ButtonStyle ;
  625.     private Color NoneColor = HelperMethods.GetHTMLColor("222222");
  626.     private int _RoundRadius = 5;
  627.  
  628.        #endregion
  629.  
  630.         #region  Properties
  631.  
  632.         public int RoundRadius
  633.         {
  634.             get
  635.             {
  636.             return _RoundRadius;  
  637.             }
  638.             set
  639.             {
  640.             _RoundRadius=value;
  641.             Invalidate();
  642.             }
  643.         }
  644.  
  645.         public Style ButtonStyle
  646.         {
  647.             get
  648.             {
  649.                 return _ButtonStyle;
  650.             }
  651.             set
  652.             {
  653.                 _ButtonStyle = value;
  654.                 Invalidate();
  655.             }
  656.         }
  657.  
  658.          #endregion
  659.  
  660.         #region  Initialization
  661.  
  662.     public EtherealButton()
  663.     {
  664.         SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint |
  665.         ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
  666.         ControlStyles.Selectable | ControlStyles.SupportsTransparentBackColor, true);
  667.         DoubleBuffered = true;
  668.         BackColor = Color.Transparent;
  669.         Font = new Font("Segoe UI", 9, FontStyle.Bold);
  670.     }
  671.  
  672.        #endregion
  673.  
  674.         #region  Enumerators
  675.  
  676.     public enum Style
  677.     {
  678.         Clear,
  679.         DarkClear,
  680.         SemiBlack,
  681.         DarkPink,
  682.         LightPink
  683.     };
  684.  
  685.         #endregion
  686.  
  687.         #region  Events
  688.  
  689.     protected override void OnMouseEnter(EventArgs e)
  690.     {
  691.  
  692.         base.OnMouseEnter(e);
  693.         State = HelperMethods.MouseMode.Hovered;
  694.         Invalidate();
  695.     }
  696.  
  697.     protected override void OnMouseUp(MouseEventArgs e)
  698.     {
  699.  
  700.         base.OnMouseUp(e);
  701.         State = HelperMethods.MouseMode.Hovered;
  702.         Invalidate();
  703.     }
  704.  
  705.     protected override void OnMouseDown(MouseEventArgs e)
  706.     {
  707.  
  708.         base.OnMouseDown(e);
  709.         State = HelperMethods.MouseMode.Pushed;
  710.         Invalidate();
  711.     }
  712.  
  713.     protected override void OnMouseLeave(EventArgs e)
  714.     {
  715.  
  716.         base.OnMouseLeave(e);
  717.         State = HelperMethods.MouseMode.NormalMode;
  718.         Invalidate();
  719.     }
  720.  
  721.     #endregion
  722.  
  723.         #region  Draw Control
  724.  
  725.      protected override void OnPaint(PaintEventArgs e)
  726.         {
  727.             Bitmap B = new Bitmap(Width, Height);
  728.             using (Graphics G = Graphics.FromImage(B))
  729.             {
  730. Rectangle Rect=new Rectangle(0, 0, Width - 1, Height - 1);
  731. System.Drawing.Drawing2D.GraphicsPath GP = HelperMethods.RoundRec(Rect, RoundRadius);
  732.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  733.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  734.  
  735.                 switch(State)
  736.                 {
  737.                     case HelperMethods.MouseMode.NormalMode:
  738.                         switch(ButtonStyle)
  739.                         {
  740.                             case Style.Clear:
  741.                                 NoneColor = HelperMethods.GetHTMLColor("ececec");
  742.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius);
  743.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("b9b9b9"), Rect);
  744.                                 break;
  745.                             case Style.DarkClear:
  746.                                 NoneColor = HelperMethods.GetHTMLColor("444444");
  747.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius);
  748.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("444444"), Rect);
  749.                                 break;
  750.                             case Style.SemiBlack:
  751.                                 HelperMethods.FillRoundedPath(G, NoneColor, Rect, RoundRadius);
  752.                                 HelperMethods.DrawRoundedPath(G, HelperMethods.GetHTMLColor("121212"), 1, Rect, RoundRadius);
  753.                                 HelperMethods.CentreString(G, Text, Font, Brushes.White, Rect);
  754.                                 break;
  755.                             case Style.DarkPink:
  756.                                 NoneColor = HelperMethods.GetHTMLColor("3b2551");
  757.                                 HelperMethods.FillRoundedPath(G, NoneColor, Rect, RoundRadius);
  758.                                 HelperMethods.DrawRoundedPath(G, HelperMethods.GetHTMLColor("6d5980"), 1, Rect, RoundRadius);
  759.                                 HelperMethods.CentreString(G, Text, Font, Brushes.White, Rect);
  760.                                 break;
  761.                             case Style.LightPink:
  762.                                 NoneColor = HelperMethods.GetHTMLColor("9d92a8");
  763.                                 HelperMethods.FillRoundedPath(G, NoneColor, Rect, RoundRadius);
  764.                                 HelperMethods.DrawRoundedPath(G, HelperMethods.GetHTMLColor("573d71"), 1, Rect, RoundRadius);
  765.                                 HelperMethods.CentreString(G, Text, Font, Brushes.White, Rect);
  766.                                 break;
  767.                 }
  768.                         break;
  769.                     case HelperMethods.MouseMode.Hovered:
  770.                         NoneColor = HelperMethods.GetHTMLColor("444444");
  771.                            switch(ButtonStyle)
  772.                         {
  773.                                case Style.Clear:
  774.                                 NoneColor = HelperMethods.GetHTMLColor("444444");
  775.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius);
  776.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("444444"), Rect);
  777.                                 break;
  778.                                case Style.DarkClear:
  779.                                 NoneColor = HelperMethods.GetHTMLColor("ececec");
  780.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius);
  781.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("b9b9b9"), Rect);
  782.                                 break;
  783.                                case Style.SemiBlack:
  784.                                 NoneColor = HelperMethods.GetHTMLColor("444444");
  785.                                      HelperMethods.FillRect(G, new SolidBrush(Color.Transparent), Rect);
  786.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius);
  787.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("444444"), Rect);
  788.                                 break;
  789.                                case Style.DarkPink:
  790.                                 NoneColor = HelperMethods.GetHTMLColor("444444");
  791.                                 HelperMethods.FillRect(G, new SolidBrush(Color.Transparent), Rect);
  792.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius);
  793.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("444444"), Rect);
  794.                                 break;
  795.                                case Style.LightPink:
  796.                                 NoneColor = HelperMethods.GetHTMLColor("9d92a8");
  797.                                 HelperMethods.FillRect(G, new SolidBrush(Color.Transparent), Rect);
  798.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius);
  799.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("444444"), Rect);
  800.                                 break;
  801.                            }
  802.                            break;
  803.                     case HelperMethods.MouseMode.Pushed:
  804.                            switch(ButtonStyle)
  805.                         {
  806.                                case Style.Clear: case Style.DarkClear:
  807.                                 NoneColor = HelperMethods.GetHTMLColor("444444");
  808.                                 HelperMethods.FillRect(G, new SolidBrush(Color.Transparent), Rect);
  809.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, 5);
  810.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("444444"), Rect);
  811.                                 break;
  812.                                case Style.DarkPink: case Style.LightPink: case Style.SemiBlack:
  813.                                 NoneColor = HelperMethods.GetHTMLColor("ececec");
  814.                                 HelperMethods.DrawRoundedPath(G, NoneColor, 1, Rect, 5);
  815.                                 HelperMethods.CentreString(G, Text, Font, HelperMethods.SolidBrushHTMlColor("b9b9b9"), Rect);
  816.                                 break;
  817.                       }
  818.                            break;
  819.             }
  820.  
  821.             e.Graphics.DrawImage(B, 0, 0);
  822.             G.Dispose() ;
  823.             B.Dispose();
  824.     }
  825.         }
  826.  
  827. #endregion
  828.  
  829.     }
  830.  
  831. #endregion
  832.  
  833.     #region CheckBox
  834.  
  835.     [System.ComponentModel.DefaultEvent("CheckedChanged")]
  836.     public class EtherealCheckBox : Control
  837.     {
  838.  
  839.         #region Variables
  840.  
  841.         static bool _Checked;
  842.         public event CheckedChangedEventHandler CheckedChanged;
  843.         public delegate void CheckedChangedEventHandler(object sender);
  844.         private Color _CheckColor = HelperMethods.GetHTMLColor("746188");
  845.         private Color _BorderColor = HelperMethods.GetHTMLColor("746188");
  846.  
  847.         #endregion
  848.  
  849.         #region Properties
  850.  
  851.         public bool Checked
  852.         {
  853.             get
  854.             {
  855.                 return _Checked;
  856.             }
  857.             set
  858.             {
  859.                 _Checked = value;
  860.                 Invalidate();
  861.             }
  862.         }
  863.  
  864.         public Color CheckColor
  865.         {
  866.             get
  867.             {
  868.                 return _CheckColor;
  869.             }
  870.             set
  871.             {
  872.                 _CheckColor = value;
  873.                 Invalidate();
  874.             }
  875.         }
  876.  
  877.         public Color BorderColor
  878.         {
  879.             get
  880.             {
  881.                 return _BorderColor;
  882.             }
  883.             set
  884.             {
  885.                 _BorderColor = value;
  886.                 Invalidate();
  887.             }
  888.         }
  889.  
  890.         #endregion
  891.  
  892.         #region Initialization
  893.  
  894.         public EtherealCheckBox()
  895.         {
  896.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
  897.                      ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer
  898.                      | ControlStyles.SupportsTransparentBackColor, true);
  899.             DoubleBuffered = true;
  900.             //UpdateStyles();
  901.             Cursor = Cursors.Hand;
  902.             Size = new Size(200, 20);
  903.             Font = new Font("Proxima Nova", 11, FontStyle.Regular);
  904.             BackColor = Color.Transparent;
  905.         }
  906.  
  907.         #endregion
  908.  
  909.         #region DrawControl
  910.  
  911.         protected override void OnPaint(PaintEventArgs e)
  912.         {
  913.             Bitmap B = new Bitmap(Width, Height);
  914.             using (Graphics G = Graphics.FromImage(B))
  915.             {
  916.  
  917.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  918.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  919.                 HelperMethods.DrawRoundedPath(G, BorderColor, 3, new Rectangle(1, 1, 16, 16), 3);
  920.                 if (Checked)
  921.                 {
  922.                     HelperMethods.FillRoundedPath(G, CheckColor, new Rectangle(5, 5, (int)8.5, (int)8.5), 1);
  923.                                        
  924.                 }
  925.                 G.DrawString(Text, Font, Brushes.Gray, new Rectangle(22,Convert.ToInt32(-1.2), Width, Height - 2));
  926.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  927.                 G.Dispose();
  928.                 B.Dispose();
  929.             }
  930.  
  931.  
  932.         }
  933.  
  934.         #endregion
  935.  
  936.         #region  Events
  937.        
  938.           protected override void OnResize(EventArgs e)
  939.         {
  940.             Height = 20;
  941.            
  942.             base.OnResize(e);
  943.             Invalidate();
  944.         }
  945.  
  946.         protected override void OnClick(EventArgs e)
  947.         {
  948.             _Checked = !_Checked;
  949.             if (CheckedChanged != null)
  950.             {
  951.                 CheckedChanged(this);
  952.             }
  953.             base.OnClick(e);
  954.             Invalidate();
  955.         }
  956.  
  957.         #endregion
  958.  
  959.     }
  960.  
  961.     #endregion
  962.  
  963.     #region Textbox
  964.     [System.ComponentModel.DefaultEvent("TextChanged")]
  965.     public class EtherealTextbox : Control
  966.     {
  967.        
  968.         #region Variables
  969.  
  970.         private TextBox T = new TextBox();
  971.         private HorizontalAlignment _TextAlign = HorizontalAlignment.Left;
  972.         private int _MaxLength = 32767;
  973.         private bool _ReadOnly;
  974.         private bool _UseSystemPasswordChar = false;
  975.         private string _WatermarkText = "";
  976.         private Image _SideImage;
  977.         private bool _Multiline = false;
  978.         protected HelperMethods.MouseMode State = HelperMethods.MouseMode.NormalMode;
  979.         private Color _ForeColor = Color.Gray;
  980.         private Color _BackColor = Color.White;
  981.         private Color _BorderColor = HelperMethods.GetHTMLColor("ececec");
  982.  
  983.         #endregion
  984.  
  985.         #region  Native Methods
  986.         [System.Runtime.InteropServices.DllImport("user32.dll")]
  987.         private static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
  988. string lParam);
  989.  
  990.         #endregion
  991.  
  992.         #region Initialization
  993.  
  994.         public EtherealTextbox()
  995.         {
  996.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
  997.                     ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer |
  998.                     ControlStyles.SupportsTransparentBackColor, true);
  999.             DoubleBuffered = true;
  1000.             UpdateStyles();
  1001.  
  1002.             Font = new Font("Segoe UI", 10, FontStyle.Regular);
  1003.             Text = WatermarkText;
  1004.             Size = new Size(135, 30);
  1005.  
  1006.             T.Multiline = _Multiline;
  1007.             T.Cursor = Cursors.IBeam;
  1008.             T.BackColor = Color.White;
  1009.             T.ForeColor = Color.Gray;
  1010.             T.Text = WatermarkText;
  1011.             T.BorderStyle = BorderStyle.None;
  1012.             T.Location = new Point(7, 7);
  1013.             T.Font = Font;
  1014.             T.Size = new Size(Width - 10, 30);
  1015.             T.UseSystemPasswordChar = _UseSystemPasswordChar;
  1016.             T.TextChanged += T_TextChanged;
  1017.             T.KeyDown += T_KeyDown;
  1018.         }
  1019.  
  1020.         #endregion
  1021.  
  1022.         #region Properties
  1023.  
  1024.         [System.ComponentModel.Browsable(false), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never), System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  1025.         public BorderStyle BorderStyle
  1026.         {
  1027.             get
  1028.             {
  1029.                 return BorderStyle.None;
  1030.             }
  1031.         }
  1032.  
  1033.         [System.ComponentModel.Browsable(false), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never), System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  1034.         public bool Multiline
  1035.         {
  1036.             get
  1037.             {
  1038.                 return _Multiline;
  1039.             }
  1040.             set
  1041.             {
  1042.                 _Multiline = value;
  1043.                 if (T != null)
  1044.                 {
  1045.                     T.Multiline = value;
  1046.                 }
  1047.  
  1048.             }
  1049.         }
  1050.  
  1051.         public HorizontalAlignment TextAlign
  1052.         {
  1053.             get
  1054.             {
  1055.                 return _TextAlign;
  1056.             }
  1057.             set
  1058.             {
  1059.                 _TextAlign = value;
  1060.                 if (T != null)
  1061.                 {
  1062.                     T.TextAlign = value;
  1063.                 }
  1064.             }
  1065.         }
  1066.  
  1067.         public int MaxLength
  1068.         {
  1069.             get
  1070.             {
  1071.                 return _MaxLength;
  1072.             }
  1073.             set
  1074.             {
  1075.                 _MaxLength = value;
  1076.                 if (T != null)
  1077.                 {
  1078.                     T.MaxLength = value;
  1079.                 }
  1080.             }
  1081.         }
  1082.  
  1083.         public bool ReadOnly
  1084.         {
  1085.             get
  1086.             {
  1087.                 return _ReadOnly;
  1088.             }
  1089.             set
  1090.             {
  1091.                 _ReadOnly = value;
  1092.                 if (T != null)
  1093.                 {
  1094.                     T.ReadOnly = value;
  1095.                 }
  1096.             }
  1097.         }
  1098.  
  1099.         public bool UseSystemPasswordChar
  1100.         {
  1101.             get
  1102.             {
  1103.                 return _UseSystemPasswordChar;
  1104.             }
  1105.             set
  1106.             {
  1107.                 _UseSystemPasswordChar = value;
  1108.                 if (T != null)
  1109.                 {
  1110.                     T.UseSystemPasswordChar = value;
  1111.                 }
  1112.             }
  1113.         }
  1114.  
  1115.         public string WatermarkText
  1116.         {
  1117.             get
  1118.             {
  1119.                 return _WatermarkText;
  1120.             }
  1121.             set
  1122.             {
  1123.                 _WatermarkText = value;
  1124.                 SendMessage(T.Handle, 0x1501, 0, value);
  1125.                 Invalidate();
  1126.             }
  1127.         }
  1128.  
  1129.         public Image SideImage
  1130.         {
  1131.             get
  1132.             {
  1133.                 return _SideImage;
  1134.             }
  1135.             set
  1136.             {
  1137.                 _SideImage = value;
  1138.                 Invalidate();
  1139.             }
  1140.         }
  1141.  
  1142.         [System.ComponentModel.Browsable(false)]
  1143.         public override Image BackgroundImage
  1144.         {
  1145.             get
  1146.             {
  1147.                 return base.BackgroundImage;
  1148.             }
  1149.             set
  1150.             {
  1151.                 base.BackgroundImage = value;
  1152.             }
  1153.         }
  1154.  
  1155.         [System.ComponentModel.Browsable(false)]
  1156.         public override ImageLayout BackgroundImageLayout
  1157.         {
  1158.             get
  1159.             {
  1160.                 return base.BackgroundImageLayout;
  1161.             }
  1162.             set
  1163.             {
  1164.                 base.BackgroundImageLayout = value;
  1165.             }
  1166.         }
  1167.  
  1168.         public override string Text
  1169.         {
  1170.             get
  1171.             {
  1172.                 return base.Text;
  1173.             }
  1174.             set
  1175.             {
  1176.                 base.Text = value;
  1177.             }
  1178.         }
  1179.  
  1180.        override public Color BackColor
  1181.         {
  1182.             get
  1183.             {
  1184.                 return _BackColor;
  1185.             }
  1186.             set
  1187.             {
  1188.                 base.BackColor = value;
  1189.                 T.BackColor = value;
  1190.                 _BackColor = value;
  1191.                 Invalidate();
  1192.             }
  1193.         }
  1194.  
  1195.        override public Color ForeColor
  1196.         {
  1197.             get
  1198.             {
  1199.                 return _ForeColor;
  1200.             }
  1201.             set
  1202.             {
  1203.                 base.ForeColor = value;
  1204.                 T.ForeColor = value;
  1205.                 _ForeColor = value;
  1206.                 Invalidate();
  1207.             }
  1208.         }
  1209.  
  1210.         public Color BorderColor
  1211.         {
  1212.             get
  1213.             {
  1214.                 return _BorderColor;
  1215.             }
  1216.             set
  1217.             {
  1218.                 _BorderColor = value;
  1219.                 Invalidate();
  1220.             }
  1221.         }
  1222.  
  1223.        
  1224.  
  1225.         #endregion
  1226.  
  1227.         #region DrawControl
  1228.  
  1229.         protected override void OnPaint(PaintEventArgs e)
  1230.         {
  1231.             base.OnPaint(e);
  1232.             Rectangle Rect = new Rectangle(0, 0, Width - 1, Height - 1);
  1233.             Bitmap B = new Bitmap(Width, Height);
  1234.             using (Graphics G = Graphics.FromImage(B))
  1235.             {
  1236.  
  1237.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  1238.                 G.Clear(BackColor);                
  1239.                HelperMethods.DrawRoundedPath(G, BorderColor, (int)1.8, new Rectangle(0, 0, Width - 1, Height - 1), 4);
  1240.                 if (SideImage != null)
  1241.                 {
  1242.                     T.Location = new Point(45, 5);
  1243.                     T.Width = Width - 60;
  1244.                     G.DrawRectangle(new Pen(BorderColor, 1), new Rectangle(-1, -1, 35, Height + 1));
  1245.                     G.DrawImage(SideImage, new Rectangle(8, 7, 16, 16));
  1246.                 }
  1247.                 else
  1248.                 {
  1249.                     T.Location = new Point(7, 5);
  1250.                     T.Width = Width - 10;
  1251.                 }
  1252.  
  1253.                 if (ContextMenuStrip != null) { T.ContextMenuStrip = ContextMenuStrip; }
  1254.  
  1255.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  1256.                 G.Dispose();
  1257.                 B.Dispose();
  1258.             }
  1259.  
  1260.         }
  1261.  
  1262.         #endregion
  1263.  
  1264.         #region Events
  1265.  
  1266.         private void T_MouseHover(object sender, EventArgs e)
  1267.         {
  1268.             State = HelperMethods.MouseMode.Hovered;
  1269.  
  1270.         }
  1271.  
  1272.         private void T_MouseLeave(object sender, EventArgs e)
  1273.         {
  1274.             State = HelperMethods.MouseMode.NormalMode;
  1275.  
  1276.         }
  1277.  
  1278.         private void T_MouseUp(object sender, EventArgs e)
  1279.         {
  1280.             State = HelperMethods.MouseMode.Pushed;
  1281.  
  1282.         }
  1283.  
  1284.         private void T_MouseEnter(object sender, EventArgs e)
  1285.         {
  1286.             State = HelperMethods.MouseMode.Pushed;
  1287.  
  1288.         }
  1289.  
  1290.         private void T_MouseDown(object sender, EventArgs e)
  1291.         {
  1292.             State = HelperMethods.MouseMode.Pushed;
  1293.  
  1294.         }
  1295.  
  1296.         private void T_TextChanged(object sender, EventArgs e)
  1297.         {
  1298.             Text = T.Text;
  1299.         }
  1300.  
  1301.         protected override void OnTextChanged(EventArgs e)
  1302.         {
  1303.             base.OnTextChanged(e);
  1304.             T.Text = Text;
  1305.         }
  1306.  
  1307.         private void T_KeyDown(object sender, KeyEventArgs e)
  1308.         {
  1309.             if (e.Control && e.KeyCode == Keys.A) { e.SuppressKeyPress = true; }
  1310.             if (e.Control && e.KeyCode == Keys.C)
  1311.             {
  1312.                 T.Copy();
  1313.                 e.SuppressKeyPress = true;
  1314.             }
  1315.         }
  1316.  
  1317.         protected override void OnCreateControl()
  1318.         {
  1319.             base.OnCreateControl();
  1320.             if (!Controls.Contains(T))
  1321.                 Controls.Add(T);
  1322.             if (T.Text == "" && WatermarkText != "")
  1323.  
  1324.                 T.Text = WatermarkText;
  1325.  
  1326.         }
  1327.  
  1328.         protected override void OnResize(EventArgs e)
  1329.         {
  1330.             base.OnResize(e);
  1331.             if (_Multiline == false)
  1332.                 Height = 30;
  1333.         }
  1334.  
  1335.         #endregion
  1336.  
  1337.  
  1338.     }
  1339.  
  1340.     #endregion
  1341.  
  1342.     #region RadioButton
  1343.  
  1344.     [System.ComponentModel.DefaultEvent("CheckedChanged")]
  1345.     public class EtherealRadioButton : Control
  1346.     {
  1347.  
  1348.         #region Variables
  1349.  
  1350.         private bool _Checked;
  1351.         private int _Group = 1;
  1352.         public event CheckedChangedEventHandler CheckedChanged;
  1353.         public delegate void CheckedChangedEventHandler(object sender);
  1354.         private Color _CheckColor = HelperMethods.GetHTMLColor("746188");
  1355.         private Color _BorderColor = HelperMethods.GetHTMLColor("746188");
  1356.  
  1357.         #endregion
  1358.  
  1359.         #region Properties
  1360.  
  1361.         public bool Checked
  1362.         {
  1363.             get
  1364.             { return _Checked;
  1365.             }
  1366.             set
  1367.             {
  1368.                 _Checked = value;
  1369.                 UpdateCheckState();
  1370.                 Invalidate();
  1371.             }
  1372.         }
  1373.        
  1374.         public int Group
  1375.         {
  1376.             get
  1377.             {
  1378.                 return _Group;
  1379.             }
  1380.             set
  1381.             {
  1382.                 _Group = value;
  1383.             }
  1384.         }
  1385.  
  1386.  
  1387.         public Color CheckColor
  1388.         {
  1389.             get
  1390.             {
  1391.                 return _CheckColor;
  1392.             }
  1393.             set
  1394.             {
  1395.                 _CheckColor = value;
  1396.                 Invalidate();
  1397.             }
  1398.         }
  1399.  
  1400.         public Color BorderColor
  1401.         {
  1402.             get
  1403.             {
  1404.                 return _BorderColor;
  1405.             }
  1406.             set
  1407.             {
  1408.                 _BorderColor = value;
  1409.                 Invalidate();
  1410.             }
  1411.         }
  1412.  
  1413.  
  1414.         #endregion
  1415.  
  1416.         #region Initialization
  1417.  
  1418.         public EtherealRadioButton()
  1419.         {
  1420.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
  1421.                       ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor , true);
  1422.             DoubleBuffered = true;
  1423.             UpdateStyles();
  1424.             Cursor = Cursors.Hand;
  1425.             Font = new Font("Proxima Nova", 11, FontStyle.Regular);
  1426.         }
  1427.  
  1428.         #endregion
  1429.  
  1430.         #region DrawControl
  1431.  
  1432.         protected override void OnPaint(PaintEventArgs e)
  1433.         {
  1434.             Bitmap B = new Bitmap(Width, Height);
  1435.             using (Graphics G = Graphics.FromImage(B))
  1436.             {
  1437.  
  1438.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  1439.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  1440.                 G.DrawEllipse(new Pen(BorderColor, Convert.ToInt32(2.5)), 1, 1, 18, 18);
  1441.              
  1442.                 if (Checked)
  1443.                 {
  1444.                    G.FillEllipse(new SolidBrush(CheckColor), new Rectangle(5, 5, 10, 10));
  1445.                    
  1446.                 }
  1447.                 G.DrawString(Text, Font, Brushes.Gray, new Rectangle(23,Convert.ToInt32(-0.3), Width, Height));
  1448.                 e.Graphics.DrawImage(B, 0, 0);
  1449.                 G.Dispose();
  1450.                 B.Dispose();
  1451.             }
  1452.  
  1453.  
  1454.         }
  1455.  
  1456.         #endregion
  1457.  
  1458.         #region  Events
  1459.  
  1460.         protected override void OnTextChanged(EventArgs e)
  1461.         {
  1462.             base.OnTextChanged(e);
  1463.             Invalidate();
  1464.         }
  1465.         protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  1466.         {
  1467.             if (!_Checked)
  1468.                 Checked = true;
  1469.             base.OnMouseDown(e);
  1470.         }
  1471.         protected override void OnResize(EventArgs e)
  1472.         {
  1473.             Height = 21;
  1474.             Invalidate();
  1475.             base.OnResize(e);
  1476.         }
  1477.  
  1478.         private void UpdateCheckState()
  1479.         {
  1480.             if (!IsHandleCreated || !_Checked)
  1481.                 return;
  1482.  
  1483.             foreach (Control C in Parent.Controls)
  1484.             {
  1485.                 if (!object.ReferenceEquals(C, this) && C is EtherealRadioButton && ((EtherealRadioButton)C).Group == _Group)
  1486.                 {
  1487.                     ((EtherealRadioButton)C).Checked = false;
  1488.                 }
  1489.             }
  1490.             if (CheckedChanged != null)
  1491.             {
  1492.                 CheckedChanged(this);
  1493.             }
  1494.         }
  1495.      
  1496.         protected override void OnCreateControl()
  1497.         {
  1498.            
  1499.             base.OnCreateControl();
  1500.  
  1501.         }
  1502.  
  1503.         #endregion
  1504.  
  1505.     }
  1506.  
  1507.  
  1508.     #endregion
  1509.  
  1510.     #region ComboBox
  1511.  
  1512.     public class EtherealComboBox : ComboBox
  1513.     {
  1514.  
  1515.         #region Variables
  1516.  
  1517.         private int _StartIndex = 0;
  1518.         private Color _BorderColor = HelperMethods.GetHTMLColor("ececec");
  1519.         private Color _TextColor = HelperMethods.GetHTMLColor("b8c6d6");
  1520.         private Color _TriangleColor = HelperMethods.GetHTMLColor("999999");
  1521.  
  1522.         #endregion
  1523.  
  1524.         #region Initialization
  1525.  
  1526.         public EtherealComboBox()
  1527.         {
  1528.  
  1529.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
  1530.                   ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  1531.         DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
  1532.         Size = new Size(200, 35);
  1533.         DropDownStyle = ComboBoxStyle.DropDownList;
  1534.         Font = new Font("Segoe UI", 15);
  1535.         BackColor = Color.Transparent;
  1536.         DoubleBuffered = true;
  1537.  
  1538.         }
  1539.  
  1540.         #endregion
  1541.  
  1542.         #region Properties
  1543.  
  1544.         public int StartIndex
  1545.         {
  1546.             get
  1547.             {
  1548.                 return _StartIndex;
  1549.             }
  1550.             set
  1551.             {
  1552.                 _StartIndex = value;
  1553.                 try
  1554.                 {
  1555.                     base.SelectedIndex = value;
  1556.                 }
  1557.                 catch
  1558.                 {
  1559.  
  1560.                 }
  1561.                 Invalidate();
  1562.             }
  1563.         }
  1564.  
  1565.         public Color BorderColor
  1566.         {
  1567.             get
  1568.             {
  1569.                 return _BorderColor;
  1570.             }
  1571.             set
  1572.             {
  1573.                 _BorderColor = value;
  1574.                 Invalidate();
  1575.             }
  1576.         }
  1577.  
  1578.         public Color TextColor
  1579.         {
  1580.             get
  1581.             {
  1582.                 return _TextColor;
  1583.             }
  1584.             set
  1585.             {
  1586.                 _TextColor = value;
  1587.                 Invalidate();
  1588.             }
  1589.         }
  1590.  
  1591.         public Color TriangleColor
  1592.         {
  1593.             get
  1594.             {
  1595.                 return _TriangleColor;
  1596.             }
  1597.             set
  1598.             {
  1599.                 _TriangleColor = value;
  1600.                 Invalidate();
  1601.             }
  1602.         }
  1603.  
  1604.         #endregion
  1605.  
  1606.         #region Draw Control
  1607.  
  1608.         protected override void OnPaint(PaintEventArgs e)
  1609.         {
  1610.             base.OnPaint(e);
  1611.             Bitmap B = new Bitmap(Width, Height);
  1612.             using (Graphics G =Graphics.FromImage(B))
  1613.             {
  1614.                 Rectangle Rect = new Rectangle(1, 1, Width - 2, Height - 2);
  1615.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  1616.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  1617.                 G.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
  1618.                 HelperMethods.DrawTriangle(G, TriangleColor, 2,
  1619.                 new Point(Width - 20, 16), new Point(Width - 16, 20),
  1620.                 new Point(Width - 16, 20), new Point(Width - 12, 16),
  1621.                 new Point(Width - 16, 21), new Point(Width - 16, 20)
  1622.                 );
  1623.                 HelperMethods.DrawRoundedPath(G, BorderColor,(int) 1.5, Rect, 4);
  1624.                 G.DrawString(Text, Font, new SolidBrush(TextColor), new Rectangle(7, 0, Width - 1, Height - 1), new StringFormat {LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Near});
  1625.                
  1626.                 e.Graphics.DrawImage(B, 0, 0);
  1627.                 G.Dispose();
  1628.                 B.Dispose();
  1629.             }
  1630.            
  1631.         }
  1632.  
  1633.         protected override void OnDrawItem(DrawItemEventArgs e)
  1634.         {
  1635.  
  1636.             e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  1637.             e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  1638.                  
  1639.                     if (System.Convert.ToInt32((e.State & DrawItemState.Selected)) == (int)DrawItemState.Selected)
  1640.                     {
  1641.                         if (!(e.Index == -1))
  1642.                         {
  1643.                             e.Graphics.FillRectangle(HelperMethods.SolidBrushHTMlColor("3b2551"), e.Bounds);
  1644.                             e.Graphics.DrawString(GetItemText(Items[e.Index]), e.Font, new SolidBrush(Color.WhiteSmoke), e.Bounds);
  1645.                         }
  1646.                     }
  1647.                     else
  1648.                     {
  1649.                         if (!(e.Index == -1))
  1650.                         {
  1651.                             e.Graphics.FillRectangle(new SolidBrush(e.BackColor), e.Bounds);
  1652.                             e.Graphics.DrawString(GetItemText(Items[e.Index]), e.Font, HelperMethods.SolidBrushHTMlColor("b8c6d6"), e.Bounds);
  1653.                         }
  1654.                     }
  1655.  
  1656.                     Invalidate();
  1657.            
  1658.         }
  1659.  
  1660.         #endregion
  1661.  
  1662.         #region Events
  1663.  
  1664.         protected override void OnCreateControl()
  1665.         {
  1666.             base.OnCreateControl();
  1667.            
  1668.         }
  1669.  
  1670.         protected override void OnResize(EventArgs e)
  1671.         {
  1672.             base.OnResize(e);
  1673.            
  1674.         }
  1675.      
  1676.         #endregion
  1677.  
  1678.     }
  1679.  
  1680.     #endregion
  1681.  
  1682.     #region Switch
  1683.  
  1684.     [System.ComponentModel.DefaultEvent("CheckedChanged")]
  1685.     public class EtherealSwitch : Control
  1686.     {
  1687.  
  1688.         #region Variables
  1689.  
  1690.         protected bool _Switched;
  1691.         protected HelperMethods.MouseMode State = HelperMethods.MouseMode.NormalMode;
  1692.         public event CheckedChangedEventHandler CheckedChanged;
  1693.         public delegate void CheckedChangedEventHandler(object sender);
  1694.         private Color _SwitchColor = HelperMethods.GetHTMLColor("3f2153");
  1695.  
  1696.  
  1697.         #endregion
  1698.  
  1699.         #region Properties
  1700.  
  1701.         protected override void OnTextChanged(EventArgs e)
  1702.         {
  1703.             base.OnTextChanged(e);
  1704.             Invalidate();
  1705.         }
  1706.  
  1707.         public bool Switched
  1708.         {
  1709.             get
  1710.             {
  1711.                 return _Switched;
  1712.             }
  1713.             set
  1714.             {
  1715.                 _Switched = value;
  1716.                 Invalidate();
  1717.             }
  1718.         }
  1719.  
  1720.         public Color SwitchColor
  1721.         {
  1722.             get
  1723.             {
  1724.                 return _SwitchColor;
  1725.             }
  1726.             set
  1727.             {
  1728.                 _SwitchColor = value;
  1729.                 Invalidate();
  1730.             }
  1731.         }
  1732.      
  1733.         #endregion
  1734.  
  1735.         #region Draw Control
  1736.  
  1737.         protected override  void OnPaint(PaintEventArgs e)
  1738.         {
  1739.             Bitmap B = new Bitmap(Width, Height);
  1740.             using (Graphics G =Graphics.FromImage(B))
  1741.             {
  1742.  
  1743.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  1744.  
  1745.                  if (Switched)
  1746.                  {
  1747.                      HelperMethods.FillRoundedPath(G, new SolidBrush(SwitchColor), new Rectangle(1, 1, 42, 22), 22);
  1748.                      HelperMethods.DrawRoundedPath(G, HelperMethods.GetHTMLColor("ededed"),(Single)1.5, new Rectangle(1, 1, 42, 22), 20);
  1749.  
  1750.                      G.FillEllipse(HelperMethods.SolidBrushHTMlColor("fcfcfc"), new Rectangle(22, Convert.ToInt32(2.6), 19, 18));
  1751.                      G.DrawEllipse(HelperMethods.PenHTMlColor("e9e9e9", (Single)1.5), new Rectangle(22,Convert.ToInt32(2.6), 19, 18));
  1752.                  }
  1753.                  else
  1754.                  {
  1755.                      HelperMethods.FillRoundedPath(G, HelperMethods.GetHTMLColor("f8f8f8"), new Rectangle(1, 1, 42, 22), 22);
  1756.                      HelperMethods.DrawRoundedPath(G, HelperMethods.GetHTMLColor("ededed"), (Single)1.5, new Rectangle(1, 1, 42, 22), 20);
  1757.  
  1758.                      G.FillEllipse(HelperMethods.SolidBrushHTMlColor("fcfcfc"), new Rectangle(3, Convert.ToInt32(2.6), 19, 18));
  1759.                      G.DrawEllipse(HelperMethods.PenHTMlColor("e9e9e9", (Single)1.5), new Rectangle(3, Convert.ToInt32(2.6), 19, 18));
  1760.  
  1761.                  }
  1762.                  e.Graphics.DrawImage(B, 0, 0);
  1763.                  G.Dispose();
  1764.                  B.Dispose();
  1765.             }
  1766.         }
  1767.  
  1768.         #endregion
  1769.  
  1770.         #region Initialization
  1771.  
  1772.         public EtherealSwitch()
  1773.         {
  1774.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
  1775.                      ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  1776.             DoubleBuffered = true;
  1777.             Cursor = Cursors.Hand;
  1778.             UpdateStyles();
  1779.         }
  1780.  
  1781.         #endregion
  1782.  
  1783.         #region  Events
  1784.  
  1785.         protected override void OnHandleCreated(EventArgs e)
  1786.         {
  1787.             base.OnHandleCreated(e);
  1788.          
  1789.         }
  1790.  
  1791.         protected override void OnCreateControl()
  1792.         {
  1793.             base.OnCreateControl();
  1794.            
  1795.         }
  1796.  
  1797.         protected override void OnMouseHover(EventArgs e)
  1798.         {
  1799.             base.OnMouseHover(e);
  1800.             State = HelperMethods.MouseMode.Hovered;
  1801.             Invalidate();
  1802.         }
  1803.  
  1804.         protected override void OnMouseLeave(EventArgs e)
  1805.         {
  1806.             base.OnMouseLeave(e);
  1807.             State = HelperMethods.MouseMode.NormalMode;
  1808.             Invalidate();
  1809.         }
  1810.  
  1811.         protected override void OnClick(EventArgs e)
  1812.         {
  1813.             _Switched = !_Switched;
  1814.             if (CheckedChanged != null)
  1815.             {
  1816.                 CheckedChanged(this);
  1817.             }
  1818.             base.OnClick(e);
  1819.             Invalidate();
  1820.         }
  1821.  
  1822.         protected override void OnResize(EventArgs e)
  1823.         {
  1824.             base.OnResize(e);
  1825.             Size = new Size(46, 25);
  1826.         }
  1827.  
  1828.         #endregion
  1829.  
  1830.     }
  1831.  
  1832.     #endregion
  1833.  
  1834.     #region Progress
  1835.  
  1836.     public class EtherealProgressBar : Control
  1837.     {
  1838.  
  1839.         #region Variables
  1840.                
  1841.         private int _Maximum = 100;
  1842.         private int _Value;
  1843.         private int _RoundRadius=8;
  1844.         int CurrentValue;
  1845.         private Color _ProgressColor = HelperMethods.GetHTMLColor("4e3a62");
  1846.         private Color _BaseColor = HelperMethods.GetHTMLColor("f7f7f7");
  1847.         private Color _BorderColor = HelperMethods.GetHTMLColor("ececec");
  1848.         #endregion
  1849.  
  1850.         #region Properties
  1851.  
  1852.         public int Value
  1853.         {
  1854.             get
  1855.             {
  1856.                 if (_Value < 0)
  1857.                 {
  1858.                     return 0;
  1859.                 }
  1860.                 else
  1861.                 {
  1862.                     return _Value;
  1863.                 }
  1864.             }
  1865.             set
  1866.             {
  1867.                 if (value > Maximum)
  1868.                 {
  1869.                     _Value = Maximum;
  1870.                 }
  1871.                 _Value = value;
  1872.                 RenewCurrentValue();
  1873.                 Invalidate();
  1874.                 if (ValueChanged != null)
  1875.                     ValueChanged(this);
  1876.                 Invalidate();
  1877.  
  1878.  
  1879.             }
  1880.         }
  1881.  
  1882.         public int Maximum
  1883.         {
  1884.             get
  1885.             {
  1886.                 return _Maximum;
  1887.  
  1888.             }
  1889.             set
  1890.             {
  1891.                 if (_Maximum < value)
  1892.                 {
  1893.                     _Value = value;
  1894.                 }
  1895.                 _Maximum = value;
  1896.                 Invalidate();
  1897.             }
  1898.         }
  1899.  
  1900.         public int RoundRadius
  1901.         {
  1902.  
  1903.             get
  1904.             {
  1905.                 return _RoundRadius;
  1906.             }
  1907.             set
  1908.             {
  1909.             _RoundRadius = value;
  1910.             Invalidate();
  1911.             }
  1912.         }
  1913.  
  1914.         public Color ProgressColor
  1915.         {
  1916.             get
  1917.             {
  1918.                 return _ProgressColor;
  1919.             }
  1920.             set
  1921.             {
  1922.                 _ProgressColor = value;
  1923.                 Invalidate();
  1924.             }
  1925.         }
  1926.  
  1927.         public Color BaseColor
  1928.         {
  1929.             get
  1930.             {
  1931.                 return _BaseColor;
  1932.             }
  1933.             set
  1934.             {
  1935.                 _BaseColor = value;
  1936.                 Invalidate();
  1937.             }
  1938.         }
  1939.  
  1940.         public Color BorderColor
  1941.         {
  1942.             get
  1943.             {
  1944.                 return _BorderColor;
  1945.             }
  1946.             set
  1947.             {
  1948.                 _BorderColor = value;
  1949.                 Invalidate();
  1950.             }
  1951.         }
  1952.  
  1953.         #endregion
  1954.  
  1955.         #region Draw Control
  1956.  
  1957.         protected override void OnPaint(PaintEventArgs e)
  1958.         {
  1959.             Bitmap B = new Bitmap(Width, Height);
  1960.             using (Graphics G =Graphics.FromImage(B))
  1961.             {
  1962.  
  1963.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  1964.                
  1965.                 Rectangle Rect = new Rectangle(0, 0, Width - 1, Height - 1);
  1966.  
  1967.             HelperMethods.FillRoundedPath(G, new SolidBrush(BaseColor), Rect, RoundRadius);
  1968.             HelperMethods.DrawRoundedPath(G, BorderColor, 1, Rect, RoundRadius);
  1969.  
  1970.             if(CurrentValue != 0)
  1971.             {
  1972.                 HelperMethods.FillRoundedPath(G, ProgressColor, new Rectangle(Rect.X, Rect.Y, CurrentValue, Rect.Height), RoundRadius);
  1973.  
  1974.             }
  1975.                  e.Graphics.DrawImage(B, 0, 0);
  1976.                  G.Dispose();
  1977.                  B.Dispose();
  1978.             }
  1979.         }
  1980.  
  1981.         #endregion
  1982.  
  1983.         #region Initialization
  1984.  
  1985.         public EtherealProgressBar()
  1986.         {
  1987.  
  1988.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw |
  1989.                            ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  1990.             DoubleBuffered = true;
  1991.             BackColor = Color.Transparent;
  1992.             UpdateStyles();
  1993.             CurrentValue = Convert.ToInt32(_Value / _Maximum * Width);
  1994.         }
  1995.  
  1996.         #endregion
  1997.  
  1998.         #region Events
  1999.  
  2000.         public event ValueChangedEventHandler ValueChanged;
  2001.         public delegate void ValueChangedEventHandler(object sender);
  2002.         public void RenewCurrentValue()
  2003.         {
  2004.  
  2005.             CurrentValue = (int)Math.Round((double)(Value) / (double)(Maximum) * (double)(Width));
  2006.         }
  2007.  
  2008.         #endregion
  2009.  
  2010.     }
  2011.  
  2012.     #endregion
  2013.  
  2014.     #region Seperator
  2015.  
  2016.     public class EtherealSeperator : Control
  2017.     {
  2018.  
  2019.         #region Variables
  2020.  
  2021.         private Style _SepStyle = Style.Horizental;
  2022.  
  2023.         #endregion
  2024.  
  2025.         #region Initialization
  2026.  
  2027.         public EtherealSeperator()
  2028.         {
  2029.             SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint |
  2030.             ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
  2031.             ControlStyles.SupportsTransparentBackColor, true);
  2032.             DoubleBuffered = true;
  2033.             UpdateStyles();
  2034.             BackColor = Color.Transparent;
  2035.             ForeColor = HelperMethods.GetHTMLColor("3b2551");
  2036.         }
  2037.  
  2038.         #endregion
  2039.  
  2040.         #region Enumerators
  2041.  
  2042.         public enum Style
  2043.         {
  2044.             Horizental,
  2045.             Vertiacal
  2046.         };
  2047.  
  2048.         #endregion
  2049.  
  2050.         #region Properties
  2051.  
  2052.         public Style SepStyle
  2053.         {
  2054.             get
  2055.             {
  2056.                 return _SepStyle;
  2057.             }
  2058.             set
  2059.             {
  2060.                 _SepStyle = value;
  2061.                 if (value == Style.Horizental)
  2062.                 {
  2063.                     Height = 4;
  2064.                 }
  2065.                 else
  2066.                 {
  2067.                     Width = 4;
  2068.                 }
  2069.                 Invalidate();
  2070.             }
  2071.         }
  2072.  
  2073.         #endregion
  2074.  
  2075.         #region DrawControl
  2076.  
  2077.         protected override void OnPaint(PaintEventArgs e)
  2078.         {
  2079.             base.OnPaint(e);
  2080.             Bitmap B = new Bitmap(Width, Height);
  2081.             using (Graphics G = Graphics.FromImage(B))
  2082.             {
  2083.  
  2084.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  2085.                 System.Drawing.Drawing2D.ColorBlend BL1 = new System.Drawing.Drawing2D.ColorBlend();
  2086.                 BL1.Positions = new Single[] { 0.0F, 0.15F, 0.85F, 1.0F };
  2087.                 BL1.Colors = new Color[] { Color.Transparent, ForeColor, ForeColor, Color.Transparent };
  2088.                 switch (SepStyle)
  2089.                 {
  2090.                     case Style.Horizental:
  2091.                         using (System.Drawing.Drawing2D.LinearGradientBrush lb1 = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 0.0F))
  2092.                         {
  2093.                             lb1.InterpolationColors = BL1;
  2094.                             G.DrawLine(new Pen(lb1), 0, Convert.ToInt32(0.7), Width, Convert.ToInt32(0.7));
  2095.                         }
  2096.                         break;
  2097.                     case Style.Vertiacal:
  2098.                         using (System.Drawing.Drawing2D.LinearGradientBrush lb1 = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 90.0F))
  2099.                         {
  2100.                             lb1.InterpolationColors = BL1;
  2101.                             G.DrawLine(new Pen(lb1), Convert.ToInt32(0.7), 0, Convert.ToInt32(0.7), Height);
  2102.                         }
  2103.                         break;
  2104.                 }
  2105.  
  2106.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  2107.                 G.Dispose();
  2108.                 B.Dispose();
  2109.             }
  2110.  
  2111.         }
  2112.  
  2113.         #endregion
  2114.  
  2115.     }
  2116.  
  2117.     #endregion
  2118.  
  2119.     #region Close
  2120.  
  2121.     public class EtherealClose : Control
  2122.     {
  2123.  
  2124.  
  2125.         #region Variables
  2126.  
  2127.         private HelperMethods.MouseMode State;
  2128.         private Color _NormalColor = HelperMethods.GetHTMLColor("3f2153");
  2129.         private Color _HoverColor = HelperMethods.GetHTMLColor("f0f0f0");
  2130.         private Color _PushedColor = HelperMethods.GetHTMLColor("966bc1");
  2131.         private Color _TextColor = Color.White;
  2132.  
  2133.         #endregion
  2134.  
  2135.         #region Initialization
  2136.  
  2137.         public EtherealClose()
  2138.         {
  2139.             SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint |
  2140.             ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
  2141.             ControlStyles.SupportsTransparentBackColor, true);
  2142.             DoubleBuffered = true;
  2143.             UpdateStyles();
  2144.             BackColor = Color.Transparent;
  2145.             Font = new Font("Marlett", 8);
  2146.             Size = new Size(20, 20);
  2147.         }
  2148.  
  2149.         #endregion
  2150.  
  2151.         #region Properties
  2152.  
  2153.         public Color NormalColor
  2154.         {
  2155.             get
  2156.             {
  2157.                 return _NormalColor;
  2158.             }
  2159.             set
  2160.             {
  2161.                 _NormalColor=value;
  2162.                 Invalidate();
  2163.             }
  2164.            
  2165.         }
  2166.  
  2167.         public Color PushedColor
  2168.         {
  2169.             get
  2170.             {
  2171.                 return _PushedColor;
  2172.             }
  2173.             set
  2174.             {
  2175.                 PushedColor=value;
  2176.                Invalidate();
  2177.             }
  2178.            
  2179.         }
  2180.  
  2181.         public Color HoverColor
  2182.         {
  2183.             get
  2184.             {
  2185.                 return _HoverColor;
  2186.             }
  2187.             set
  2188.             {
  2189.                 _HoverColor=value;
  2190.                 Invalidate();
  2191.             }
  2192.            
  2193.         }
  2194.  
  2195.         public Color TextColor
  2196.         {
  2197.             get
  2198.             {
  2199.                 return _TextColor;
  2200.             }
  2201.             set
  2202.             {
  2203.                 _TextColor=value;
  2204.                 Invalidate();
  2205.             }
  2206.            
  2207.         }
  2208.  
  2209.         #endregion
  2210.  
  2211.         #region DrawControl
  2212.  
  2213.         protected override void OnPaint(PaintEventArgs e)
  2214.         {
  2215.             base.OnPaint(e);
  2216.             Rectangle Rect = new Rectangle(0, 0, 22, 22);
  2217.             Bitmap B = new Bitmap(Width, Height);
  2218.             using (Graphics G = Graphics.FromImage(B))
  2219.             {
  2220.              
  2221.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  2222.  
  2223.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  2224.  
  2225.                 G.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
  2226.  
  2227.                 switch(State)
  2228.                 {
  2229.                     case HelperMethods.MouseMode.NormalMode:
  2230.                         G.FillEllipse(new SolidBrush(NormalColor), 1, 1, 19, 19);
  2231.                         break;
  2232.                     case HelperMethods.MouseMode.Hovered:
  2233.                         Cursor = Cursors.Hand;
  2234.                         G.FillEllipse(new SolidBrush(NormalColor), 1, 1, 19, 19);
  2235.                         G.DrawEllipse(new Pen(HoverColor, 2), 1, 1, 18, 18);
  2236.                         break;
  2237.                     case HelperMethods.MouseMode.Pushed:
  2238.                         G.FillEllipse(new SolidBrush(PushedColor), 1, 1, 19, 19);
  2239.                         break;
  2240.                 }
  2241.  
  2242.                 G.DrawString("r", Font, new SolidBrush(TextColor), new Rectangle(4, 6, 18, 18));
  2243.  
  2244.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  2245.                 G.Dispose();
  2246.                 B.Dispose();
  2247.             }
  2248.  
  2249.         }
  2250.  
  2251.         #endregion
  2252.  
  2253.         #region Events
  2254.  
  2255.         protected override void OnResize(EventArgs e)
  2256.         {
  2257.             base.OnResize(e);
  2258.             Size = new Size(20, 20);
  2259.         }
  2260.  
  2261.         protected override void OnClick(EventArgs e)
  2262.         {
  2263.             base.OnClick(e);
  2264.             Environment.Exit(0);
  2265.             Application.Exit();
  2266.         }
  2267.  
  2268.         protected override void OnMouseEnter(EventArgs e)
  2269.         {
  2270.  
  2271.             base.OnMouseEnter(e);
  2272.             State = HelperMethods.MouseMode.Hovered;
  2273.             Invalidate();
  2274.         }
  2275.  
  2276.         protected override void OnMouseUp(MouseEventArgs e)
  2277.         {
  2278.  
  2279.             base.OnMouseUp(e);
  2280.             State = HelperMethods.MouseMode.Hovered;
  2281.             Invalidate();
  2282.         }
  2283.  
  2284.         protected override void OnMouseDown(MouseEventArgs e)
  2285.         {
  2286.  
  2287.             base.OnMouseDown(e);
  2288.             State = HelperMethods.MouseMode.Pushed;
  2289.             Invalidate();
  2290.         }
  2291.  
  2292.         protected override void OnMouseLeave(EventArgs e)
  2293.         {
  2294.  
  2295.             base.OnMouseLeave(e);
  2296.             State = HelperMethods.MouseMode.NormalMode;
  2297.             Invalidate();
  2298.         }
  2299.  
  2300.         #endregion
  2301.     }
  2302.  
  2303.     #endregion
  2304.  
  2305.     #region Maximize
  2306.  
  2307.     public class EtherealMaximize : Control
  2308.     {
  2309.  
  2310.  
  2311.         #region Variables
  2312.  
  2313.         private HelperMethods.MouseMode State;
  2314.         private Color _NormalColor = HelperMethods.GetHTMLColor("3f2153");
  2315.         private Color _HoverColor = HelperMethods.GetHTMLColor("f0f0f0");
  2316.         private Color _PushedColor = HelperMethods.GetHTMLColor("966bc1");
  2317.         private Color _TextColor = Color.White;
  2318.  
  2319.         #endregion
  2320.  
  2321.         #region Initialization
  2322.  
  2323.         public EtherealMaximize()
  2324.         {
  2325.             SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint |
  2326.             ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
  2327.             ControlStyles.SupportsTransparentBackColor, true);
  2328.             DoubleBuffered = true;
  2329.             UpdateStyles();
  2330.             BackColor = Color.Transparent;
  2331.             Font = new Font("Marlett", 9);
  2332.             Size = new Size(20, 20);
  2333.         }
  2334.  
  2335.         #endregion
  2336.  
  2337.         #region Properties
  2338.  
  2339.         public Color NormalColor
  2340.         {
  2341.             get
  2342.             {
  2343.                 return _NormalColor;
  2344.             }
  2345.             set
  2346.             {
  2347.                 _NormalColor = value;
  2348.                 Invalidate();
  2349.             }
  2350.  
  2351.         }
  2352.  
  2353.         public Color PushedColor
  2354.         {
  2355.             get
  2356.             {
  2357.                 return _PushedColor;
  2358.             }
  2359.             set
  2360.             {
  2361.                 PushedColor = value;
  2362.                 Invalidate();
  2363.             }
  2364.  
  2365.         }
  2366.  
  2367.         public Color HoverColor
  2368.         {
  2369.             get
  2370.             {
  2371.                 return _HoverColor;
  2372.             }
  2373.             set
  2374.             {
  2375.                 _HoverColor = value;
  2376.                 Invalidate();
  2377.             }
  2378.  
  2379.         }
  2380.  
  2381.         public Color TextColor
  2382.         {
  2383.             get
  2384.             {
  2385.                 return _TextColor;
  2386.             }
  2387.             set
  2388.             {
  2389.                 _TextColor = value;
  2390.                 Invalidate();
  2391.             }
  2392.  
  2393.         }
  2394.  
  2395.         #endregion
  2396.  
  2397.         #region DrawControl
  2398.  
  2399.         protected override void OnPaint(PaintEventArgs e)
  2400.         {
  2401.             base.OnPaint(e);
  2402.             Rectangle Rect = new Rectangle(0, 0, 22, 22);
  2403.             Bitmap B = new Bitmap(Width, Height);
  2404.             using (Graphics G = Graphics.FromImage(B))
  2405.             {
  2406.  
  2407.                 G.Clear(HelperMethods.GetHTMLColor("3f2153"));
  2408.  
  2409.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  2410.  
  2411.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  2412.  
  2413.                 G.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
  2414.  
  2415.                 switch (State)
  2416.                 {
  2417.                     case HelperMethods.MouseMode.NormalMode:
  2418.                         G.FillEllipse(new SolidBrush(NormalColor), 1, 1, 19, 19);
  2419.                         break;
  2420.                     case HelperMethods.MouseMode.Hovered:
  2421.                         Cursor = Cursors.Hand;
  2422.                         G.FillEllipse(new SolidBrush(NormalColor), 1, 1, 19, 19);
  2423.                         G.DrawEllipse(new Pen(HoverColor, 2), 1, 1, 18, 18);
  2424.                         break;
  2425.                     case HelperMethods.MouseMode.Pushed:
  2426.                         G.FillEllipse(new SolidBrush(PushedColor), 1, 1, 19, 19);
  2427.                         break;
  2428.                 }
  2429.  
  2430.                 G.DrawString("v", Font, new SolidBrush(TextColor), new Rectangle(Convert.ToInt32(3.4), 5, 18, 18));
  2431.  
  2432.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  2433.                 G.Dispose();
  2434.                 B.Dispose();
  2435.             }
  2436.  
  2437.         }
  2438.  
  2439.         #endregion
  2440.  
  2441.         #region Events
  2442.  
  2443.         protected override void OnResize(EventArgs e)
  2444.         {
  2445.             base.OnResize(e);
  2446.             Size = new Size(22, 22);
  2447.         }
  2448.  
  2449.         protected override void OnClick(EventArgs e)
  2450.         {
  2451.             base.OnClick(e);
  2452.               if (FindForm().WindowState == FormWindowState.Normal)
  2453.               {
  2454.             FindForm().WindowState = FormWindowState.Maximized;
  2455.               }
  2456.               else
  2457.               {
  2458.             FindForm().WindowState = FormWindowState.Normal;
  2459.               }
  2460.        
  2461.         }
  2462.  
  2463.         protected override void OnMouseEnter(EventArgs e)
  2464.         {
  2465.  
  2466.             base.OnMouseEnter(e);
  2467.             State = HelperMethods.MouseMode.Hovered;
  2468.             Invalidate();
  2469.         }
  2470.  
  2471.         protected override void OnMouseUp(MouseEventArgs e)
  2472.         {
  2473.  
  2474.             base.OnMouseUp(e);
  2475.             State = HelperMethods.MouseMode.Hovered;
  2476.             Invalidate();
  2477.         }
  2478.  
  2479.         protected override void OnMouseDown(MouseEventArgs e)
  2480.         {
  2481.  
  2482.             base.OnMouseDown(e);
  2483.             State = HelperMethods.MouseMode.Pushed;
  2484.             Invalidate();
  2485.         }
  2486.  
  2487.         protected override void OnMouseLeave(EventArgs e)
  2488.         {
  2489.  
  2490.             base.OnMouseLeave(e);
  2491.             State = HelperMethods.MouseMode.NormalMode;
  2492.             Invalidate();
  2493.         }
  2494.  
  2495.         #endregion
  2496.     }
  2497.  
  2498.     #endregion
  2499.  
  2500.     #region Minimize
  2501.  
  2502.     public class EtherealMinimize : Control
  2503.     {
  2504.  
  2505.  
  2506.         #region Variables
  2507.  
  2508.         private HelperMethods.MouseMode State;
  2509.         private Color _NormalColor = HelperMethods.GetHTMLColor("3f2153");
  2510.         private Color _HoverColor = HelperMethods.GetHTMLColor("f0f0f0");
  2511.         private Color _PushedColor = HelperMethods.GetHTMLColor("966bc1");
  2512.         private Color _TextColor = Color.White;
  2513.  
  2514.         #endregion
  2515.  
  2516.         #region Initialization
  2517.  
  2518.         public EtherealMinimize()
  2519.         {
  2520.             SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint |
  2521.             ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
  2522.             ControlStyles.SupportsTransparentBackColor, true);
  2523.             DoubleBuffered = true;
  2524.             UpdateStyles();
  2525.             BackColor = Color.Transparent;
  2526.             Font = new Font("Marlett", 9);
  2527.             Size = new Size(21, 21);
  2528.         }
  2529.  
  2530.         #endregion
  2531.  
  2532.         #region Properties
  2533.  
  2534.         public Color NormalColor
  2535.         {
  2536.             get
  2537.             {
  2538.                 return _NormalColor;
  2539.             }
  2540.             set
  2541.             {
  2542.                 _NormalColor = value;
  2543.                 Invalidate();
  2544.             }
  2545.  
  2546.         }
  2547.  
  2548.         public Color PushedColor
  2549.         {
  2550.             get
  2551.             {
  2552.                 return _PushedColor;
  2553.             }
  2554.             set
  2555.             {
  2556.                 PushedColor = value;
  2557.                 Invalidate();
  2558.             }
  2559.  
  2560.         }
  2561.  
  2562.         public Color HoverColor
  2563.         {
  2564.             get
  2565.             {
  2566.                 return _HoverColor;
  2567.             }
  2568.             set
  2569.             {
  2570.                 _HoverColor = value;
  2571.                 Invalidate();
  2572.             }
  2573.  
  2574.         }
  2575.  
  2576.         public Color TextColor
  2577.         {
  2578.             get
  2579.             {
  2580.                 return _TextColor;
  2581.             }
  2582.             set
  2583.             {
  2584.                 _TextColor = value;
  2585.                 Invalidate();
  2586.             }
  2587.  
  2588.         }
  2589.  
  2590.         #endregion
  2591.  
  2592.         #region DrawControl
  2593.  
  2594.         protected override void OnPaint(PaintEventArgs e)
  2595.         {
  2596.             base.OnPaint(e);
  2597.             Rectangle Rect = new Rectangle(0, 0, 22, 22);
  2598.             Bitmap B = new Bitmap(Width, Height);
  2599.             using (Graphics G = Graphics.FromImage(B))
  2600.             {
  2601.  
  2602.                 G.Clear(HelperMethods.GetHTMLColor("3f2153"));
  2603.  
  2604.                 G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  2605.  
  2606.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  2607.  
  2608.                 G.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
  2609.  
  2610.                 switch (State)
  2611.                 {
  2612.                     case HelperMethods.MouseMode.NormalMode:
  2613.                         G.FillEllipse(new SolidBrush(NormalColor), 1, 1, 19, 19);
  2614.                         break;
  2615.                     case HelperMethods.MouseMode.Hovered:
  2616.                         Cursor = Cursors.Hand;
  2617.                         G.FillEllipse(new SolidBrush(NormalColor), 1, 1, 19, 19);
  2618.                         G.DrawEllipse(new Pen(HoverColor, 2), 1, 1, 18, 18);
  2619.                         break;
  2620.                     case HelperMethods.MouseMode.Pushed:
  2621.                         G.FillEllipse(new SolidBrush(PushedColor), 1, 1, 19, 19);
  2622.                         break;
  2623.                 }
  2624.  
  2625.                 G.DrawString("0", Font, new SolidBrush(TextColor), new Rectangle(Convert.ToInt32(4.5), Convert.ToInt32(2.6), 18, 18));
  2626.  
  2627.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  2628.                 G.Dispose();
  2629.                 B.Dispose();
  2630.             }
  2631.  
  2632.         }
  2633.  
  2634.         #endregion
  2635.  
  2636.         #region Events
  2637.  
  2638.         protected override void OnResize(EventArgs e)
  2639.         {
  2640.             base.OnResize(e);
  2641.             Size = new Size(22, 22);
  2642.         }
  2643.  
  2644.         protected override void OnClick(EventArgs e)
  2645.         {
  2646.             base.OnClick(e);
  2647.             if (FindForm().WindowState == FormWindowState.Normal)
  2648.               {
  2649.                   FindForm().WindowState = FormWindowState.Minimized;
  2650.               }
  2651.        
  2652.         }
  2653.  
  2654.         protected override void OnMouseEnter(EventArgs e)
  2655.         {
  2656.  
  2657.             base.OnMouseEnter(e);
  2658.             State = HelperMethods.MouseMode.Hovered;
  2659.             Invalidate();
  2660.         }
  2661.  
  2662.         protected override void OnMouseUp(MouseEventArgs e)
  2663.         {
  2664.  
  2665.             base.OnMouseUp(e);
  2666.             State = HelperMethods.MouseMode.Hovered;
  2667.             Invalidate();
  2668.         }
  2669.  
  2670.         protected override void OnMouseDown(MouseEventArgs e)
  2671.         {
  2672.  
  2673.             base.OnMouseDown(e);
  2674.             State = HelperMethods.MouseMode.Pushed;
  2675.             Invalidate();
  2676.         }
  2677.  
  2678.         protected override void OnMouseLeave(EventArgs e)
  2679.         {
  2680.  
  2681.             base.OnMouseLeave(e);
  2682.             State = HelperMethods.MouseMode.NormalMode;
  2683.             Invalidate();
  2684.         }
  2685.  
  2686.         #endregion
  2687.     }
  2688.  
  2689.     #endregion
  2690.  
  2691.     #region Label
  2692.  
  2693.     public class EtherealLabel :Control
  2694.     {
  2695.         #region Vaeiables
  2696.                
  2697.         private Style _ColorStyle=Style.DarkPink;
  2698.  
  2699.         #endregion
  2700.  
  2701.         #region Initialization
  2702.  
  2703.         public EtherealLabel()
  2704.         {
  2705.         SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
  2706.         DoubleBuffered = true;
  2707.         Font = new Font("Montserrat", 10, FontStyle.Bold);
  2708.         }
  2709.  
  2710.         #endregion
  2711.  
  2712.         #region Properties
  2713.  
  2714.         public Style ColorStyle
  2715.         {
  2716.             get
  2717.             {
  2718.             return _ColorStyle;
  2719.             }
  2720.             set
  2721.             {
  2722.             _ColorStyle = value;
  2723.             Invalidate();
  2724.             }
  2725.         }
  2726.              
  2727.         #endregion
  2728.              
  2729.         #region Enumerators
  2730.  
  2731.         public enum Style
  2732.         {
  2733.         SemiBlack,
  2734.         DarkPink,
  2735.         LightPink
  2736.         }
  2737.  
  2738.         #endregion
  2739.  
  2740.         #region DrawControl
  2741.  
  2742.         protected override void OnPaint(PaintEventArgs e)
  2743.         {
  2744.             base.OnPaint(e);
  2745.             Rectangle Rect = new Rectangle(0, 0, 22, 22);
  2746.             Bitmap B = new Bitmap(Width, Height);
  2747.             using (Graphics G = Graphics.FromImage(B))
  2748.             {
  2749.  
  2750.            G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  2751.             switch (ColorStyle)
  2752.             {
  2753.                 case Style.SemiBlack:
  2754.                     G.DrawString(Text, Font, HelperMethods.SolidBrushHTMlColor("222222"), ClientRectangle);
  2755.                         break;
  2756.                 case Style.DarkPink:
  2757.                         G.DrawString(Text, Font, HelperMethods.SolidBrushHTMlColor("3b2551"), ClientRectangle);
  2758.                         break;
  2759.                 case Style.LightPink:
  2760.                         G.DrawString(Text, Font, HelperMethods.SolidBrushHTMlColor("9d92a8"), ClientRectangle);
  2761.                         break;
  2762.             }
  2763.  
  2764.                 e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  2765.                 G.Dispose();
  2766.                 B.Dispose();
  2767.             }
  2768.  
  2769.         }
  2770.  
  2771.         #endregion
  2772.  
  2773.     }
  2774.  
  2775. #endregion
Add Comment
Please, Sign In to add comment