Advertisement
LaPanthere

Firefox Theme : AeroRev9 [29/07 (2)]

Jul 30th, 2015
1,958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 37.93 KB | None | 0 0
  1. // Firefox Theme.
  2. // Made by AeroRev9.
  3. // 25/07/2015.
  4. // Updated : 29/07/2015 [2].
  5. // Credits : Mavaamarten, Xertz.
  6. // Converted by LaPanthere
  7.  
  8. using System;
  9. using System.ComponentModel;
  10. using System.Drawing;
  11. using System.Drawing.Drawing2D;
  12. using System.Drawing.Text;
  13. using System.Windows.Forms;
  14.  
  15. static class Theme
  16. {
  17.  
  18.     public static Font GlobalFont(FontStyle B, int S)
  19.     {
  20.          return new Font("Segoe UI", S, B);
  21.     }
  22.  
  23.     public static string GetCheckMark()
  24.     {
  25.         return "iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAYAAAD0xERiAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEySURBVDhPY/hPRUBdw/79+/efVHz77bf/X37+wRAn2bDff/7+91l+83/YmtsYBpJs2ITjz/8rTbrwP2Dlrf9XXn5FkSPJsD13P/y3nHsVbNjyy28w5Ik27NWXX//TNt8DG1S19zFWNRiGvfzy8//ccy9RxEB4wvFnYIMMZl7+//brLwx5EEYx7MP33/9dF18Ha1py8RVcHBR7mlMvgsVXX8X0Hgwz/P379z8yLtz5AKxJdcpFcBj9+v3nf/CqW2Cx5E13UdSiYwzDvv36/d9/BUSzzvRL/0t2PQSzQd57+vEHilp0jGEYCJ9+8hnuGhiee+4Vhjp0jNUwEN566/1/m/mQZJC/48H/zz9+YVWHjHEaBsKgwAZ59eH771jl0TFew0D48osvWMWxYYKGEY///gcAqiuA6kEmfEMAAAAASUVORK5CYII=";
  26.     }
  27.  
  28. }
  29.  
  30. static class Helpers
  31. {
  32.  
  33.     public enum MouseState : byte
  34.     {
  35.         None = 0,
  36.         Over = 1,
  37.         Down = 2
  38.     }
  39.  
  40.     public static Rectangle FullRectangle(Size S, bool Subtract)
  41.     {
  42.         if (Subtract)
  43.         {
  44.             return new Rectangle(0, 0, S.Width - 1, S.Height - 1);
  45.         }
  46.         else
  47.         {
  48.             return new Rectangle(0, 0, S.Width, S.Height);
  49.         }
  50.     }
  51.  
  52.     public static Color GreyColor(int G)
  53.     {
  54.         return Color.FromArgb(G, G, G);
  55.     }
  56.  
  57.     public static void CenterString(Graphics G, string T, Font F, Color C, Rectangle R)
  58.     {
  59.         SizeF TS = G.MeasureString(T, F);
  60.  
  61.         using (SolidBrush B = new SolidBrush(C))
  62.         {
  63.             G.DrawString(T, F, B, new Point((int)(R.Width / 2 - (TS.Width / 2)), (int)(R.Height / 2 - (TS.Height / 2))));
  64.         }
  65.     }
  66.  
  67.  
  68.     public static void FillRoundRect(Graphics G, Rectangle R, int Curve, Color C)
  69.     {
  70.         using (SolidBrush B = new SolidBrush(C))
  71.         {
  72.             G.FillPie(B, R.X, R.Y, Curve, Curve, 180, 90);
  73.             G.FillPie(B, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
  74.             G.FillPie(B, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
  75.             G.FillPie(B, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
  76.             G.FillRectangle(B, Convert.ToInt32(R.X + Curve / 2), R.Y, R.Width - Curve, Convert.ToInt32(Curve / 2));
  77.             G.FillRectangle(B, R.X, Convert.ToInt32(R.Y + Curve / 2), R.Width, R.Height - Curve);
  78.             G.FillRectangle(B, Convert.ToInt32(R.X + Curve / 2), Convert.ToInt32(R.Y + R.Height - Curve / 2), R.Width - Curve, Convert.ToInt32(Curve / 2));
  79.         }
  80.  
  81.     }
  82.  
  83.  
  84.     public static void DrawRoundRect(Graphics G, Rectangle R, int Curve, Color C)
  85.     {
  86.         using (Pen P = new Pen(C))
  87.         {
  88.             G.DrawArc(P, R.X, R.Y, Curve, Curve, 180, 90);
  89.             G.DrawLine(P, Convert.ToInt32(R.X + Curve / 2), R.Y, Convert.ToInt32(R.X + R.Width - Curve / 2), R.Y);
  90.             G.DrawArc(P, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
  91.             G.DrawLine(P, R.X, Convert.ToInt32(R.Y + Curve / 2), R.X, Convert.ToInt32(R.Y + R.Height - Curve / 2));
  92.             G.DrawLine(P, Convert.ToInt32(R.X + R.Width), Convert.ToInt32(R.Y + Curve / 2), Convert.ToInt32(R.X + R.Width), Convert.ToInt32(R.Y + R.Height - Curve / 2));
  93.             G.DrawLine(P, Convert.ToInt32(R.X + Curve / 2), Convert.ToInt32(R.Y + R.Height), Convert.ToInt32(R.X + R.Width - Curve / 2), Convert.ToInt32(R.Y + R.Height));
  94.             G.DrawArc(P, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
  95.             G.DrawArc(P, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
  96.         }
  97.  
  98.     }
  99.  
  100.  
  101.     public static void CenterStringTab(Graphics G, string text, Font font, Brush brush, Rectangle rect, bool shadow = false, int yOffset = 0)
  102.     {
  103.         SizeF textSize = G.MeasureString(text, font);
  104.         int textX = (int)(rect.X + (rect.Width / 2) - (textSize.Width / 2));
  105.         int textY = (int)(rect.Y + (rect.Height / 2) - (textSize.Height / 2) + yOffset);
  106.  
  107.         if (shadow)
  108.             G.DrawString(text, font, Brushes.Black, textX + 1, textY + 1);
  109.         G.DrawString(text, font, brush, textX, textY + 1);
  110.  
  111.     }
  112.  
  113. }
  114.  
  115.  
  116. [DefaultEvent("CheckedChanged")]
  117. class FirefoxRadioButton : Control
  118. {
  119.  
  120.     #region " Public "
  121.     public event CheckedChangedEventHandler CheckedChanged;
  122.     public delegate void CheckedChangedEventHandler(object sender, EventArgs e);
  123.     #endregion
  124.  
  125.     #region " Private "
  126.     private Helpers.MouseState State;
  127.     private Color ETC = Color.Blue;
  128.  
  129.     private Graphics G;
  130.     private bool _EnabledCalc;
  131.     private bool _Checked;
  132.     #endregion
  133.     private bool _Bold;
  134.  
  135.     #region " Properties "
  136.  
  137.     public bool Checked
  138.     {
  139.         get { return _Checked; }
  140.         set
  141.         {
  142.             _Checked = value;
  143.             Invalidate();
  144.         }
  145.     }
  146.  
  147.     public new bool Enabled
  148.     {
  149.         get { return EnabledCalc; }
  150.         set
  151.         {
  152.             _EnabledCalc = value;
  153.             Invalidate();
  154.         }
  155.     }
  156.  
  157.     [DisplayName("Enabled")]
  158.     public bool EnabledCalc
  159.     {
  160.         get { return _EnabledCalc; }
  161.         set
  162.         {
  163.             Enabled = value;
  164.             Invalidate();
  165.         }
  166.     }
  167.  
  168.     public bool Bold
  169.     {
  170.         get { return _Bold; }
  171.         set
  172.         {
  173.             _Bold = value;
  174.             Invalidate();
  175.         }
  176.     }
  177.  
  178.     #endregion
  179.  
  180.     #region " Control "
  181.  
  182.     public FirefoxRadioButton()
  183.     {
  184.         DoubleBuffered = true;
  185.         ForeColor = Color.FromArgb(66, 78, 90);
  186.         Font = Theme.GlobalFont(FontStyle.Regular, 10);
  187.         Size = new Size(160, 27);
  188.         Enabled = true;
  189.     }
  190.  
  191.  
  192.     protected override void OnPaint(PaintEventArgs e)
  193.     {
  194.         G = e.Graphics;
  195.         G.SmoothingMode = SmoothingMode.HighQuality;
  196.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  197.  
  198.         base.OnPaint(e);
  199.  
  200.         G.Clear(Parent.BackColor);
  201.  
  202.         if (Enabled)
  203.         {
  204.             ETC = Color.FromArgb(66, 78, 90);
  205.  
  206.             switch (State)
  207.             {
  208.  
  209.                 case Helpers.MouseState.Over:
  210.                 case Helpers.MouseState.Down:
  211.  
  212.                     using (Pen P = new Pen(Color.FromArgb(34, 146, 208)))
  213.                     {
  214.                         G.DrawEllipse(P, new Rectangle(2, 2, 22, 22));
  215.                     }
  216.  
  217.  
  218.                     break;
  219.                 default:
  220.  
  221.                     using (Pen P = new Pen(Helpers.GreyColor(190)))
  222.                     {
  223.                         G.DrawEllipse(P, new Rectangle(2, 2, 22, 22));
  224.                     }
  225.  
  226.  
  227.                     break;
  228.             }
  229.  
  230.  
  231.             if (Checked)
  232.             {
  233.                 using (SolidBrush B = new SolidBrush(Color.FromArgb(34, 146, 208)))
  234.                 {
  235.                     G.FillEllipse(B, new Rectangle(7, 7, 12, 12));
  236.                 }
  237.  
  238.             }
  239.  
  240.         }
  241.         else
  242.         {
  243.             ETC = Helpers.GreyColor(170);
  244.  
  245.             using (Pen P = new Pen(Helpers.GreyColor(210)))
  246.             {
  247.                 G.DrawEllipse(P, new Rectangle(2, 2, 22, 22));
  248.             }
  249.  
  250.  
  251.             if (Checked)
  252.             {
  253.                 using (SolidBrush B = new SolidBrush(Color.FromArgb(34, 146, 208)))
  254.                 {
  255.                     G.FillEllipse(B, new Rectangle(7, 7, 12, 12));
  256.                 }
  257.  
  258.             }
  259.  
  260.         }
  261.  
  262.         using (SolidBrush B = new SolidBrush(ETC))
  263.         {
  264.  
  265.             if (Bold)
  266.             {
  267.                 G.DrawString(Text, Theme.GlobalFont(FontStyle.Bold, 10), B, new Point(32, 4));
  268.             }
  269.             else
  270.             {
  271.                 G.DrawString(Text, Theme.GlobalFont(FontStyle.Regular, 10), B, new Point(32, 4));
  272.             }
  273.  
  274.         }
  275.  
  276.  
  277.     }
  278.  
  279.     protected override void OnMouseDown(MouseEventArgs e)
  280.     {
  281.         base.OnMouseDown(e);
  282.         State = Helpers.MouseState.Down;
  283.         Invalidate();
  284.     }
  285.  
  286.     protected override void OnMouseUp(MouseEventArgs e)
  287.     {
  288.         base.OnMouseUp(e);
  289.  
  290.  
  291.         if (Enabled)
  292.         {
  293.  
  294.             if (!Checked)
  295.             {
  296.                 foreach (Control C in Parent.Controls)
  297.                 {
  298.                     if (C is FirefoxRadioButton)
  299.                     {
  300.                         ((FirefoxRadioButton)C).Checked = false;
  301.                     }
  302.                 }
  303.  
  304.             }
  305.  
  306.             Checked = true;
  307.             if (CheckedChanged != null)
  308.             {
  309.                 CheckedChanged(this, e);
  310.             }
  311.         }
  312.  
  313.         State = Helpers.MouseState.Over;
  314.         Invalidate();
  315.     }
  316.  
  317.     protected override void OnMouseEnter(EventArgs e)
  318.     {
  319.         base.OnMouseEnter(e);
  320.         State = Helpers.MouseState.Over;
  321.         Invalidate();
  322.     }
  323.  
  324.     protected override void OnMouseLeave(EventArgs e)
  325.     {
  326.         base.OnMouseLeave(e);
  327.         State = Helpers.MouseState.None;
  328.         Invalidate();
  329.     }
  330.  
  331.     #endregion
  332.  
  333. }
  334.  
  335. [DefaultEvent("CheckedChanged")]
  336. class FirefoxCheckBox : Control
  337. {
  338.  
  339.     #region " Public "
  340.     public event CheckedChangedEventHandler CheckedChanged;
  341.     public delegate void CheckedChangedEventHandler(object sender, EventArgs e);
  342.     #endregion
  343.  
  344.     #region " Private "
  345.     private Helpers.MouseState State;
  346.     private Color ETC = Color.Blue;
  347.  
  348.     private Graphics G;
  349.     private bool _EnabledCalc;
  350.     private bool _Checked;
  351.     #endregion
  352.     private bool _Bold;
  353.  
  354.     #region " Properties "
  355.  
  356.     public bool Checked
  357.     {
  358.         get { return _Checked; }
  359.         set
  360.         {
  361.             _Checked = value;
  362.             Invalidate();
  363.         }
  364.     }
  365.  
  366.     public new bool Enabled
  367.     {
  368.         get { return EnabledCalc; }
  369.         set
  370.         {
  371.             _EnabledCalc = value;
  372.             Invalidate();
  373.         }
  374.     }
  375.  
  376.     [DisplayName("Enabled")]
  377.     public bool EnabledCalc
  378.     {
  379.         get { return _EnabledCalc; }
  380.         set
  381.         {
  382.             Enabled = value;
  383.             Invalidate();
  384.         }
  385.     }
  386.  
  387.     public bool Bold
  388.     {
  389.         get { return _Bold; }
  390.         set
  391.         {
  392.             _Bold = value;
  393.             Invalidate();
  394.         }
  395.     }
  396.  
  397.     #endregion
  398.  
  399.     #region " Control "
  400.  
  401.     public FirefoxCheckBox()
  402.     {
  403.         DoubleBuffered = true;
  404.         ForeColor = Color.FromArgb(66, 78, 90);
  405.         Font = Theme.GlobalFont(FontStyle.Regular, 10);
  406.         Size = new Size(160, 27);
  407.         Enabled = true;
  408.     }
  409.  
  410.  
  411.     protected override void OnPaint(PaintEventArgs e)
  412.     {
  413.         G = e.Graphics;
  414.         G.SmoothingMode = SmoothingMode.HighQuality;
  415.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  416.  
  417.         base.OnPaint(e);
  418.  
  419.         G.Clear(Parent.BackColor);
  420.  
  421.         if (Enabled)
  422.         {
  423.             ETC = Color.FromArgb(66, 78, 90);
  424.  
  425.             switch (State)
  426.             {
  427.  
  428.                 case Helpers.MouseState.Over:
  429.                 case Helpers.MouseState.Down:
  430.                     Helpers.DrawRoundRect(G, new Rectangle(3, 3, 20, 20), 3, Color.FromArgb(44, 156, 218));
  431.  
  432.                     break;
  433.                 default:
  434.                     Helpers.DrawRoundRect(G, new Rectangle(3, 3, 20, 20), 3, Helpers.GreyColor(200));
  435.  
  436.                     break;
  437.             }
  438.  
  439.  
  440.             if (Checked)
  441.             {
  442.                 using (Image I = Image.FromStream(new System.IO.MemoryStream(Convert.FromBase64String(Theme.GetCheckMark()))))
  443.                 {
  444.                     G.DrawImage(I, new Point(4, 5));
  445.                 }
  446.  
  447.             }
  448.  
  449.  
  450.         }
  451.         else
  452.         {
  453.             ETC = Helpers.GreyColor(170);
  454.             Helpers.DrawRoundRect(G, new Rectangle(3, 3, 20, 20), 3, Helpers.GreyColor(220));
  455.  
  456.  
  457.             if (Checked)
  458.             {
  459.                 using (Image I = Image.FromStream(new System.IO.MemoryStream(Convert.FromBase64String(Theme.GetCheckMark()))))
  460.                 {
  461.                     G.DrawImage(I, new Point(4, 5));
  462.                 }
  463.  
  464.             }
  465.  
  466.         }
  467.  
  468.  
  469.         using (SolidBrush B = new SolidBrush(ETC))
  470.         {
  471.  
  472.             if (Bold)
  473.             {
  474.                 G.DrawString(Text, Theme.GlobalFont(FontStyle.Bold, 10), B, new Point(32, 4));
  475.             }
  476.             else
  477.             {
  478.                 G.DrawString(Text, Theme.GlobalFont(FontStyle.Regular, 10), B, new Point(32, 4));
  479.             }
  480.  
  481.         }
  482.  
  483.  
  484.     }
  485.  
  486.     protected override void OnMouseDown(MouseEventArgs e)
  487.     {
  488.         base.OnMouseDown(e);
  489.         State = Helpers.MouseState.Down;
  490.         Invalidate();
  491.     }
  492.  
  493.     protected override void OnMouseUp(MouseEventArgs e)
  494.     {
  495.         base.OnMouseUp(e);
  496.  
  497.         if (Enabled)
  498.         {
  499.             Checked = !Checked;
  500.             if (CheckedChanged != null)
  501.             {
  502.                 CheckedChanged(this, e);
  503.             }
  504.         }
  505.  
  506.         State = Helpers.MouseState.Over;
  507.         Invalidate();
  508.     }
  509.  
  510.     protected override void OnMouseEnter(EventArgs e)
  511.     {
  512.         base.OnMouseEnter(e);
  513.         State = Helpers.MouseState.Over;
  514.         Invalidate();
  515.     }
  516.  
  517.     protected override void OnMouseLeave(EventArgs e)
  518.     {
  519.         base.OnMouseLeave(e);
  520.         State = Helpers.MouseState.None;
  521.         Invalidate();
  522.     }
  523.  
  524.     #endregion
  525.  
  526. }
  527.  
  528. class FirefoxH1 : Label
  529. {
  530.  
  531.     #region " Private "
  532.     #endregion
  533.     private Graphics G;
  534.  
  535.     #region " Control "
  536.  
  537.     public FirefoxH1()
  538.     {
  539.         DoubleBuffered = true;
  540.         AutoSize = false;
  541.         Font = new Font("Segoe UI Semibold", 20);
  542.         ForeColor = Color.FromArgb(76, 88, 100);
  543.     }
  544.  
  545.  
  546.     protected override void OnPaint(PaintEventArgs e)
  547.     {
  548.         G = e.Graphics;
  549.         G.SmoothingMode = SmoothingMode.HighQuality;
  550.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  551.  
  552.         base.OnPaint(e);
  553.  
  554.         using (Pen P = new Pen(Helpers.GreyColor(200)))
  555.         {
  556.             G.DrawLine(P, new Point(0, 50), new Point(Width, 50));
  557.         }
  558.  
  559.     }
  560.  
  561.     #endregion
  562.  
  563. }
  564.  
  565. class FirefoxH2 : Label
  566. {
  567.  
  568.     #region " Control "
  569.  
  570.     public FirefoxH2()
  571.     {
  572.         Font = Theme.GlobalFont(FontStyle.Bold, 10);
  573.         ForeColor = Color.FromArgb(76, 88, 100);
  574.         BackColor = Color.White;
  575.     }
  576.  
  577.     #endregion
  578.  
  579. }
  580.  
  581. class FirefoxButton : Control
  582. {
  583.  
  584.     #region " Private "
  585.     private Helpers.MouseState State;
  586.     private Color ETC  = Color.Blue;
  587.  
  588.     private Graphics G;
  589.     #endregion
  590.     private bool _EnabledCalc;
  591.  
  592.     #region " Properties "
  593.  
  594.     public new bool Enabled
  595.     {
  596.         get { return EnabledCalc; }
  597.         set
  598.         {
  599.             _EnabledCalc = value;
  600.             Invalidate();
  601.         }
  602.     }
  603.  
  604.     [DisplayName("Enabled")]
  605.     public bool EnabledCalc
  606.     {
  607.         get { return _EnabledCalc; }
  608.         set
  609.         {
  610.             Enabled = value;
  611.             Invalidate();
  612.         }
  613.     }
  614.  
  615.     #endregion
  616.  
  617.     #region " Control "
  618.  
  619.     public FirefoxButton()
  620.     {
  621.         DoubleBuffered = true;
  622.         Enabled = true;
  623.         ForeColor = Color.FromArgb(56, 68, 80);
  624.         Font = Theme.GlobalFont(FontStyle.Regular, 10);
  625.     }
  626.  
  627.  
  628.     protected override void OnPaint(PaintEventArgs e)
  629.     {
  630.         G = e.Graphics;
  631.         G.SmoothingMode = SmoothingMode.HighQuality;
  632.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  633.  
  634.         base.OnPaint(e);
  635.  
  636.         G.Clear(Parent.BackColor);
  637.  
  638.         if (Enabled)
  639.         {
  640.             ETC = Color.FromArgb(56, 68, 80);
  641.  
  642.             switch (State)
  643.             {
  644.  
  645.                 case Helpers.MouseState.None:
  646.  
  647.                     using (SolidBrush B = new SolidBrush(Helpers.GreyColor(245)))
  648.                     {
  649.                         G.FillRectangle(B, new Rectangle(1, 1, Width - 2, Height - 2));
  650.                     }
  651.  
  652.  
  653.                     Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 2, Helpers.GreyColor(193));
  654.  
  655.                     break;
  656.                 case Helpers.MouseState.Over:
  657.  
  658.                     using (SolidBrush B = new SolidBrush(Helpers.GreyColor(232)))
  659.                     {
  660.                         G.FillRectangle(B, new Rectangle(1, 1, Width - 2, Height - 2));
  661.                     }
  662.  
  663.  
  664.                     Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 2, Helpers.GreyColor(193));
  665.  
  666.                     break;
  667.                 default:
  668.  
  669.                     using (SolidBrush B = new SolidBrush(Helpers.GreyColor(212)))
  670.                     {
  671.                         G.FillRectangle(B, new Rectangle(1, 1, Width - 2, Height - 2));
  672.                     }
  673.  
  674.  
  675.                     Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 2, Helpers.GreyColor(193));
  676.  
  677.                     break;
  678.             }
  679.  
  680.         }
  681.         else
  682.         {
  683.             ETC = Helpers.GreyColor(170);
  684.  
  685.             using (SolidBrush B = new SolidBrush(Helpers.GreyColor(245)))
  686.             {
  687.                 G.FillRectangle(B, new Rectangle(1, 1, Width - 2, Height - 2));
  688.             }
  689.  
  690.             Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 2, Helpers.GreyColor(223));
  691.  
  692.         }
  693.  
  694.         Helpers.CenterString(G, Text, Theme.GlobalFont(FontStyle.Regular, 10), ETC, Helpers.FullRectangle(Size, false));
  695.  
  696.     }
  697.  
  698.     protected override void OnMouseUp(MouseEventArgs e)
  699.     {
  700.         base.OnMouseUp(e);
  701.         State = Helpers.MouseState.Over;
  702.         Invalidate();
  703.     }
  704.  
  705.     protected override void OnMouseDown(MouseEventArgs e)
  706.     {
  707.         base.OnMouseUp(e);
  708.         State = Helpers.MouseState.Down;
  709.         Invalidate();
  710.     }
  711.  
  712.     protected override void OnMouseEnter(EventArgs e)
  713.     {
  714.         base.OnMouseEnter(e);
  715.         State = Helpers.MouseState.Over;
  716.         Invalidate();
  717.     }
  718.  
  719.     protected override void OnMouseLeave(EventArgs e)
  720.     {
  721.         base.OnMouseEnter(e);
  722.         State = Helpers.MouseState.None;
  723.         Invalidate();
  724.     }
  725.  
  726.     #endregion
  727.  
  728. }
  729.  
  730. class FirefoxRedirect : Control
  731. {
  732.  
  733.     #region " Private "
  734.     private Helpers.MouseState State;
  735.  
  736.     private Graphics G;
  737.     private Color FC = Color.Blue;
  738.     #endregion
  739.     private Font FF = null;
  740.  
  741.     #region " Control "
  742.  
  743.     public FirefoxRedirect()
  744.     {
  745.         DoubleBuffered = true;
  746.         Cursor = Cursors.Hand;
  747.         BackColor = Color.White;
  748.     }
  749.  
  750.  
  751.     protected override void OnPaint(PaintEventArgs e)
  752.     {
  753.         G = e.Graphics;
  754.         G.SmoothingMode = SmoothingMode.HighQuality;
  755.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  756.  
  757.         base.OnPaint(e);
  758.  
  759.         switch (State)
  760.         {
  761.  
  762.             case Helpers.MouseState.Over:
  763.                 FC = Color.FromArgb(23, 140, 229);
  764.                 FF = Theme.GlobalFont(FontStyle.Underline, 10);
  765.  
  766.                 break;
  767.             case Helpers.MouseState.Down:
  768.                 FC = Color.FromArgb(255, 149, 0);
  769.                 FF = Theme.GlobalFont(FontStyle.Regular, 10);
  770.  
  771.                 break;
  772.             default:
  773.                 FC = Color.FromArgb(0, 149, 221);
  774.                 FF = Theme.GlobalFont(FontStyle.Regular, 10);
  775.  
  776.                 break;
  777.         }
  778.  
  779.         using (SolidBrush B = new SolidBrush(FC))
  780.         {
  781.             G.DrawString(Text, FF, B, new Point(0, 0));
  782.         }
  783.  
  784.     }
  785.  
  786.     protected override void OnMouseUp(MouseEventArgs e)
  787.     {
  788.         base.OnMouseUp(e);
  789.         State = Helpers.MouseState.Over;
  790.         Invalidate();
  791.     }
  792.  
  793.     protected override void OnMouseDown(MouseEventArgs e)
  794.     {
  795.         base.OnMouseUp(e);
  796.         State = Helpers.MouseState.Down;
  797.         Invalidate();
  798.     }
  799.  
  800.     protected override void OnMouseEnter(EventArgs e)
  801.     {
  802.         base.OnMouseEnter(e);
  803.         State = Helpers.MouseState.Over;
  804.         Invalidate();
  805.     }
  806.  
  807.     protected override void OnMouseLeave(EventArgs e)
  808.     {
  809.         base.OnMouseEnter(e);
  810.         State = Helpers.MouseState.None;
  811.         Invalidate();
  812.     }
  813.  
  814.     #endregion
  815.  
  816. }
  817.  
  818. class FirefoxSubTabControl : TabControl
  819. {
  820.  
  821.     #region " Private "
  822.     private Graphics G;
  823.     #endregion
  824.     private Rectangle TabRect;
  825.  
  826.     #region " Control "
  827.  
  828.     public FirefoxSubTabControl()
  829.     {
  830.         DoubleBuffered = true;
  831.         Alignment = TabAlignment.Top;
  832.     }
  833.  
  834.     protected override void OnCreateControl()
  835.     {
  836.         base.OnCreateControl();
  837.         SetStyle(ControlStyles.UserPaint, true);
  838.         ItemSize = new Size(100, 40);
  839.         SizeMode = TabSizeMode.Fixed;
  840.     }
  841.  
  842.     protected override void OnControlAdded(ControlEventArgs e)
  843.     {
  844.         base.OnControlAdded(e);
  845.         try
  846.         {
  847.             for (int i = 0; i <= TabPages.Count - 1; i++)
  848.             {
  849.                 TabPages[i].BackColor = Color.White;
  850.                 TabPages[i].ForeColor = Color.FromArgb(66, 79, 90);
  851.                 TabPages[i].Font = Theme.GlobalFont(FontStyle.Regular, 10);
  852.             }
  853.         }
  854.         catch
  855.         {
  856.         }
  857.     }
  858.  
  859.  
  860.     protected override void OnPaint(PaintEventArgs e)
  861.     {
  862.         G = e.Graphics;
  863.         G.SmoothingMode = SmoothingMode.HighQuality;
  864.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  865.  
  866.         base.OnPaint(e);
  867.  
  868.         G.Clear(Parent.BackColor);
  869.  
  870.  
  871.         for (int i = 0; i <= TabPages.Count - 1; i++)
  872.         {
  873.             TabRect = GetTabRect(i);
  874.  
  875.  
  876.             if (GetTabRect(i).Contains(this.PointToClient(Cursor.Position)) & !(SelectedIndex == i))
  877.             {
  878.                 using (SolidBrush B = new SolidBrush(Helpers.GreyColor(240)))
  879.                 {
  880.                     G.FillRectangle(B, new Rectangle(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2, GetTabRect(i).Width, GetTabRect(i).Height + 1));
  881.                 }
  882.  
  883.  
  884.             }
  885.             else if (SelectedIndex == i)
  886.             {
  887.                 using (SolidBrush B = new SolidBrush(Helpers.GreyColor(240)))
  888.                 {
  889.                     G.FillRectangle(B, new Rectangle(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2, GetTabRect(i).Width, GetTabRect(i).Height + 1));
  890.                 }
  891.  
  892.                 using (Pen P = new Pen(Color.FromArgb(255, 149, 0), 4))
  893.                 {
  894.                     G.DrawLine(P, new Point(TabRect.X - 2, TabRect.Y + ItemSize.Height - 2), new Point(TabRect.X + TabRect.Width - 2, TabRect.Y + ItemSize.Height - 2));
  895.                 }
  896.  
  897.             }
  898.             else if (!(SelectedIndex == i))
  899.             {
  900.                 G.FillRectangle(Brushes.White, GetTabRect(i));
  901.             }
  902.  
  903.             using (SolidBrush B = new SolidBrush(Color.FromArgb(56, 69, 80)))
  904.             {
  905.                 Helpers.CenterStringTab(G, TabPages[i].Text, Theme.GlobalFont(FontStyle.Regular, 10), B, GetTabRect(i));
  906.             }
  907.  
  908.         }
  909.  
  910.         using (Pen P = new Pen(Helpers.GreyColor(200)))
  911.         {
  912.             G.DrawLine(P, new Point(0, ItemSize.Height + 2), new Point(Width, ItemSize.Height + 2));
  913.         }
  914.  
  915.     }
  916.  
  917.     #endregion
  918.  
  919. }
  920.  
  921. class FirefoxMainTabControl : TabControl
  922. {
  923.  
  924.     #region " Private "
  925.     private Graphics G;
  926.     private Rectangle TabRect;
  927.     #endregion
  928.     private Color FC = Color.Blue;
  929.  
  930.     #region " Control "
  931.  
  932.     public FirefoxMainTabControl()
  933.     {
  934.         DoubleBuffered = true;
  935.         ItemSize = new Size(43, 152);
  936.         Alignment = TabAlignment.Left;
  937.         SizeMode = TabSizeMode.Fixed;
  938.     }
  939.  
  940.     protected override void OnCreateControl()
  941.     {
  942.         base.OnCreateControl();
  943.         SetStyle(ControlStyles.UserPaint, true);
  944.     }
  945.  
  946.     protected override void OnControlAdded(ControlEventArgs e)
  947.     {
  948.         base.OnControlAdded(e);
  949.         try
  950.         {
  951.             for (int i = 0; i <= TabPages.Count - 1; i++)
  952.             {
  953.                 TabPages[i].BackColor = Color.White;
  954.                 TabPages[i].ForeColor = Color.FromArgb(66, 79, 90);
  955.                 TabPages[i].Font = Theme.GlobalFont(FontStyle.Regular, 10);
  956.             }
  957.         }
  958.         catch
  959.         {
  960.         }
  961.     }
  962.  
  963.  
  964.     protected override void OnPaint(PaintEventArgs e)
  965.     {
  966.         G = e.Graphics;
  967.         G.SmoothingMode = SmoothingMode.HighQuality;
  968.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  969.  
  970.         base.OnPaint(e);
  971.  
  972.         G.Clear(Color.FromArgb(66, 79, 90));
  973.  
  974.  
  975.         for (int i = 0; i <= TabPages.Count - 1; i++)
  976.         {
  977.             TabRect = GetTabRect(i);
  978.  
  979.  
  980.             if (SelectedIndex == i)
  981.             {
  982.                 using (SolidBrush B = new SolidBrush(Color.FromArgb(52, 63, 72)))
  983.                 {
  984.                     G.FillRectangle(B, TabRect);
  985.                 }
  986.  
  987.                 FC = Helpers.GreyColor(245);
  988.  
  989.                 using (SolidBrush B = new SolidBrush(Color.FromArgb(255, 175, 54)))
  990.                 {
  991.                     G.FillRectangle(B, new Rectangle(TabRect.Location.X - 3, TabRect.Location.Y + 1, 5, TabRect.Height - 2));
  992.                 }
  993.  
  994.             }
  995.             else
  996.             {
  997.                 FC = Helpers.GreyColor(192);
  998.  
  999.                 using (SolidBrush B = new SolidBrush(Color.FromArgb(66, 79, 90)))
  1000.                 {
  1001.                     G.FillRectangle(B, TabRect);
  1002.                 }
  1003.  
  1004.             }
  1005.  
  1006.             using (SolidBrush B = new SolidBrush(FC))
  1007.             {
  1008.                 G.DrawString(TabPages[i].Text, Theme.GlobalFont(FontStyle.Regular, 10), B, new Point(TabRect.X + 50, TabRect.Y + 12));
  1009.             }
  1010.  
  1011.             if ((ImageList != null))
  1012.             {
  1013.                 if (!(TabPages[i].ImageIndex < 0))
  1014.                 {
  1015.                     G.DrawImage(ImageList.Images[TabPages[i].ImageIndex], new Rectangle(TabRect.X + 19, TabRect.Y + ((TabRect.Height / 2) - 10), 18, 18));
  1016.                 }
  1017.             }
  1018.  
  1019.         }
  1020.  
  1021.     }
  1022.  
  1023.     #endregion
  1024.  
  1025. }
  1026.  
  1027. [DefaultEvent("TextChanged")]
  1028. class FirefoxTextbox : Control
  1029. {
  1030.  
  1031.     #region " Private "
  1032.     private TextBox withEventsField_TB = new TextBox();
  1033.     private TextBox TB
  1034.     {
  1035.         get { return withEventsField_TB; }
  1036.         set
  1037.         {
  1038.             if (withEventsField_TB != null)
  1039.             {
  1040.                 withEventsField_TB.TextChanged -= new EventHandler(TextChangeTb);
  1041.             }
  1042.             withEventsField_TB = value;
  1043.             if (withEventsField_TB != null)
  1044.             {
  1045.                 withEventsField_TB.TextChanged += TextChangeTb;
  1046.             }
  1047.         }
  1048.     }
  1049.     private Graphics G;
  1050.     private Helpers.MouseState State;
  1051.  
  1052.     private bool IsDown;
  1053.     private bool _EnabledCalc;
  1054.     private bool _allowpassword = false;
  1055.     private int _maxChars = 32767;
  1056.     private HorizontalAlignment _textAlignment;
  1057.     private bool _multiLine = false;
  1058.     #endregion
  1059.     private bool _readOnly = false;
  1060.  
  1061.     #region " Properties "
  1062.  
  1063.     public new bool Enabled
  1064.     {
  1065.         get { return EnabledCalc; }
  1066.         set
  1067.         {
  1068.             TB.Enabled = value;
  1069.             _EnabledCalc = value;
  1070.             Invalidate();
  1071.         }
  1072.     }
  1073.  
  1074.     [DisplayName("Enabled")]
  1075.     public bool EnabledCalc
  1076.     {
  1077.         get { return _EnabledCalc; }
  1078.         set
  1079.         {
  1080.             Enabled = value;
  1081.             Invalidate();
  1082.         }
  1083.     }
  1084.  
  1085.     public new bool UseSystemPasswordChar
  1086.     {
  1087.         get { return _allowpassword; }
  1088.         set
  1089.         {
  1090.             TB.UseSystemPasswordChar = UseSystemPasswordChar;
  1091.             _allowpassword = value;
  1092.             Invalidate();
  1093.         }
  1094.     }
  1095.  
  1096.     public new int MaxLength
  1097.     {
  1098.         get { return _maxChars; }
  1099.         set
  1100.         {
  1101.             _maxChars = value;
  1102.             TB.MaxLength = MaxLength;
  1103.             Invalidate();
  1104.         }
  1105.     }
  1106.  
  1107.     public new HorizontalAlignment TextAlign
  1108.     {
  1109.         get { return _textAlignment; }
  1110.         set
  1111.         {
  1112.             _textAlignment = value;
  1113.             Invalidate();
  1114.         }
  1115.     }
  1116.  
  1117.     public new bool MultiLine
  1118.     {
  1119.         get { return _multiLine; }
  1120.         set
  1121.         {
  1122.             _multiLine = value;
  1123.             TB.Multiline = value;
  1124.             OnResize(EventArgs.Empty);
  1125.             Invalidate();
  1126.         }
  1127.     }
  1128.  
  1129.     public new bool ReadOnly
  1130.     {
  1131.         get { return _readOnly; }
  1132.         set
  1133.         {
  1134.             _readOnly = value;
  1135.             if (TB != null)
  1136.             {
  1137.                 TB.ReadOnly = value;
  1138.             }
  1139.         }
  1140.     }
  1141.  
  1142.     #endregion
  1143.  
  1144.     #region " Control "
  1145.  
  1146.     protected override void OnTextChanged(EventArgs e)
  1147.     {
  1148.         base.OnTextChanged(e);
  1149.         Invalidate();
  1150.     }
  1151.  
  1152.     protected override void OnBackColorChanged(EventArgs e)
  1153.     {
  1154.         base.OnBackColorChanged(e);
  1155.         Invalidate();
  1156.     }
  1157.  
  1158.     protected override void OnForeColorChanged(EventArgs e)
  1159.     {
  1160.         base.OnForeColorChanged(e);
  1161.         TB.ForeColor = ForeColor;
  1162.         Invalidate();
  1163.     }
  1164.  
  1165.     protected override void OnFontChanged(EventArgs e)
  1166.     {
  1167.         base.OnFontChanged(e);
  1168.         TB.Font = Font;
  1169.     }
  1170.  
  1171.     protected override void OnGotFocus(EventArgs e)
  1172.     {
  1173.         base.OnGotFocus(e);
  1174.         TB.Focus();
  1175.     }
  1176.  
  1177.     private void TextChangeTb(object sender, EventArgs e)
  1178.     {
  1179.         Text = TB.Text;
  1180.     }
  1181.  
  1182.     private void TextChng(object sender, EventArgs e)
  1183.     {
  1184.         TB.Text = Text;
  1185.     }
  1186.  
  1187.     public void NewTextBox()
  1188.     {
  1189.         var _with1 = TB;
  1190.         _with1.Text = string.Empty;
  1191.         _with1.BackColor = Color.White;
  1192.         _with1.ForeColor = Color.FromArgb(66, 78, 90);
  1193.         _with1.TextAlign = HorizontalAlignment.Left;
  1194.         _with1.BorderStyle = BorderStyle.None;
  1195.         _with1.Location = new Point(3, 3);
  1196.         _with1.Font = Theme.GlobalFont(FontStyle.Regular, 10);
  1197.         _with1.Size = new Size(Width - 3, Height - 3);
  1198.         _with1.UseSystemPasswordChar = UseSystemPasswordChar;
  1199.     }
  1200.  
  1201.     public FirefoxTextbox()
  1202.         : base()
  1203.     {
  1204.         TextChanged += new EventHandler(TextChng);
  1205.         NewTextBox();
  1206.         Controls.Add(TB);
  1207.         SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
  1208.         DoubleBuffered = true;
  1209.         TextAlign = HorizontalAlignment.Left;
  1210.         ForeColor = Color.FromArgb(66, 78, 90);
  1211.         Font = Theme.GlobalFont(FontStyle.Regular, 10);
  1212.         Size = new Size(130, 29);
  1213.         Enabled = true;
  1214.     }
  1215.  
  1216.  
  1217.     protected override void OnPaint(PaintEventArgs e)
  1218.     {
  1219.         G = e.Graphics;
  1220.         G.SmoothingMode = SmoothingMode.HighQuality;
  1221.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  1222.  
  1223.         base.OnPaint(e);
  1224.  
  1225.         G.Clear(Parent.BackColor);
  1226.  
  1227.  
  1228.         if (Enabled)
  1229.         {
  1230.             TB.ForeColor = Color.FromArgb(66, 78, 90);
  1231.  
  1232.             if (State == Helpers.MouseState.Down)
  1233.             {
  1234.                 Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 3, Color.FromArgb(44, 156, 218));
  1235.             }
  1236.             else
  1237.             {
  1238.                 Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 3, Helpers.GreyColor(200));
  1239.             }
  1240.  
  1241.         }
  1242.         else
  1243.         {
  1244.             TB.ForeColor = Helpers.GreyColor(170);
  1245.             Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 3, Helpers.GreyColor(230));
  1246.         }
  1247.  
  1248.         TB.TextAlign = TextAlign;
  1249.         TB.UseSystemPasswordChar = UseSystemPasswordChar;
  1250.  
  1251.     }
  1252.  
  1253.     protected override void OnResize(EventArgs e)
  1254.     {
  1255.         base.OnResize(e);
  1256.         if (!MultiLine)
  1257.         {
  1258.             int tbheight = TB.Height;
  1259.             TB.Location = new Point(10, Convert.ToInt32(((Height / 2) - (tbheight / 2) - 0)));
  1260.             TB.Size = new Size(Width - 20, tbheight);
  1261.         }
  1262.         else
  1263.         {
  1264.             TB.Location = new Point(10, 10);
  1265.             TB.Size = new Size(Width - 20, Height - 20);
  1266.         }
  1267.     }
  1268.  
  1269.     protected override void OnEnter(EventArgs e)
  1270.     {
  1271.         base.OnEnter(e);
  1272.         State = Helpers.MouseState.Down;
  1273.         Invalidate();
  1274.     }
  1275.  
  1276.     protected override void OnLeave(EventArgs e)
  1277.     {
  1278.         base.OnLeave(e);
  1279.         State = Helpers.MouseState.None;
  1280.         Invalidate();
  1281.     }
  1282.  
  1283.     #endregion
  1284.  
  1285. }
  1286.  
  1287. class FirefoxNumericUpDown : Control
  1288. {
  1289.  
  1290.     #region " Private "
  1291.     private Graphics G;
  1292.     private int _Value;
  1293.     private int _Min;
  1294.     private int _Max;
  1295.     private Point Loc;
  1296.     private bool Down;
  1297.     private bool _EnabledCalc;
  1298.     #endregion
  1299.     private Color ETC = Color.Blue;
  1300.  
  1301.     #region " Properties "
  1302.  
  1303.     public new bool Enabled
  1304.     {
  1305.         get { return EnabledCalc; }
  1306.         set
  1307.         {
  1308.             _EnabledCalc = value;
  1309.             Invalidate();
  1310.         }
  1311.     }
  1312.  
  1313.     [DisplayName("Enabled")]
  1314.     public bool EnabledCalc
  1315.     {
  1316.         get { return _EnabledCalc; }
  1317.         set
  1318.         {
  1319.             Enabled = value;
  1320.             Invalidate();
  1321.         }
  1322.     }
  1323.  
  1324.     public int Value
  1325.     {
  1326.         get { return _Value; }
  1327.  
  1328.         set
  1329.         {
  1330.             if (value <= _Max & value >= Minimum)
  1331.             {
  1332.                 _Value = value;
  1333.             }
  1334.  
  1335.             Invalidate();
  1336.  
  1337.         }
  1338.     }
  1339.  
  1340.     public int Minimum
  1341.     {
  1342.         get { return _Min; }
  1343.  
  1344.         set
  1345.         {
  1346.             if (value < Maximum)
  1347.             {
  1348.                 _Min = value;
  1349.             }
  1350.  
  1351.             if (value < Minimum)
  1352.             {
  1353.                 value = Minimum;
  1354.             }
  1355.  
  1356.             Invalidate();
  1357.         }
  1358.     }
  1359.  
  1360.     public int Maximum
  1361.     {
  1362.         get { return _Max; }
  1363.  
  1364.         set
  1365.         {
  1366.             if (value > Minimum)
  1367.             {
  1368.                 _Max = value;
  1369.             }
  1370.  
  1371.             if (value > Maximum)
  1372.             {
  1373.                 value = Maximum;
  1374.             }
  1375.  
  1376.             Invalidate();
  1377.         }
  1378.     }
  1379.  
  1380.     #endregion
  1381.  
  1382.     #region " Control "
  1383.  
  1384.     public FirefoxNumericUpDown()
  1385.     {
  1386.         DoubleBuffered = true;
  1387.         Value = 0;
  1388.         Minimum = 0;
  1389.         Maximum = 100;
  1390.         Cursor = Cursors.IBeam;
  1391.         BackColor = Color.White;
  1392.         ForeColor = Color.FromArgb(66, 78, 90);
  1393.         Font = Theme.GlobalFont(FontStyle.Regular, 10);
  1394.         Enabled = true;
  1395.     }
  1396.  
  1397.     protected override void OnMouseMove(MouseEventArgs e)
  1398.     {
  1399.         base.OnMouseMove(e);
  1400.         Loc.X = e.X;
  1401.         Loc.Y = e.Y;
  1402.         Invalidate();
  1403.  
  1404.         if (Loc.X < Width - 23)
  1405.         {
  1406.             Cursor = Cursors.IBeam;
  1407.         }
  1408.         else
  1409.         {
  1410.             Cursor = Cursors.Default;
  1411.         }
  1412.  
  1413.     }
  1414.  
  1415.     protected override void OnResize(EventArgs e)
  1416.     {
  1417.         base.OnResize(e);
  1418.         Height = 30;
  1419.     }
  1420.  
  1421.     protected override void OnMouseDown(MouseEventArgs e)
  1422.     {
  1423.         base.OnMouseClick(e);
  1424.  
  1425.  
  1426.         if (Enabled)
  1427.         {
  1428.             if (Loc.X > Width - 21 && Loc.X < Width - 3)
  1429.             {
  1430.                 if (Loc.Y < 15)
  1431.                 {
  1432.                     if ((Value + 1) <= Maximum)
  1433.                     {
  1434.                         Value += 1;
  1435.                     }
  1436.                 }
  1437.                 else
  1438.                 {
  1439.                     if ((Value - 1) >= Minimum)
  1440.                     {
  1441.                         Value -= 1;
  1442.                     }
  1443.                 }
  1444.             }
  1445.             else
  1446.             {
  1447.                 Down = !Down;
  1448.                 Focus();
  1449.             }
  1450.  
  1451.         }
  1452.  
  1453.         Invalidate();
  1454.     }
  1455.  
  1456.     protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
  1457.     {
  1458.         base.OnKeyPress(e);
  1459.         try
  1460.         {
  1461.             if (Down)
  1462.             {
  1463.                 Value = Convert.ToInt32(Value.ToString() + e.KeyChar.ToString());
  1464.             }
  1465.  
  1466.             if (Value > Maximum)
  1467.             {
  1468.                 Value = Maximum;
  1469.             }
  1470.  
  1471.         }
  1472.         catch
  1473.         {
  1474.         }
  1475.     }
  1476.  
  1477.     protected override void OnKeyUp(System.Windows.Forms.KeyEventArgs e)
  1478.     {
  1479.         base.OnKeyUp(e);
  1480.  
  1481.  
  1482.         if (e.KeyCode == Keys.Up)
  1483.         {
  1484.             if ((Value + 1) <= Maximum)
  1485.             {
  1486.                 Value += 1;
  1487.             }
  1488.  
  1489.             Invalidate();
  1490.  
  1491.  
  1492.         }
  1493.         else if (e.KeyCode == Keys.Down)
  1494.         {
  1495.             if ((Value - 1) >= Minimum)
  1496.             {
  1497.                 Value -= 1;
  1498.             }
  1499.  
  1500.         }
  1501.         else if (e.KeyCode == Keys.Back)
  1502.         {
  1503.             string BC = Value.ToString();
  1504.             BC = BC.Remove(Convert.ToInt32(BC.Length - 1));
  1505.  
  1506.             if ((BC.Length == 0))
  1507.             {
  1508.                 BC = "0";
  1509.             }
  1510.  
  1511.             Value = Convert.ToInt32(BC);
  1512.  
  1513.         }
  1514.  
  1515.         Invalidate();
  1516.  
  1517.     }
  1518.  
  1519.     protected override void OnPaint(PaintEventArgs e)
  1520.     {
  1521.         G = e.Graphics;
  1522.         G.SmoothingMode = SmoothingMode.HighQuality;
  1523.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  1524.  
  1525.         base.OnPaint(e);
  1526.  
  1527.         G.Clear(Parent.BackColor);
  1528.  
  1529.  
  1530.         if (Enabled)
  1531.         {
  1532.             ETC = Color.FromArgb(66, 78, 90);
  1533.  
  1534.             using (Pen P = new Pen(Helpers.GreyColor(190)))
  1535.             {
  1536.                 Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 2, Helpers.GreyColor(190));
  1537.                 G.DrawLine(P, new Point(Width - 24, (int)13.5f), new Point(Width - 5, (int)13.5f));
  1538.             }
  1539.  
  1540.             Helpers.DrawRoundRect(G, new Rectangle(Width - 24, 4, 19, 21), 3, Helpers.GreyColor(200));
  1541.  
  1542.         }
  1543.         else
  1544.         {
  1545.             ETC = Helpers.GreyColor(170);
  1546.  
  1547.             using (Pen P = new Pen(Helpers.GreyColor(230)))
  1548.             {
  1549.                 Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 2, Helpers.GreyColor(190));
  1550.                 G.DrawLine(P, new Point(Width - 24, (int)13.5f), new Point(Width - 5, (int)13.5f));
  1551.             }
  1552.  
  1553.             Helpers.DrawRoundRect(G, new Rectangle(Width - 24, 4, 19, 21), 3, Helpers.GreyColor(220));
  1554.  
  1555.         }
  1556.  
  1557.         using (SolidBrush B = new SolidBrush(ETC))
  1558.         {
  1559.             G.DrawString("t", new Font("Marlett", 8, FontStyle.Bold), B, new Point(Width - 22, 5));
  1560.             G.DrawString("u", new Font("Marlett", 8, FontStyle.Bold), B, new Point(Width - 22, 13));
  1561.             Helpers.CenterString(G, Value.ToString(), new Font("Segoe UI", 10), ETC, new Rectangle(Width / 2 - 10, 0, Width - 5, Height));
  1562.         }
  1563.  
  1564.     }
  1565.  
  1566.     #endregion
  1567.  
  1568. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement