Advertisement
THE_LORD

Nord Theme

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