Guest User

Untitled

a guest
Jun 29th, 2013
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 89.33 KB | None | 0 0
  1. using System.Drawing.Drawing2D;
  2. using System.ComponentModel;
  3. using System.Windows.Forms;
  4. using System.Drawing;
  5. using System;
  6. /// <summary>
  7. /// Flat UI Theme
  8. /// Creator: iSynthesis (HF)
  9. /// Version: 1.0.4
  10. /// Date Created: 17/06/2013
  11. /// Date Changed: 26/06/2013
  12. /// UID: 374648
  13. /// For any bugs / errors, PM me.
  14. /// </summary>
  15. /// <remarks></remarks>
  16.  
  17. static class Helpers
  18. {
  19.  
  20.     #region " Variables"
  21.     static internal Graphics G;
  22.     static internal Bitmap B;
  23.     static internal Color _FlatColor = Color.FromArgb(35, 168, 109);
  24.     static internal StringFormat NearSF = new StringFormat {
  25.         Alignment = StringAlignment.Near,
  26.         LineAlignment = StringAlignment.Near
  27.     };
  28.     static internal StringFormat CenterSF = new StringFormat {
  29.         Alignment = StringAlignment.Center,
  30.         LineAlignment = StringAlignment.Center
  31.         #endregion
  32.     };
  33.  
  34.     #region " Functions"
  35.  
  36.     public static GraphicsPath RoundRec(Rectangle Rectangle, int Curve)
  37.     {
  38.         GraphicsPath P = new GraphicsPath();
  39.         int ArcRectangleWidth = Curve * 2;
  40.         P.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90);
  41.         P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90);
  42.         P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90);
  43.         P.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90);
  44.         P.AddLine(new Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
  45.         return P;
  46.     }
  47.  
  48.     public static GraphicsPath RoundRect(int x, int y, int w, int h, double r = 0.3, bool TL = true, bool TR = true, bool BR = true, bool BL = true)
  49.     {
  50.         GraphicsPath functionReturnValue = default(GraphicsPath);
  51.         int d = Math.Min(w, h) * (int)r, xw = x + w, yh = y + h;
  52.         functionReturnValue = new GraphicsPath();
  53.  
  54.         {
  55.             if (TL)
  56.                 functionReturnValue.AddArc(x, y, d, d, 180, 90);
  57.             else
  58.                 functionReturnValue.AddLine(x, y, x, y);
  59.             if (TR)
  60.                 functionReturnValue.AddArc(xw - d, y, d, d, 270, 90);
  61.             else
  62.                 functionReturnValue.AddLine(xw, y, xw, y);
  63.             if (BR)
  64.                 functionReturnValue.AddArc(xw - d, yh - d, d, d, 0, 90);
  65.             else
  66.                 functionReturnValue.AddLine(xw, yh, xw, yh);
  67.             if (BL)
  68.                 functionReturnValue.AddArc(x, yh - d, d, d, 90, 90);
  69.             else
  70.                 functionReturnValue.AddLine(x, yh, x, yh);
  71.  
  72.             functionReturnValue.CloseFigure();
  73.         }
  74.         return functionReturnValue;
  75.     }
  76.  
  77.     //-- Credit: AeonHack
  78.     public static GraphicsPath DrawArrow(int x, int y, bool flip)
  79.     {
  80.         GraphicsPath GP = new GraphicsPath();
  81.  
  82.         int W = 12;
  83.         int H = 6;
  84.  
  85.         if (flip) {
  86.             GP.AddLine(x + 1, y, x + W + 1, y);
  87.             GP.AddLine(x + W, y, x + H, y + H - 1);
  88.         } else {
  89.             GP.AddLine(x, y + H, x + W, y + H);
  90.             GP.AddLine(x + W, y + H, x + H, y);
  91.         }
  92.  
  93.         GP.CloseFigure();
  94.         return GP;
  95.     }
  96.  
  97.     #endregion
  98.  
  99. }
  100.  
  101. #region " Mouse States"
  102.  
  103. enum MouseState : byte
  104. {
  105.     None = 0,
  106.     Over = 1,
  107.     Down = 2,
  108.     Block = 3
  109. }
  110.  
  111. #endregion
  112.  
  113. class FormSkin : ContainerControl
  114. {
  115.  
  116.     #region " Variables"
  117.  
  118.     private int W;
  119.     private int H;
  120.     private bool Cap = false;
  121.     private bool _HeaderMaximize = false;
  122.     private Point MousePoint = new Point(0, 0);
  123.     private Color _FlatColor;
  124.     private int MoveHeight = 50;
  125.     #endregion
  126.  
  127.     #region " Properties"
  128.  
  129.     #region " Colors"
  130.  
  131.     [Category("Colors")]
  132.     public Color HeaderColor {
  133.         get { return _HeaderColor; }
  134.         set { _HeaderColor = value; }
  135.     }
  136.     [Category("Colors")]
  137.     public Color BaseColor {
  138.         get { return _BaseColor; }
  139.         set { _BaseColor = value; }
  140.     }
  141.     [Category("Colors")]
  142.     public Color BorderColor {
  143.         get { return _BorderColor; }
  144.         set { _BorderColor = value; }
  145.     }
  146.     [Category("Colors")]
  147.     public Color FlatColor {
  148.         get { return _FlatColor; }
  149.         set { _FlatColor = value; }
  150.     }
  151.  
  152.     #endregion
  153.  
  154.     #region " Options"
  155.  
  156.     [Category("Options")]
  157.     public bool HeaderMaximize {
  158.         get { return _HeaderMaximize; }
  159.         set { _HeaderMaximize = value; }
  160.     }
  161.  
  162.     #endregion
  163.  
  164.     protected override void OnMouseDown(MouseEventArgs e)
  165.     {
  166.         base.OnMouseDown(e);
  167.         if (e.Button == System.Windows.Forms.MouseButtons.Left & new Rectangle(0, 0, Width, MoveHeight).Contains(e.Location)) {
  168.             Cap = true;
  169.             MousePoint = e.Location;
  170.         }
  171.     }
  172.  
  173.     private void  // ERROR: Handles clauses are not supported in C#
  174. FormSkin_MouseDoubleClick(object sender, MouseEventArgs e)
  175.     {
  176.         if (HeaderMaximize) {
  177.             if (e.Button == System.Windows.Forms.MouseButtons.Left & new Rectangle(0, 0, Width, MoveHeight).Contains(e.Location)) {
  178.                 if (FindForm().WindowState == FormWindowState.Normal) {
  179.                     FindForm().WindowState = FormWindowState.Maximized;
  180.                     FindForm().Refresh();
  181.                 } else if (FindForm().WindowState == FormWindowState.Maximized) {
  182.                     FindForm().WindowState = FormWindowState.Normal;
  183.                     FindForm().Refresh();
  184.                 }
  185.             }
  186.         }
  187.     }
  188.  
  189.     protected override void OnMouseUp(MouseEventArgs e)
  190.     {
  191.         base.OnMouseUp(e);
  192.         Cap = false;
  193.     }
  194.  
  195.     protected override void OnMouseMove(MouseEventArgs e)
  196.     {
  197.         base.OnMouseMove(e);
  198.         if (Cap) {
  199.             Parent.Location = new Point(MousePosition.X-MousePoint.X,MousePosition.Y-MousePoint.Y);
  200.         }
  201.     }
  202.  
  203.     protected override void OnCreateControl()
  204.     {
  205.         base.OnCreateControl();
  206.         ParentForm.FormBorderStyle = FormBorderStyle.None;
  207.         ParentForm.AllowTransparency = false;
  208.         ParentForm.TransparencyKey = Color.Fuchsia;
  209.         ParentForm.FindForm().StartPosition = FormStartPosition.CenterScreen;
  210.         Dock = DockStyle.Fill;
  211.         Invalidate();
  212.     }
  213.  
  214.     #endregion
  215.  
  216.     #region " Colors"
  217.  
  218.     #region " Dark Colors"
  219.  
  220.     private Color _HeaderColor = Color.FromArgb(45, 47, 49);
  221.     private Color _BaseColor = Color.FromArgb(60, 70, 73);
  222.     private Color _BorderColor = Color.FromArgb(53, 58, 60);
  223.  
  224.     private Color TextColor = Color.FromArgb(234, 234, 234);
  225.     #endregion
  226.  
  227.     #region " Light Colors"
  228.  
  229.     private Color _HeaderLight = Color.FromArgb(171, 171, 172);
  230.     private Color _BaseLight = Color.FromArgb(196, 199, 200);
  231.  
  232.     public Color TextLight = Color.FromArgb(45, 47, 49);
  233.     #endregion
  234.  
  235.     #endregion
  236.  
  237.     public FormSkin()
  238.     {
  239.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  240.         DoubleBuffered = true;
  241.         BackColor = Color.White;
  242.         Font = new Font("Segoe UI", 12);
  243.     }
  244.  
  245.     protected override void OnPaint(PaintEventArgs e)
  246.     {
  247.         B = new Bitmap(Width, Height);
  248.         G = Graphics.FromImage(B);
  249.         W = Width;
  250.         H = Height;
  251.  
  252.         Rectangle Base = new Rectangle(0, 0, W, H);
  253.         Rectangle Header = new Rectangle(0, 0, W, 50);
  254.  
  255.         {
  256.             G.SmoothingMode = 2;
  257.             G.PixelOffsetMode = 2;
  258.             G.TextRenderingHint = 5;
  259.             G.Clear(BackColor);
  260.  
  261.             //-- Base
  262.             G.FillRectangle(new SolidBrush(_BaseColor), Base);
  263.  
  264.             //-- Header
  265.             G.FillRectangle(new SolidBrush(_HeaderColor), Header);
  266.  
  267.             //-- Logo
  268.             G.FillRectangle(new SolidBrush(Color.FromArgb(243, 243, 243)), new Rectangle(8, 16, 4, 18));
  269.             G.FillRectangle(new SolidBrush(_FlatColor), 16, 16, 4, 18);
  270.             G.DrawString(Text, Font, new SolidBrush(TextColor), new Rectangle(26, 15, W, H), NearSF);
  271.  
  272.             //-- Border
  273.             G.DrawRectangle(new Pen(_BorderColor), Base);
  274.         }
  275.  
  276.         base.OnPaint(e);
  277.         G.Dispose();
  278.         e.Graphics.InterpolationMode = (InterpolationMode)7;
  279.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  280.         B.Dispose();
  281.     }
  282. }
  283.  
  284. class FlatClose : Control
  285. {
  286.  
  287.     #region " Variables"
  288.  
  289.     private MouseState State = MouseState.None;
  290.  
  291.     private int x;
  292.     #endregion
  293.  
  294.     #region " Properties"
  295.  
  296.     #region " Mouse States"
  297.  
  298.     protected override void OnMouseEnter(EventArgs e)
  299.     {
  300.         base.OnMouseEnter(e);
  301.         State = MouseState.Over;
  302.         Invalidate();
  303.     }
  304.     protected override void OnMouseDown(MouseEventArgs e)
  305.     {
  306.         base.OnMouseDown(e);
  307.         State = MouseState.Down;
  308.         Invalidate();
  309.     }
  310.     protected override void OnMouseLeave(EventArgs e)
  311.     {
  312.         base.OnMouseLeave(e);
  313.         State = MouseState.None;
  314.         Invalidate();
  315.     }
  316.     protected override void OnMouseUp(MouseEventArgs e)
  317.     {
  318.         base.OnMouseUp(e);
  319.         State = MouseState.Over;
  320.         Invalidate();
  321.     }
  322.     protected override void OnMouseMove(MouseEventArgs e)
  323.     {
  324.         base.OnMouseMove(e);
  325.         x = e.X;
  326.         Invalidate();
  327.     }
  328.  
  329.     protected override void OnClick(EventArgs e)
  330.     {
  331.         base.OnClick(e);
  332.         Environment.Exit(0);
  333.     }
  334.  
  335.     #endregion
  336.  
  337.     protected override void OnResize(EventArgs e)
  338.     {
  339.         base.OnResize(e);
  340.         Size = new Size(18, 18);
  341.     }
  342.  
  343.     #region " Colors"
  344.  
  345.     [Category("Colors")]
  346.     public Color BaseColor {
  347.         get { return _BaseColor; }
  348.         set { _BaseColor = value; }
  349.     }
  350.  
  351.     [Category("Colors")]
  352.     public Color TextColor {
  353.         get { return _TextColor; }
  354.         set { _TextColor = value; }
  355.     }
  356.  
  357.     #endregion
  358.  
  359.     #endregion
  360.  
  361.     #region " Colors"
  362.  
  363.     private Color _BaseColor = Color.FromArgb(168, 35, 35);
  364.  
  365.     private Color _TextColor = Color.FromArgb(243, 243, 243);
  366.     #endregion
  367.  
  368.     public FlatClose()
  369.     {
  370.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  371.         DoubleBuffered = true;
  372.         BackColor = Color.White;
  373.         Size = new Size(18, 18);
  374.         Anchor = AnchorStyles.Top | AnchorStyles.Right;
  375.         Font = new Font("Marlett", 10);
  376.     }
  377.  
  378.     protected override void OnPaint(PaintEventArgs e)
  379.     {
  380.         Bitmap B = new Bitmap(Width, Height);
  381.         Graphics G = Graphics.FromImage(B);
  382.  
  383.         Rectangle Base = new Rectangle(0, 0, Width, Height);
  384.  
  385.         {
  386.             G.SmoothingMode = (SmoothingMode)2;
  387.             G.PixelOffsetMode = (PixelOffsetMode)2;
  388.             G.TextRenderingHint = ( System.Drawing.Text.TextRenderingHint)5;
  389.             G.Clear(BackColor);
  390.  
  391.             //-- Base
  392.             G.FillRectangle(new SolidBrush(_BaseColor), Base);
  393.  
  394.             //-- X
  395.             G.DrawString("r", Font, new SolidBrush(TextColor), new Rectangle(0, 0, Width, Height), CenterSF);
  396.  
  397.             //-- Hover/down
  398.             switch (State) {
  399.                 case MouseState.Over:
  400.                     G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.White)), Base);
  401.                     break;
  402.                 case MouseState.Down:
  403.                     G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.Black)), Base);
  404.                     break;
  405.             }
  406.         }
  407.  
  408.         base.OnPaint(e);
  409.         G.Dispose();
  410.         e.Graphics.InterpolationMode = (InterpolationMode)7;
  411.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  412.         B.Dispose();
  413.     }
  414. }
  415.  
  416. class FlatMax : Control
  417. {
  418.  
  419.     #region " Variables"
  420.  
  421.     private MouseState State = MouseState.None;
  422.  
  423.     private int x;
  424.     #endregion
  425.  
  426.     #region " Properties"
  427.  
  428.     #region " Mouse States"
  429.  
  430.     protected override void OnMouseEnter(EventArgs e)
  431.     {
  432.         base.OnMouseEnter(e);
  433.         State = MouseState.Over;
  434.         Invalidate();
  435.     }
  436.     protected override void OnMouseDown(MouseEventArgs e)
  437.     {
  438.         base.OnMouseDown(e);
  439.         State = MouseState.Down;
  440.         Invalidate();
  441.     }
  442.     protected override void OnMouseLeave(EventArgs e)
  443.     {
  444.         base.OnMouseLeave(e);
  445.         State = MouseState.None;
  446.         Invalidate();
  447.     }
  448.     protected override void OnMouseUp(MouseEventArgs e)
  449.     {
  450.         base.OnMouseUp(e);
  451.         State = MouseState.Over;
  452.         Invalidate();
  453.     }
  454.     protected override void OnMouseMove(MouseEventArgs e)
  455.     {
  456.         base.OnMouseMove(e);
  457.         x = e.X;
  458.         Invalidate();
  459.     }
  460.  
  461.     protected override void OnClick(EventArgs e)
  462.     {
  463.         base.OnClick(e);
  464.         switch (FindForm().WindowState) {
  465.             case FormWindowState.Maximized:
  466.                 FindForm().WindowState = FormWindowState.Normal;
  467.                 break;
  468.             case FormWindowState.Normal:
  469.                 FindForm().WindowState = FormWindowState.Maximized;
  470.                 break;
  471.         }
  472.     }
  473.  
  474.     #endregion
  475.  
  476.     #region " Colors"
  477.  
  478.     [Category("Colors")]
  479.     public Color BaseColor {
  480.         get { return _BaseColor; }
  481.         set { _BaseColor = value; }
  482.     }
  483.  
  484.     [Category("Colors")]
  485.     public Color TextColor {
  486.         get { return _TextColor; }
  487.         set { _TextColor = value; }
  488.     }
  489.  
  490.     #endregion
  491.  
  492.     protected override void OnResize(EventArgs e)
  493.     {
  494.         base.OnResize(e);
  495.         Size = new Size(18, 18);
  496.     }
  497.  
  498.     #endregion
  499.  
  500.     #region " Colors"
  501.  
  502.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  503.  
  504.     private Color _TextColor = Color.FromArgb(243, 243, 243);
  505.     #endregion
  506.  
  507.     public FlatMax()
  508.     {
  509.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  510.         DoubleBuffered = true;
  511.         BackColor = Color.White;
  512.         Size = new Size(18, 18);
  513.         Anchor = AnchorStyles.Top | AnchorStyles.Right;
  514.         Font = new Font("Marlett", 12);
  515.     }
  516.  
  517.     protected override void OnPaint(PaintEventArgs e)
  518.     {
  519.         Bitmap B = new Bitmap(Width, Height);
  520.         Graphics G = Graphics.FromImage(B);
  521.  
  522.         Rectangle Base = new Rectangle(0, 0, Width, Height);
  523.  
  524.         {
  525.             G.SmoothingMode = (SmoothingMode)2;
  526.             G.PixelOffsetMode = (PixelOffsetMode)2;
  527.             G.TextRenderingHint = ( System.Drawing.Text.TextRenderingHint)5;
  528.             G.Clear(BackColor);
  529.  
  530.             //-- Base
  531.             G.FillRectangle(new SolidBrush(_BaseColor), Base);
  532.  
  533.             //-- Maximize
  534.             if (FindForm().WindowState == FormWindowState.Maximized) {
  535.                 G.DrawString("1", Font, new SolidBrush(TextColor), new Rectangle(1, 1, Width, Height), CenterSF);
  536.             } else if (FindForm().WindowState == FormWindowState.Normal) {
  537.                 G.DrawString("2", Font, new SolidBrush(TextColor), new Rectangle(1, 1, Width, Height), CenterSF);
  538.             }
  539.  
  540.             //-- Hover/down
  541.             switch (State) {
  542.                 case MouseState.Over:
  543.                     G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.White)), Base);
  544.                     break;
  545.                 case MouseState.Down:
  546.                     G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.Black)), Base);
  547.                     break;
  548.             }
  549.         }
  550.  
  551.         base.OnPaint(e);
  552.         G.Dispose();
  553.         e.Graphics.InterpolationMode = (InterpolationMode)7;
  554.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  555.         B.Dispose();
  556.     }
  557. }
  558.  
  559. class FlatMini : Control
  560. {
  561.  
  562.     #region " Variables"
  563.  
  564.     private MouseState State = MouseState.None;
  565.  
  566.     private int x;
  567.     #endregion
  568.  
  569.     #region " Properties"
  570.  
  571.     #region " Mouse States"
  572.  
  573.     protected override void OnMouseEnter(EventArgs e)
  574.     {
  575.         base.OnMouseEnter(e);
  576.         State = MouseState.Over;
  577.         Invalidate();
  578.     }
  579.     protected override void OnMouseDown(MouseEventArgs e)
  580.     {
  581.         base.OnMouseDown(e);
  582.         State = MouseState.Down;
  583.         Invalidate();
  584.     }
  585.     protected override void OnMouseLeave(EventArgs e)
  586.     {
  587.         base.OnMouseLeave(e);
  588.         State = MouseState.None;
  589.         Invalidate();
  590.     }
  591.     protected override void OnMouseUp(MouseEventArgs e)
  592.     {
  593.         base.OnMouseUp(e);
  594.         State = MouseState.Over;
  595.         Invalidate();
  596.     }
  597.     protected override void OnMouseMove(MouseEventArgs e)
  598.     {
  599.         base.OnMouseMove(e);
  600.         x = e.X;
  601.         Invalidate();
  602.     }
  603.  
  604.     protected override void OnClick(EventArgs e)
  605.     {
  606.         base.OnClick(e);
  607.         switch (FindForm().WindowState) {
  608.             case FormWindowState.Normal:
  609.                 FindForm().WindowState = FormWindowState.Minimized;
  610.                 break;
  611.             case FormWindowState.Maximized:
  612.                 FindForm().WindowState = FormWindowState.Minimized;
  613.                 break;
  614.         }
  615.     }
  616.  
  617.     #endregion
  618.  
  619.     #region " Colors"
  620.  
  621.     [Category("Colors")]
  622.     public Color BaseColor {
  623.         get { return _BaseColor; }
  624.         set { _BaseColor = value; }
  625.     }
  626.  
  627.     [Category("Colors")]
  628.     public Color TextColor {
  629.         get { return _TextColor; }
  630.         set { _TextColor = value; }
  631.     }
  632.  
  633.     #endregion
  634.  
  635.     protected override void OnResize(EventArgs e)
  636.     {
  637.         base.OnResize(e);
  638.         Size = new Size(18, 18);
  639.     }
  640.  
  641.     #endregion
  642.  
  643.     #region " Colors"
  644.  
  645.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  646.  
  647.     private Color _TextColor = Color.FromArgb(243, 243, 243);
  648.     #endregion
  649.  
  650.     public FlatMini()
  651.     {
  652.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  653.         DoubleBuffered = true;
  654.         BackColor = Color.White;
  655.         Size = new Size(18, 18);
  656.         Anchor = AnchorStyles.Top | AnchorStyles.Right;
  657.         Font = new Font("Marlett", 12);
  658.     }
  659.  
  660.     protected override void OnPaint(PaintEventArgs e)
  661.     {
  662.         Bitmap B = new Bitmap(Width, Height);
  663.         Graphics G = Graphics.FromImage(B);
  664.  
  665.         Rectangle Base = new Rectangle(0, 0, Width, Height);
  666.  
  667.         {
  668.             G.SmoothingMode = (SmoothingMode)2;
  669.             G.PixelOffsetMode = (PixelOffsetMode)2;
  670.             G.TextRenderingHint =  (System.Drawing.Text.TextRenderingHint)5;
  671.             G.Clear(BackColor);
  672.  
  673.             //-- Base
  674.             G.FillRectangle(new SolidBrush(_BaseColor), Base);
  675.  
  676.             //-- Minimize
  677.             G.DrawString("0", Font, new SolidBrush(TextColor), new Rectangle(2, 1, Width, Height), CenterSF);
  678.  
  679.             //-- Hover/down
  680.             switch (State) {
  681.                 case MouseState.Over:
  682.                     G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.White)), Base);
  683.                     break;
  684.                 case MouseState.Down:
  685.                     G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.Black)), Base);
  686.                     break;
  687.             }
  688.         }
  689.  
  690.         base.OnPaint(e);
  691.         G.Dispose();
  692.         e.Graphics.InterpolationMode = (InterpolationMode)7;
  693.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  694.         B.Dispose();
  695.     }
  696. }
  697.  
  698. class FlatColorPalette : Control
  699. {
  700.  
  701.     #region " Variables"
  702.  
  703.     private int W;
  704.  
  705.     private int H;
  706.     #endregion
  707.  
  708.     #region " Properties"
  709.  
  710.     protected override void OnResize(EventArgs e)
  711.     {
  712.         base.OnResize(e);
  713.         Width = 180;
  714.         Height = 80;
  715.     }
  716.  
  717.     #region " Colors"
  718.  
  719.     [Category("Colors")]
  720.     public Color Red {
  721.         get { return _Red; }
  722.         set { _Red = value; }
  723.     }
  724.  
  725.     [Category("Colors")]
  726.     public Color Cyan {
  727.         get { return _Cyan; }
  728.         set { _Cyan = value; }
  729.     }
  730.  
  731.     [Category("Colors")]
  732.     public Color Blue {
  733.         get { return _Blue; }
  734.         set { _Blue = value; }
  735.     }
  736.  
  737.     [Category("Colors")]
  738.     public Color LimeGreen {
  739.         get { return _LimeGreen; }
  740.         set { _LimeGreen = value; }
  741.     }
  742.  
  743.     [Category("Colors")]
  744.     public Color Orange {
  745.         get { return _Orange; }
  746.         set { _Orange = value; }
  747.     }
  748.  
  749.     [Category("Colors")]
  750.     public Color Purple {
  751.         get { return _Purple; }
  752.         set { _Purple = value; }
  753.     }
  754.  
  755.     [Category("Colors")]
  756.     public Color Black {
  757.         get { return _Black; }
  758.         set { _Black = value; }
  759.     }
  760.  
  761.     [Category("Colors")]
  762.     public Color Gray {
  763.         get { return _Gray; }
  764.         set { _Gray = value; }
  765.     }
  766.  
  767.     [Category("Colors")]
  768.     public Color White {
  769.         get { return _White; }
  770.         set { _White = value; }
  771.     }
  772.  
  773.     #endregion
  774.  
  775.     #endregion
  776.  
  777.     #region " Colors"
  778.  
  779.     private Color _Red = Color.FromArgb(220, 85, 96);
  780.     private Color _Cyan = Color.FromArgb(10, 154, 157);
  781.     private Color _Blue = Color.FromArgb(0, 128, 255);
  782.     private Color _LimeGreen = Color.FromArgb(35, 168, 109);
  783.     private Color _Orange = Color.FromArgb(253, 181, 63);
  784.     private Color _Purple = Color.FromArgb(155, 88, 181);
  785.     private Color _Black = Color.FromArgb(45, 47, 49);
  786.     private Color _Gray = Color.FromArgb(63, 70, 73);
  787.  
  788.     private Color _White = Color.FromArgb(243, 243, 243);
  789.     #endregion
  790.  
  791.     public FlatColorPalette()
  792.     {
  793.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  794.         DoubleBuffered = true;
  795.         BackColor = Color.FromArgb(60, 70, 73);
  796.         Size = new Size(160, 80);
  797.         Font = new Font("Segoe UI", 12);
  798.     }
  799.  
  800.     protected override void OnPaint(PaintEventArgs e)
  801.     {
  802.         B = new Bitmap(Width, Height);
  803.         G = Graphics.FromImage(B);
  804.         W = Width - 1;
  805.         H = Height - 1;
  806.  
  807.         {
  808.             G.SmoothingMode = 2;
  809.             G.PixelOffsetMode = 2;
  810.             G.TextRenderingHint = 5;
  811.             G.Clear(BackColor);
  812.  
  813.             //-- Colors
  814.             G.FillRectangle(new SolidBrush(_Red), new Rectangle(0, 0, 20, 40));
  815.             G.FillRectangle(new SolidBrush(_Cyan), new Rectangle(20, 0, 20, 40));
  816.             G.FillRectangle(new SolidBrush(_Blue), new Rectangle(40, 0, 20, 40));
  817.             G.FillRectangle(new SolidBrush(_LimeGreen), new Rectangle(60, 0, 20, 40));
  818.             G.FillRectangle(new SolidBrush(_Orange), new Rectangle(80, 0, 20, 40));
  819.             G.FillRectangle(new SolidBrush(_Purple), new Rectangle(100, 0, 20, 40));
  820.             G.FillRectangle(new SolidBrush(_Black), new Rectangle(120, 0, 20, 40));
  821.             G.FillRectangle(new SolidBrush(_Gray), new Rectangle(140, 0, 20, 40));
  822.             G.FillRectangle(new SolidBrush(_White), new Rectangle(160, 0, 20, 40));
  823.  
  824.             //-- Text
  825.             G.DrawString("Color Palette", Font, new SolidBrush(_White), new Rectangle(0, 22, W, H), CenterSF);
  826.         }
  827.  
  828.         base.OnPaint(e);
  829.         G.Dispose();
  830.         e.Graphics.InterpolationMode = (InterpolationMode)7;
  831.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  832.         B.Dispose();
  833.     }
  834. }
  835.  
  836. class FlatGroupBox : ContainerControl
  837. {
  838.  
  839.     #region " Variables"
  840.  
  841.     private int W;
  842.     private int H;
  843.     private Color _FlatColor = Color.FromArgb(35, 168, 109);
  844.     private bool _ShowText = true;
  845.     #endregion
  846.  
  847.     #region " Properties"
  848.  
  849.     [Category("Colors")]
  850.     public Color BaseColor {
  851.         get { return _BaseColor; }
  852.         set { _BaseColor = value; }
  853.     }
  854.  
  855.     public bool ShowText {
  856.         get { return _ShowText; }
  857.         set { _ShowText = value; }
  858.     }
  859.  
  860.     #endregion
  861.  
  862.     #region " Colors"
  863.  
  864.  
  865.     private Color _BaseColor = Color.FromArgb(60, 70, 73);
  866.     #endregion
  867.  
  868.     public FlatGroupBox()
  869.     {
  870.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  871.         DoubleBuffered = true;
  872.         BackColor = Color.Transparent;
  873.         Size = new Size(240, 180);
  874.         Font = new Font("Segoe ui", 10);
  875.     }
  876.  
  877.     protected override void OnPaint(PaintEventArgs e)
  878.     {
  879.         B = new Bitmap(Width, Height);
  880.         G = Graphics.FromImage(B);
  881.         W = Width - 1;
  882.         H = Height - 1;
  883.  
  884.         GraphicsPath GP = default(GraphicsPath), GP2 = default(GraphicsPath), GP3 = new GraphicsPath();
  885.         Rectangle Base = new Rectangle(8, 8, W - 16, H - 16);
  886.  
  887.         {
  888.             G.SmoothingMode = 2;
  889.             G.PixelOffsetMode = 2;
  890.             G.TextRenderingHint = 5;
  891.             G.Clear(BackColor);
  892.  
  893.             //-- Base
  894.             GP = Helpers.RoundRec(Base, 8);
  895.             G.FillPath(new SolidBrush(_BaseColor), GP);
  896.  
  897.             //-- Arrows
  898.             GP2 = Helpers.DrawArrow(28, 2, false);
  899.             G.FillPath(new SolidBrush(_BaseColor), GP2);
  900.             GP3 = Helpers.DrawArrow(28, 8, true);
  901.             G.FillPath(new SolidBrush(Color.FromArgb(60, 70, 73)), GP3);
  902.  
  903.             //-- if ShowText
  904.             if (ShowText) {
  905.                 G.DrawString(Text, Font, new SolidBrush(_FlatColor), new Rectangle(16, 16, W, H), NearSF);
  906.             }
  907.         }
  908.  
  909.         base.OnPaint(e);
  910.         G.Dispose();
  911.         e.Graphics.InterpolationMode = (InterpolationMode)7;
  912.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  913.         B.Dispose();
  914.     }
  915. }
  916.  
  917. class FlatButton : Control
  918. {
  919.  
  920.     #region " Variables"
  921.  
  922.     private int W;
  923.     private int H;
  924.     private bool _Rounded = false;
  925.     private Color _FlatColor = Color.FromArgb(35, 168, 109);
  926.     private MouseState State = MouseState.None;
  927.     #endregion
  928.  
  929.     #region " Properties"
  930.  
  931.     #region " Colors"
  932.  
  933.     [Category("Colors")]
  934.     public Color BaseColor {
  935.         get { return _BaseColor; }
  936.         set { _BaseColor = value; }
  937.     }
  938.  
  939.     [Category("Colors")]
  940.     public Color TextColor {
  941.         get { return _TextColor; }
  942.         set { _TextColor = value; }
  943.     }
  944.  
  945.     [Category("Options")]
  946.     public bool Rounded {
  947.         get { return _Rounded; }
  948.         set { _Rounded = value; }
  949.     }
  950.  
  951.     #endregion
  952.  
  953.     #region " Mouse States"
  954.  
  955.     protected override void OnMouseDown(MouseEventArgs e)
  956.     {
  957.         base.OnMouseDown(e);
  958.         State = MouseState.Down;
  959.         Invalidate();
  960.     }
  961.     protected override void OnMouseUp(MouseEventArgs e)
  962.     {
  963.         base.OnMouseUp(e);
  964.         State = MouseState.Over;
  965.         Invalidate();
  966.     }
  967.     protected override void OnMouseEnter(EventArgs e)
  968.     {
  969.         base.OnMouseEnter(e);
  970.         State = MouseState.Over;
  971.         Invalidate();
  972.     }
  973.     protected override void OnMouseLeave(EventArgs e)
  974.     {
  975.         base.OnMouseLeave(e);
  976.         State = MouseState.None;
  977.         Invalidate();
  978.     }
  979.  
  980.     #endregion
  981.  
  982.     #endregion
  983.  
  984.     #region " Colors"
  985.  
  986.     private Color _BaseColor = Color.FromArgb(35, 168, 109);
  987.  
  988.     private Color _TextColor = Color.FromArgb(243, 243, 243);
  989.     #endregion
  990.  
  991.     public FlatButton()
  992.     {
  993.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  994.         DoubleBuffered = true;
  995.         Size = new Size(106, 32);
  996.         BackColor = Color.Transparent;
  997.         Font = new Font("Segoe UI", 12);
  998.         Cursor = Cursors.Hand;
  999.     }
  1000.  
  1001.     protected override void OnPaint(PaintEventArgs e)
  1002.     {
  1003.         B = new Bitmap(Width, Height);
  1004.         G = Graphics.FromImage(B);
  1005.         W = Width - 1;
  1006.         H = Height - 1;
  1007.  
  1008.         GraphicsPath GP = new GraphicsPath();
  1009.         Rectangle Base = new Rectangle(0, 0, W, H);
  1010.  
  1011.         {
  1012.             G.SmoothingMode = 2;
  1013.             G.PixelOffsetMode = 2;
  1014.             G.TextRenderingHint = 5;
  1015.             G.Clear(BackColor);
  1016.  
  1017.             switch (State) {
  1018.                 case MouseState.None:
  1019.                     if (Rounded) {
  1020.                         //-- Base
  1021.                         GP = Helpers.RoundRec(Base, 6);
  1022.                         G.FillPath(new SolidBrush(_BaseColor), GP);
  1023.  
  1024.                         //-- Text
  1025.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  1026.                     } else {
  1027.                         //-- Base
  1028.                         G.FillRectangle(new SolidBrush(_BaseColor), Base);
  1029.  
  1030.                         //-- Text
  1031.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  1032.                     }
  1033.                     break;
  1034.                 case MouseState.Over:
  1035.                     if (Rounded) {
  1036.                         //-- Base
  1037.                         GP = Helpers.RoundRec(Base, 6);
  1038.                         G.FillPath(new SolidBrush(_BaseColor), GP);
  1039.                         G.FillPath(new SolidBrush(Color.FromArgb(20, Color.White)), GP);
  1040.  
  1041.                         //-- Text
  1042.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  1043.                     } else {
  1044.                         //-- Base
  1045.                         G.FillRectangle(new SolidBrush(_BaseColor), Base);
  1046.                         G.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), Base);
  1047.  
  1048.                         //-- Text
  1049.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  1050.                     }
  1051.                     break;
  1052.                 case MouseState.Down:
  1053.                     if (Rounded) {
  1054.                         //-- Base
  1055.                         GP = Helpers.RoundRec(Base, 6);
  1056.                         G.FillPath(new SolidBrush(_BaseColor), GP);
  1057.                         G.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), GP);
  1058.  
  1059.                         //-- Text
  1060.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  1061.                     } else {
  1062.                         //-- Base
  1063.                         G.FillRectangle(new SolidBrush(_BaseColor), Base);
  1064.                         G.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.Black)), Base);
  1065.  
  1066.                         //-- Text
  1067.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  1068.                     }
  1069.                     break;
  1070.             }
  1071.         }
  1072.  
  1073.         base.OnPaint(e);
  1074.         G.Dispose();
  1075.         e.Graphics.InterpolationMode = (InterpolationMode)7;
  1076.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  1077.         B.Dispose();
  1078.     }
  1079. }
  1080.  
  1081. [DefaultEvent("CheckedChanged")]
  1082. class FlatToggle : Control
  1083. {
  1084.  
  1085.     #region " Variables"
  1086.  
  1087.     private int W;
  1088.     private int H;
  1089.     private _Options O;
  1090.     private bool _Checked = false;
  1091.     private Color _FlatColor = Color.FromArgb(35, 168, 109);
  1092.     private MouseState State = MouseState.None;
  1093.     #endregion
  1094.  
  1095.     #region " Properties"
  1096.     public event CheckedChangedEventHandler CheckedChanged;
  1097.     public delegate void CheckedChangedEventHandler(object sender);
  1098.  
  1099.     [Flags()]
  1100.     public enum _Options
  1101.     {
  1102.         Style1,
  1103.         Style2,
  1104.         Style3,
  1105.         Style4,
  1106.         //-- TODO: New Style
  1107.         Style5
  1108.         //-- TODO: New Style
  1109.     }
  1110.  
  1111.     #region " Options"
  1112.  
  1113.     [Category("Options")]
  1114.     public _Options Options {
  1115.         get { return O; }
  1116.         set { O = value; }
  1117.     }
  1118.  
  1119.     [Category("Options")]
  1120.     public bool Checked {
  1121.         get { return _Checked; }
  1122.         set { _Checked = value; }
  1123.     }
  1124.  
  1125.     #endregion
  1126.  
  1127.     protected override void OnTextChanged(EventArgs e)
  1128.     {
  1129.         base.OnTextChanged(e);
  1130.         Invalidate();
  1131.     }
  1132.  
  1133.     protected override void OnResize(EventArgs e)
  1134.     {
  1135.         base.OnResize(e);
  1136.         Width = 76;
  1137.         Height = 33;
  1138.     }
  1139.  
  1140.     #region " Mouse States"
  1141.  
  1142.     protected override void OnMouseEnter(System.EventArgs e)
  1143.     {
  1144.         base.OnMouseEnter(e);
  1145.         State = MouseState.Over;
  1146.         Invalidate();
  1147.     }
  1148.     protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  1149.     {
  1150.         base.OnMouseDown(e);
  1151.         State = MouseState.Down;
  1152.         Invalidate();
  1153.     }
  1154.     protected override void OnMouseLeave(System.EventArgs e)
  1155.     {
  1156.         base.OnMouseLeave(e);
  1157.         State = MouseState.None;
  1158.         Invalidate();
  1159.     }
  1160.     protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  1161.     {
  1162.         base.OnMouseUp(e);
  1163.         State = MouseState.Over;
  1164.         Invalidate();
  1165.     }
  1166.     protected override void OnClick(EventArgs e)
  1167.     {
  1168.         base.OnClick(e);
  1169.         _Checked = !_Checked;
  1170.         if (CheckedChanged != null) {
  1171.             CheckedChanged(this);
  1172.         }
  1173.     }
  1174.  
  1175.     #endregion
  1176.  
  1177.     #endregion
  1178.  
  1179.     #region " Colors"
  1180.  
  1181.     private Color BaseColor  =Color.FromArgb(35, 168, 109);
  1182.     private Color BaseColorRed = Color.FromArgb(220, 85, 96);
  1183.     private Color BGColor = Color.FromArgb(84, 85, 86);
  1184.     private Color ToggleColor = Color.FromArgb(45, 47, 49);
  1185.  
  1186.     private Color TextColor = Color.FromArgb(243, 243, 243);
  1187.     #endregion
  1188.  
  1189.     public FlatToggle()
  1190.     {
  1191.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  1192.         DoubleBuffered = true;
  1193.         BackColor = Color.Transparent;
  1194.         Size = new Size(44, Height + 1);
  1195.         Cursor = Cursors.Hand;
  1196.         Font = new Font("Segoe UI", 10);
  1197.         Size = new Size(76, 33);
  1198.     }
  1199.  
  1200.     protected override void OnPaint(PaintEventArgs e)
  1201.     {
  1202.         B = new Bitmap(Width, Height);
  1203.         G = Graphics.FromImage(B);
  1204.         W = Width - 1;
  1205.         H = Height - 1;
  1206.  
  1207.         GraphicsPath GP = default(GraphicsPath), GP2 = new GraphicsPath();
  1208.         Rectangle Base = new Rectangle(0, 0, W, H);
  1209.         Rectangle Toggle = new Rectangle(Convert.ToInt32(W / 2), 0, 38, H);
  1210.  
  1211.         {
  1212.             G.SmoothingMode = 2;
  1213.             G.PixelOffsetMode = 2;
  1214.             G.TextRenderingHint = 5;
  1215.             G.Clear(BackColor);
  1216.  
  1217.             switch (O) {
  1218.                 case _Options.Style1:
  1219.                     //-- Style 1
  1220.                     //-- Base
  1221.                     GP = Helpers.RoundRec(Base, 6);
  1222.                     GP2 = Helpers.RoundRec(Toggle, 6);
  1223.                     G.FillPath(new SolidBrush(BGColor), GP);
  1224.                     G.FillPath(new SolidBrush(ToggleColor), GP2);
  1225.  
  1226.                     //-- Text
  1227.                     G.DrawString("OFF", Font, new SolidBrush(BGColor), new Rectangle(19, 1, W, H), CenterSF);
  1228.  
  1229.                     if (Checked) {
  1230.                         //-- Base
  1231.                         GP = Helpers.RoundRec(Base, 6);
  1232.                         GP2 = Helpers.RoundRec(new Rectangle(Convert.ToInt32(W / 2), 0, 38, H), 6);
  1233.                         G.FillPath(new SolidBrush(ToggleColor), GP);
  1234.                         G.FillPath(new SolidBrush(BaseColor), GP2);
  1235.  
  1236.                         //-- Text
  1237.                         G.DrawString("ON", Font, new SolidBrush(BaseColor), new Rectangle(8, 7, W, H), NearSF);
  1238.                     }
  1239.                     break;
  1240.                 case _Options.Style2:
  1241.                     //-- Style 2
  1242.                     //-- Base
  1243.                     GP = Helpers.RoundRec(Base, 6);
  1244.                     Toggle = new Rectangle(4, 4, 36, H - 8);
  1245.                     GP2 = Helpers.RoundRec(Toggle, 4);
  1246.                     G.FillPath(new SolidBrush(BaseColorRed), GP);
  1247.                     G.FillPath(new SolidBrush(ToggleColor), GP2);
  1248.  
  1249.                     //-- Lines
  1250.                     G.DrawLine(new Pen(BGColor), 18, 20, 18, 12);
  1251.                     G.DrawLine(new Pen(BGColor), 22, 20, 22, 12);
  1252.                     G.DrawLine(new Pen(BGColor), 26, 20, 26, 12);
  1253.  
  1254.                     //-- Text
  1255.                     G.DrawString("r", new Font("Marlett", 8), new SolidBrush(TextColor), new Rectangle(19, 2, Width, Height), CenterSF);
  1256.  
  1257.                     if (Checked) {
  1258.                         GP = Helpers.RoundRec(Base, 6);
  1259.                         Toggle = new Rectangle(Convert.ToInt32(W / 2) - 2, 4, 36, H - 8);
  1260.                         GP2 = Helpers.RoundRec(Toggle, 4);
  1261.                         G.FillPath(new SolidBrush(BaseColor), GP);
  1262.                         G.FillPath(new SolidBrush(ToggleColor), GP2);
  1263.  
  1264.                         //-- Lines
  1265.                         G.DrawLine(new Pen(BGColor), Convert.ToInt32(W / 2) + 12, 20, Convert.ToInt32(W / 2) + 12, 12);
  1266.                         G.DrawLine(new Pen(BGColor), Convert.ToInt32(W / 2) + 16, 20, Convert.ToInt32(W / 2) + 16, 12);
  1267.                         G.DrawLine(new Pen(BGColor), Convert.ToInt32(W / 2) + 20, 20, Convert.ToInt32(W / 2) + 20, 12);
  1268.  
  1269.                         //-- Text
  1270.                         G.DrawString("ü", new Font("Wingdings", 14), new SolidBrush(TextColor), new Rectangle(8, 7, Width, Height), NearSF);
  1271.                     }
  1272.                     break;
  1273.                 case _Options.Style3:
  1274.                     //-- Style 3
  1275.                     //-- Base
  1276.                     GP = Helpers.RoundRec(Base, 16);
  1277.                     Toggle = new Rectangle(W - 28, 4, 22, H - 8);
  1278.                     GP2.AddEllipse(Toggle);
  1279.                     G.FillPath(new SolidBrush(ToggleColor), GP);
  1280.                     G.FillPath(new SolidBrush(BaseColorRed), GP2);
  1281.  
  1282.                     //-- Text
  1283.                     G.DrawString("OFF", Font, new SolidBrush(BaseColorRed), new Rectangle(-12, 2, W, H), CenterSF);
  1284.  
  1285.                     if (Checked) {
  1286.                         //-- Base
  1287.                         GP = Helpers.RoundRec(Base, 16);
  1288.                         Toggle = new Rectangle(6, 4, 22, H - 8);
  1289.                         GP2.Reset();
  1290.                         GP2.AddEllipse(Toggle);
  1291.                         G.FillPath(new SolidBrush(ToggleColor), GP);
  1292.                         G.FillPath(new SolidBrush(BaseColor), GP2);
  1293.  
  1294.                         //-- Text
  1295.                         G.DrawString("ON", Font, new SolidBrush(BaseColor), new Rectangle(12, 2, W, H), CenterSF);
  1296.                     }
  1297.                     break;
  1298.                 case _Options.Style4:
  1299.                     //-- TODO: New Styles
  1300.                     if (Checked) {
  1301.                         //--
  1302.                     }
  1303.                     break;
  1304.                 case _Options.Style5:
  1305.                     //-- TODO: New Styles
  1306.                     if (Checked) {
  1307.                         //--
  1308.                     }
  1309.                     break;
  1310.             }
  1311.  
  1312.         }
  1313.  
  1314.         base.OnPaint(e);
  1315.         G.Dispose();
  1316.         e.Graphics.InterpolationMode = 7;
  1317.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  1318.         B.Dispose();
  1319.     }
  1320. }
  1321.  
  1322. [DefaultEvent("CheckedChanged")]
  1323. class RadioButton : Control
  1324. {
  1325.  
  1326.     #region " Variables"
  1327.  
  1328.     private MouseState State = MouseState.None;
  1329.     private int W;
  1330.     private int H;
  1331.     private _Options O;
  1332.  
  1333.     private bool _Checked;
  1334.     #endregion
  1335.  
  1336.     #region " Properties"
  1337.     public bool Checked {
  1338.         get { return _Checked; }
  1339.         set {
  1340.             _Checked = value;
  1341.             InvalidateControls();
  1342.             if (CheckedChanged != null) {
  1343.                 CheckedChanged(this);
  1344.             }
  1345.             Invalidate();
  1346.         }
  1347.     }
  1348.     public event CheckedChangedEventHandler CheckedChanged;
  1349.     public delegate void CheckedChangedEventHandler(object sender);
  1350.     protected override void OnClick(EventArgs e)
  1351.     {
  1352.         if (!_Checked)
  1353.             Checked = true;
  1354.         base.OnClick(e);
  1355.     }
  1356.     private void InvalidateControls()
  1357.     {
  1358.         if (!IsHandleCreated || !_Checked)
  1359.             return;
  1360.         foreach (Control C in Parent.Controls) {
  1361.             if (!object.ReferenceEquals(C, this) && C is RadioButton) {
  1362.                 ((RadioButton)C).Checked = false;
  1363.                 Invalidate();
  1364.             }
  1365.         }
  1366.     }
  1367.     protected override void OnCreateControl()
  1368.     {
  1369.         base.OnCreateControl();
  1370.         InvalidateControls();
  1371.     }
  1372.  
  1373.     [Flags()]
  1374.     public enum _Options
  1375.     {
  1376.         Style1,
  1377.         Style2
  1378.     }
  1379.  
  1380.     [Category("Options")]
  1381.     public _Options Options {
  1382.         get { return O; }
  1383.         set { O = value; }
  1384.     }
  1385.  
  1386.     protected override void OnResize(EventArgs e)
  1387.     {
  1388.         base.OnResize(e);
  1389.         Height = 22;
  1390.     }
  1391.  
  1392.     #region " Mouse States"
  1393.  
  1394.     protected override void OnMouseDown(MouseEventArgs e)
  1395.     {
  1396.         base.OnMouseDown(e);
  1397.         State = MouseState.Down;
  1398.         Invalidate();
  1399.     }
  1400.     protected override void OnMouseUp(MouseEventArgs e)
  1401.     {
  1402.         base.OnMouseUp(e);
  1403.         State = MouseState.Over;
  1404.         Invalidate();
  1405.     }
  1406.     protected override void OnMouseEnter(EventArgs e)
  1407.     {
  1408.         base.OnMouseEnter(e);
  1409.         State = MouseState.Over;
  1410.         Invalidate();
  1411.     }
  1412.     protected override void OnMouseLeave(EventArgs e)
  1413.     {
  1414.         base.OnMouseLeave(e);
  1415.         State = MouseState.None;
  1416.         Invalidate();
  1417.     }
  1418.  
  1419.     #endregion
  1420.     #endregion
  1421.  
  1422.     #region " Colors"
  1423.  
  1424.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  1425.     private Color _BorderColor = _FlatColor;
  1426.  
  1427.     private Color _TextColor = Color.FromArgb(243, 243, 243);
  1428.     #endregion
  1429.  
  1430.     public RadioButton()
  1431.     {
  1432.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  1433.         DoubleBuffered = true;
  1434.         Cursor = Cursors.Hand;
  1435.         Size = new Size(100, 22);
  1436.         BackColor = Color.FromArgb(60, 70, 73);
  1437.         Font = new Font("Segoe UI", 10);
  1438.     }
  1439.     protected override void OnPaint(PaintEventArgs e)
  1440.     {
  1441.         B = new Bitmap(Width, Height);
  1442.         G = Graphics.FromImage(B);
  1443.         W = Width - 1;
  1444.         H = Height - 1;
  1445.  
  1446.         Rectangle Base = new Rectangle(0, 2, Height - 5, Height - 5);
  1447.         Rectangle Dot = new Rectangle(4, 6, H - 12, H - 12);
  1448.  
  1449.         {
  1450.             G.SmoothingMode = 2;
  1451.             G.TextRenderingHint = 5;
  1452.             G.Clear(BackColor);
  1453.  
  1454.             switch (O) {
  1455.                 case _Options.Style1:
  1456.                     //-- Base
  1457.                     G.FillEllipse(new SolidBrush(_BaseColor), Base);
  1458.  
  1459.                     switch (State) {
  1460.                         case MouseState.Over:
  1461.                             G.DrawEllipse(new Pen(_BorderColor), Base);
  1462.                             break;
  1463.                         case MouseState.Down:
  1464.                             G.DrawEllipse(new Pen(_BorderColor), Base);
  1465.                             break;
  1466.                     }
  1467.  
  1468.                     //-- If Checked
  1469.                     if (Checked) {
  1470.                         G.FillEllipse(new SolidBrush(_BorderColor), Dot);
  1471.                     }
  1472.                     break;
  1473.                 case _Options.Style2:
  1474.                     //-- Base
  1475.                     G.FillEllipse(new SolidBrush(_BaseColor), Base);
  1476.  
  1477.                     switch (State) {
  1478.                         case MouseState.Over:
  1479.                             //-- Base
  1480.                             G.DrawEllipse(new Pen(_BorderColor), Base);
  1481.                             G.FillEllipse(new SolidBrush(Color.FromArgb(118, 213, 170)), Base);
  1482.                             break;
  1483.                         case MouseState.Down:
  1484.                             //-- Base
  1485.                             G.DrawEllipse(new Pen(_BorderColor), Base);
  1486.                             G.FillEllipse(new SolidBrush(Color.FromArgb(118, 213, 170)), Base);
  1487.                             break;
  1488.                     }
  1489.  
  1490.                     //-- If Checked
  1491.                     if (Checked) {
  1492.                         //-- Base
  1493.                         G.FillEllipse(new SolidBrush(_BorderColor), Dot);
  1494.                     }
  1495.                     break;
  1496.             }
  1497.  
  1498.             G.DrawString(Text, Font, new SolidBrush(_TextColor), new Rectangle(20, 2, W, H), NearSF);
  1499.         }
  1500.  
  1501.         base.OnPaint(e);
  1502.         G.Dispose();
  1503.         e.Graphics.InterpolationMode = 7;
  1504.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  1505.         B.Dispose();
  1506.     }
  1507. }
  1508.  
  1509. [DefaultEvent("CheckedChanged")]
  1510. class FlatCheckBox : Control
  1511. {
  1512.  
  1513.     #region " Variables"
  1514.  
  1515.     private int W;
  1516.     private int H;
  1517.     private MouseState State = MouseState.None;
  1518.     private _Options O;
  1519.  
  1520.     private bool _Checked;
  1521.     #endregion
  1522.  
  1523.     #region " Properties"
  1524.     protected override void OnTextChanged(System.EventArgs e)
  1525.     {
  1526.         base.OnTextChanged(e);
  1527.         Invalidate();
  1528.     }
  1529.  
  1530.     public bool Checked {
  1531.         get { return _Checked; }
  1532.         set {
  1533.             _Checked = value;
  1534.             Invalidate();
  1535.         }
  1536.     }
  1537.  
  1538.     public event CheckedChangedEventHandler CheckedChanged;
  1539.     public delegate void CheckedChangedEventHandler(object sender);
  1540.     protected override void OnClick(System.EventArgs e)
  1541.     {
  1542.         _Checked = !_Checked;
  1543.         if (CheckedChanged != null) {
  1544.             CheckedChanged(this);
  1545.         }
  1546.         base.OnClick(e);
  1547.     }
  1548.  
  1549.     [Flags()]
  1550.     public enum _Options
  1551.     {
  1552.         Style1,
  1553.         Style2
  1554.     }
  1555.  
  1556.     [Category("Options")]
  1557.     public _Options Options {
  1558.         get { return O; }
  1559.         set { O = value; }
  1560.     }
  1561.  
  1562.     protected override void OnResize(EventArgs e)
  1563.     {
  1564.         base.OnResize(e);
  1565.         Height = 22;
  1566.     }
  1567.  
  1568.     #region " Colors"
  1569.  
  1570.     [Category("Colors")]
  1571.     public Color BaseColor {
  1572.         get { return _BaseColor; }
  1573.         set { _BaseColor = value; }
  1574.     }
  1575.  
  1576.     [Category("Colors")]
  1577.     public Color BorderColor {
  1578.         get { return _BorderColor; }
  1579.         set { _BorderColor = value; }
  1580.     }
  1581.  
  1582.     #endregion
  1583.  
  1584.     #region " Mouse States"
  1585.  
  1586.     protected override void OnMouseDown(MouseEventArgs e)
  1587.     {
  1588.         base.OnMouseDown(e);
  1589.         State = MouseState.Down;
  1590.         Invalidate();
  1591.     }
  1592.     protected override void OnMouseUp(MouseEventArgs e)
  1593.     {
  1594.         base.OnMouseUp(e);
  1595.         State = MouseState.Over;
  1596.         Invalidate();
  1597.     }
  1598.     protected override void OnMouseEnter(EventArgs e)
  1599.     {
  1600.         base.OnMouseEnter(e);
  1601.         State = MouseState.Over;
  1602.         Invalidate();
  1603.     }
  1604.     protected override void OnMouseLeave(EventArgs e)
  1605.     {
  1606.         base.OnMouseLeave(e);
  1607.         State = MouseState.None;
  1608.         Invalidate();
  1609.     }
  1610.  
  1611.     #endregion
  1612.  
  1613.     #endregion
  1614.  
  1615.     #region " Colors"
  1616.  
  1617.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  1618.     private Color _BorderColor = _FlatColor;
  1619.  
  1620.     private Color _TextColor = Color.FromArgb(243, 243, 243);
  1621.     #endregion
  1622.  
  1623.     public FlatCheckBox()
  1624.     {
  1625.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  1626.         DoubleBuffered = true;
  1627.         BackColor = Color.FromArgb(60, 70, 73);
  1628.         Cursor = Cursors.Hand;
  1629.         Font = new Font("Segoe UI", 10);
  1630.         Size = new Size(112, 22);
  1631.     }
  1632.  
  1633.     protected override void OnPaint(PaintEventArgs e)
  1634.     {
  1635.         B = new Bitmap(Width, Height);
  1636.         G = Graphics.FromImage(B);
  1637.         W = Width - 1;
  1638.         H = Height - 1;
  1639.  
  1640.         Rectangle Base = new Rectangle(0, 2, Height - 5, Height - 5);
  1641.  
  1642.         {
  1643.             G.SmoothingMode = 2;
  1644.             G.TextRenderingHint = 5;
  1645.             G.Clear(BackColor);
  1646.             switch (O) {
  1647.                 case _Options.Style1:
  1648.                     //-- Style 1
  1649.                     //-- Base
  1650.                     G.FillRectangle(new SolidBrush(_BaseColor), Base);
  1651.  
  1652.                     switch (State) {
  1653.                         case MouseState.Over:
  1654.                             //-- Base
  1655.                             G.DrawRectangle(new Pen(_BorderColor), Base);
  1656.                             break;
  1657.                         case MouseState.Down:
  1658.                             //-- Base
  1659.                             G.DrawRectangle(new Pen(_BorderColor), Base);
  1660.                             break;
  1661.                     }
  1662.  
  1663.                     //-- If Checked
  1664.                     if (Checked) {
  1665.                         G.DrawString("ü", new Font("Wingdings", 18), new SolidBrush(_BorderColor), new Rectangle(5, 7, H - 9, H - 9), CenterSF);
  1666.                     }
  1667.  
  1668.                     //-- If Enabled
  1669.                     if (this.Enabled == false) {
  1670.                         G.FillRectangle(new SolidBrush(Color.FromArgb(54, 58, 61)), Base);
  1671.                         G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(140, 142, 143)), new Rectangle(20, 2, W, H), NearSF);
  1672.                     }
  1673.  
  1674.                     //-- Text
  1675.                     G.DrawString(Text, Font, new SolidBrush(_TextColor), new Rectangle(20, 2, W, H), NearSF);
  1676.                     break;
  1677.                 case _Options.Style2:
  1678.                     //-- Style 2
  1679.                     //-- Base
  1680.                     G.FillRectangle(new SolidBrush(_BaseColor), Base);
  1681.  
  1682.                     switch (State) {
  1683.                         case MouseState.Over:
  1684.                             //-- Base
  1685.                             G.DrawRectangle(new Pen(_BorderColor), Base);
  1686.                             G.FillRectangle(new SolidBrush(Color.FromArgb(118, 213, 170)), Base);
  1687.                             break;
  1688.                         case MouseState.Down:
  1689.                             //-- Base
  1690.                             G.DrawRectangle(new Pen(_BorderColor), Base);
  1691.                             G.FillRectangle(new SolidBrush(Color.FromArgb(118, 213, 170)), Base);
  1692.                             break;
  1693.                     }
  1694.  
  1695.                     //-- If Checked
  1696.                     if (Checked) {
  1697.                         G.DrawString("ü", new Font("Wingdings", 18), new SolidBrush(_BorderColor), new Rectangle(5, 7, H - 9, H - 9), CenterSF);
  1698.                     }
  1699.  
  1700.                     //-- If Enabled
  1701.                     if (this.Enabled == false) {
  1702.                         G.FillRectangle(new SolidBrush(Color.FromArgb(54, 58, 61)), Base);
  1703.                         G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(48, 119, 91)), new Rectangle(20, 2, W, H), NearSF);
  1704.                     }
  1705.  
  1706.                     //-- Text
  1707.                     G.DrawString(Text, Font, new SolidBrush(_TextColor), new Rectangle(20, 2, W, H), NearSF);
  1708.                     break;
  1709.             }
  1710.         }
  1711.  
  1712.         base.OnPaint(e);
  1713.         G.Dispose();
  1714.         e.Graphics.InterpolationMode = 7;
  1715.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  1716.         B.Dispose();
  1717.     }
  1718. }
  1719.  
  1720. [DefaultEvent("TextChanged")]
  1721. class FlatTextBox : Control
  1722. {
  1723.  
  1724.     #region " Variables"
  1725.  
  1726.     private int W;
  1727.     private int H;
  1728.     private MouseState State = MouseState.None;
  1729.  
  1730.     private System.Windows.Forms.TextBox TB;
  1731.     #endregion
  1732.  
  1733.     #region " Properties"
  1734.  
  1735.     #region " TextBox Properties"
  1736.  
  1737.     private HorizontalAlignment _TextAlign = HorizontalAlignment.Left;
  1738.     [Category("Options")]
  1739.     public HorizontalAlignment TextAlign {
  1740.         get { return _TextAlign; }
  1741.         set {
  1742.             _TextAlign = value;
  1743.             if (TB != null) {
  1744.                 TB.TextAlign = value;
  1745.             }
  1746.         }
  1747.     }
  1748.     private int _MaxLength = 32767;
  1749.     [Category("Options")]
  1750.     public int MaxLength {
  1751.         get { return _MaxLength; }
  1752.         set {
  1753.             _MaxLength = value;
  1754.             if (TB != null) {
  1755.                 TB.MaxLength = value;
  1756.             }
  1757.         }
  1758.     }
  1759.     private bool _ReadOnly;
  1760.     [Category("Options")]
  1761.     public bool ReadOnly {
  1762.         get { return _ReadOnly; }
  1763.         set {
  1764.             _ReadOnly = value;
  1765.             if (TB != null) {
  1766.                 TB.ReadOnly = value;
  1767.             }
  1768.         }
  1769.     }
  1770.     private bool _UseSystemPasswordChar;
  1771.     [Category("Options")]
  1772.     public bool UseSystemPasswordChar {
  1773.         get { return _UseSystemPasswordChar; }
  1774.         set {
  1775.             _UseSystemPasswordChar = value;
  1776.             if (TB != null) {
  1777.                 TB.UseSystemPasswordChar = value;
  1778.             }
  1779.         }
  1780.     }
  1781.     private bool _Multiline;
  1782.     [Category("Options")]
  1783.     public bool Multiline {
  1784.         get { return _Multiline; }
  1785.         set {
  1786.             _Multiline = value;
  1787.             if (TB != null) {
  1788.                 TB.Multiline = value;
  1789.  
  1790.                 if (value) {
  1791.                     TB.Height = Height - 11;
  1792.                 } else {
  1793.                     Height = TB.Height + 11;
  1794.                 }
  1795.  
  1796.             }
  1797.         }
  1798.     }
  1799.     [Category("Options")]
  1800.     public override string Text {
  1801.         get { return base.Text; }
  1802.         set {
  1803.             base.Text = value;
  1804.             if (TB != null) {
  1805.                 TB.Text = value;
  1806.             }
  1807.         }
  1808.     }
  1809.     [Category("Options")]
  1810.     public override Font Font {
  1811.         get { return base.Font; }
  1812.         set {
  1813.             base.Font = value;
  1814.             if (TB != null) {
  1815.                 TB.Font = value;
  1816.                 TB.Location = new Point(3, 5);
  1817.                 TB.Width = Width - 6;
  1818.  
  1819.                 if (!_Multiline) {
  1820.                     Height = TB.Height + 11;
  1821.                 }
  1822.             }
  1823.         }
  1824.     }
  1825.  
  1826.     protected override void OnCreateControl()
  1827.     {
  1828.         base.OnCreateControl();
  1829.         if (!Controls.Contains(TB)) {
  1830.             Controls.Add(TB);
  1831.         }
  1832.     }
  1833.     private void OnBaseTextChanged(object s, EventArgs e)
  1834.     {
  1835.         Text = TB.Text;
  1836.     }
  1837.     private void OnBaseKeyDown(object s, KeyEventArgs e)
  1838.     {
  1839.         if (e.Control && e.KeyCode == Keys.A) {
  1840.             TB.SelectAll();
  1841.             e.SuppressKeyPress = true;
  1842.         }
  1843.         if (e.Control && e.KeyCode == Keys.C) {
  1844.             TB.Copy();
  1845.             e.SuppressKeyPress = true;
  1846.         }
  1847.     }
  1848.     protected override void OnResize(EventArgs e)
  1849.     {
  1850.         TB.Location = new Point(5, 5);
  1851.         TB.Width = Width - 10;
  1852.  
  1853.         if (_Multiline) {
  1854.             TB.Height = Height - 11;
  1855.         } else {
  1856.             Height = TB.Height + 11;
  1857.         }
  1858.  
  1859.         base.OnResize(e);
  1860.     }
  1861.  
  1862.     #endregion
  1863.  
  1864.     #region " Colors"
  1865.  
  1866.     [Category("Colors")]
  1867.     public Color TextColor {
  1868.         get { return _TextColor; }
  1869.         set { _TextColor = value; }
  1870.     }
  1871.  
  1872.     public override Color ForeColor {
  1873.         get { return _TextColor; }
  1874.         set { _TextColor = value; }
  1875.     }
  1876.  
  1877.     #endregion
  1878.  
  1879.     #region " Mouse States"
  1880.  
  1881.     protected override void OnMouseDown(MouseEventArgs e)
  1882.     {
  1883.         base.OnMouseDown(e);
  1884.         State = MouseState.Down;
  1885.         Invalidate();
  1886.     }
  1887.     protected override void OnMouseUp(MouseEventArgs e)
  1888.     {
  1889.         base.OnMouseUp(e);
  1890.         State = MouseState.Over;
  1891.         TB.Focus();
  1892.         Invalidate();
  1893.     }
  1894.     protected override void OnMouseEnter(EventArgs e)
  1895.     {
  1896.         base.OnMouseEnter(e);
  1897.         State = MouseState.Over;
  1898.         TB.Focus();
  1899.         Invalidate();
  1900.     }
  1901.     protected override void OnMouseLeave(EventArgs e)
  1902.     {
  1903.         base.OnMouseLeave(e);
  1904.         State = MouseState.None;
  1905.         Invalidate();
  1906.     }
  1907.  
  1908.     #endregion
  1909.  
  1910.     #endregion
  1911.  
  1912.     #region " Colors"
  1913.  
  1914.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  1915.     private Color _TextColor = Color.FromArgb(192, 192, 192);
  1916.  
  1917.     private Color _BorderColor = _FlatColor;
  1918.     #endregion
  1919.  
  1920.     public FlatTextBox()
  1921.     {
  1922.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  1923.         DoubleBuffered = true;
  1924.  
  1925.         BackColor = Color.Transparent;
  1926.  
  1927.         TB = new Windows.Forms.TextBox();
  1928.         TB.Font = new Font("Segoe UI", 10);
  1929.         TB.Text = Text;
  1930.         TB.BackColor = _BaseColor;
  1931.         TB.ForeColor = _TextColor;
  1932.         TB.MaxLength = _MaxLength;
  1933.         TB.Multiline = _Multiline;
  1934.         TB.ReadOnly = _ReadOnly;
  1935.         TB.UseSystemPasswordChar = _UseSystemPasswordChar;
  1936.         TB.BorderStyle = BorderStyle.None;
  1937.         TB.Location = new Point(5, 5);
  1938.         TB.Width = Width - 10;
  1939.  
  1940.         TB.Cursor = Cursors.IBeam;
  1941.  
  1942.         if (_Multiline) {
  1943.             TB.Height = Height - 11;
  1944.         } else {
  1945.             Height = TB.Height + 11;
  1946.         }
  1947.  
  1948.         TB.TextChanged += OnBaseTextChanged;
  1949.         TB.KeyDown += OnBaseKeyDown;
  1950.     }
  1951.  
  1952.     protected override void OnPaint(PaintEventArgs e)
  1953.     {
  1954.         B = new Bitmap(Width, Height);
  1955.         G = Graphics.FromImage(B);
  1956.         W = Width - 1;
  1957.         H = Height - 1;
  1958.  
  1959.         Rectangle Base = new Rectangle(0, 0, W, H);
  1960.  
  1961.         {
  1962.             G.SmoothingMode = 2;
  1963.             G.PixelOffsetMode = 2;
  1964.             G.TextRenderingHint = 5;
  1965.             G.Clear(BackColor);
  1966.  
  1967.             //-- Colors
  1968.             TB.BackColor = _BaseColor;
  1969.             TB.ForeColor = _TextColor;
  1970.  
  1971.             //-- Base
  1972.             G.FillRectangle(new SolidBrush(_BaseColor), Base);
  1973.         }
  1974.  
  1975.         base.OnPaint(e);
  1976.         G.Dispose();
  1977.         e.Graphics.InterpolationMode = 7;
  1978.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  1979.         B.Dispose();
  1980.     }
  1981.  
  1982. }
  1983.  
  1984. class FlatTabControl : TabControl
  1985. {
  1986.  
  1987.     #region " Variables"
  1988.  
  1989.     private int W;
  1990.  
  1991.     private int H;
  1992.     #endregion
  1993.  
  1994.     #region " Properties"
  1995.  
  1996.     protected override void CreateHandle()
  1997.     {
  1998.         base.CreateHandle();
  1999.         Alignment = TabAlignment.Top;
  2000.     }
  2001.  
  2002.     #region " Colors"
  2003.  
  2004.     [Category("Colors")]
  2005.     public Color BaseColor {
  2006.         get { return _BaseColor; }
  2007.         set { _BaseColor = value; }
  2008.     }
  2009.  
  2010.     [Category("Colors")]
  2011.     public Color ActiveColor {
  2012.         get { return _ActiveColor; }
  2013.         set { _ActiveColor = value; }
  2014.     }
  2015.  
  2016.     #endregion
  2017.  
  2018.     #endregion
  2019.  
  2020.     #region " Colors"
  2021.  
  2022.     private Color BGColor = Color.FromArgb(60, 70, 73);
  2023.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  2024.  
  2025.     private Color _ActiveColor = _FlatColor;
  2026.     #endregion
  2027.  
  2028.     public FlatTabControl()
  2029.     {
  2030.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  2031.         DoubleBuffered = true;
  2032.         BackColor = Color.FromArgb(60, 70, 73);
  2033.  
  2034.         Font = new Font("Segoe UI", 10);
  2035.         SizeMode = TabSizeMode.Fixed;
  2036.         ItemSize = new Size(120, 40);
  2037.     }
  2038.  
  2039.     protected override void OnPaint(PaintEventArgs e)
  2040.     {
  2041.         B = new Bitmap(Width, Height);
  2042.         G = Graphics.FromImage(B);
  2043.         W = Width - 1;
  2044.         H = Height - 1;
  2045.  
  2046.         {
  2047.             G.SmoothingMode = 2;
  2048.             G.PixelOffsetMode = 2;
  2049.             G.TextRenderingHint = 5;
  2050.             G.Clear(_BaseColor);
  2051.  
  2052.             try {
  2053.                 SelectedTab.BackColor = BGColor;
  2054.             } catch {
  2055.             }
  2056.  
  2057.             for (i = 0; i <= TabCount - 1; i++) {
  2058.                 Rectangle Base = new Rectangle(new Point(GetTabRect(i).Location.X + 2, GetTabRect(i).Location.Y), new Size(GetTabRect(i).Width, GetTabRect(i).Height));
  2059.                 Rectangle BaseSize = new Rectangle(Base.Location, new Size(Base.Width, Base.Height));
  2060.  
  2061.                 if (i == SelectedIndex) {
  2062.                     //-- Base
  2063.                     G.FillRectangle(new SolidBrush(_BaseColor), BaseSize);
  2064.  
  2065.                     //-- Gradiant
  2066.                     //.fill
  2067.                     G.FillRectangle(new SolidBrush(_ActiveColor), BaseSize);
  2068.  
  2069.                     //-- ImageList
  2070.                     if (ImageList != null) {
  2071.                         try {
  2072.                             if (ImageList.Images(TabPages(i).ImageIndex) != null) {
  2073.                                 //-- Image
  2074.                                 G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), new Point(BaseSize.Location.X + 8, BaseSize.Location.Y + 6));
  2075.                                 //-- Text
  2076.                                 G.DrawString("      " + TabPages(i).Text, Font, Brushes.White, BaseSize, CenterSF);
  2077.                             } else {
  2078.                                 //-- Text
  2079.                                 G.DrawString(TabPages(i).Text, Font, Brushes.White, BaseSize, CenterSF);
  2080.                             }
  2081.                         } catch (Exception ex) {
  2082.                             throw new Exception(ex.Message);
  2083.                         }
  2084.                     } else {
  2085.                         //-- Text
  2086.                         G.DrawString(TabPages(i).Text, Font, Brushes.White, BaseSize, CenterSF);
  2087.                     }
  2088.                 } else {
  2089.                     //-- Base
  2090.                     G.FillRectangle(new SolidBrush(_BaseColor), BaseSize);
  2091.  
  2092.                     //-- ImageList
  2093.                     if (ImageList != null) {
  2094.                         try {
  2095.                             if (ImageList.Images(TabPages(i).ImageIndex) != null) {
  2096.                                 //-- Image
  2097.                                 G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), new Point(BaseSize.Location.X + 8, BaseSize.Location.Y + 6));
  2098.                                 //-- Text
  2099.                                 G.DrawString("      " + TabPages(i).Text, Font, new SolidBrush(Color.White), BaseSize, new StringFormat {
  2100.                                     LineAlignment = StringAlignment.Center,
  2101.                                     Alignment = StringAlignment.Center
  2102.                                 });
  2103.                             } else {
  2104.                                 //-- Text
  2105.                                 G.DrawString(TabPages(i).Text, Font, new SolidBrush(Color.White), BaseSize, new StringFormat {
  2106.                                     LineAlignment = StringAlignment.Center,
  2107.                                     Alignment = StringAlignment.Center
  2108.                                 });
  2109.                             }
  2110.                         } catch (Exception ex) {
  2111.                             throw new Exception(ex.Message);
  2112.                         }
  2113.                     } else {
  2114.                         //-- Text
  2115.                         G.DrawString(TabPages(i).Text, Font, new SolidBrush(Color.White), BaseSize, new StringFormat {
  2116.                             LineAlignment = StringAlignment.Center,
  2117.                             Alignment = StringAlignment.Center
  2118.                         });
  2119.                     }
  2120.                 }
  2121.             }
  2122.         }
  2123.  
  2124.         base.OnPaint(e);
  2125.         G.Dispose();
  2126.         e.Graphics.InterpolationMode = 7;
  2127.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  2128.         B.Dispose();
  2129.     }
  2130. }
  2131.  
  2132. class FlatAlertBox : Control
  2133. {
  2134.  
  2135.     /// <summary>
  2136.     /// How to use: FlatAlertBox.ShowControl(Kind, String, Interval)
  2137.     /// </summary>
  2138.     /// <remarks></remarks>
  2139.  
  2140.     #region " Variables"
  2141.  
  2142.     private int W;
  2143.     private int H;
  2144.     private _Kind K;
  2145.     private string _Text;
  2146.     private MouseState State = MouseState.None;
  2147.     private int X;
  2148.  
  2149.     private Timer T;
  2150.     #endregion
  2151.  
  2152.     #region " Properties"
  2153.  
  2154.     [Flags()]
  2155.     public enum _Kind
  2156.     {
  2157.         Success,
  2158.         Error,
  2159.         Info
  2160.     }
  2161.  
  2162.     #region " Options"
  2163.  
  2164.     [Category("Options")]
  2165.     public _Kind kind {
  2166.         get { return K; }
  2167.         set { K = value; }
  2168.     }
  2169.  
  2170.     [Category("Options")]
  2171.     public override string Text {
  2172.         get { return base.Text; }
  2173.         set {
  2174.             base.Text = value;
  2175.             if (_Text != null) {
  2176.                 _Text = value;
  2177.             }
  2178.         }
  2179.     }
  2180.  
  2181.     [Category("Options")]
  2182.     public new bool Visible {
  2183.         get { return base.Visible == false; }
  2184.         set { base.Visible = value; }
  2185.     }
  2186.  
  2187.     #endregion
  2188.  
  2189.     protected override void OnTextChanged(EventArgs e)
  2190.     {
  2191.         base.OnTextChanged(e);
  2192.         Invalidate();
  2193.     }
  2194.  
  2195.     protected override void OnResize(EventArgs e)
  2196.     {
  2197.         base.OnResize(e);
  2198.         Height = 42;
  2199.     }
  2200.  
  2201.     public void ShowControl(_Kind Kind, string Str, int Interval)
  2202.     {
  2203.         K = Kind;
  2204.         Text = Str;
  2205.         this.Visible = true;
  2206.         T = new Timer();
  2207.         T.Interval = Interval;
  2208.         T.Enabled = true;
  2209.     }
  2210.  
  2211.     private void  // ERROR: Handles clauses are not supported in C#
  2212. T_Tick(object sender, EventArgs e)
  2213.     {
  2214.         this.Visible = false;
  2215.         T.Enabled = false;
  2216.         T.Dispose();
  2217.     }
  2218.  
  2219.     #region " Mouse States"
  2220.  
  2221.     protected override void OnMouseDown(MouseEventArgs e)
  2222.     {
  2223.         base.OnMouseDown(e);
  2224.         State = MouseState.Down;
  2225.         Invalidate();
  2226.     }
  2227.     protected override void OnMouseUp(MouseEventArgs e)
  2228.     {
  2229.         base.OnMouseUp(e);
  2230.         State = MouseState.Over;
  2231.         Invalidate();
  2232.     }
  2233.     protected override void OnMouseEnter(EventArgs e)
  2234.     {
  2235.         base.OnMouseEnter(e);
  2236.         State = MouseState.Over;
  2237.         Invalidate();
  2238.     }
  2239.     protected override void OnMouseLeave(EventArgs e)
  2240.     {
  2241.         base.OnMouseLeave(e);
  2242.         State = MouseState.None;
  2243.         Invalidate();
  2244.     }
  2245.  
  2246.     protected override void OnMouseMove(MouseEventArgs e)
  2247.     {
  2248.         base.OnMouseMove(e);
  2249.         X = e.X;
  2250.         Invalidate();
  2251.     }
  2252.  
  2253.     protected override void OnClick(EventArgs e)
  2254.     {
  2255.         base.OnClick(e);
  2256.         this.Visible = false;
  2257.     }
  2258.  
  2259.     #endregion
  2260.  
  2261.     #endregion
  2262.  
  2263.     #region " Colors"
  2264.  
  2265.     private Color SuccessColor = Color.FromArgb(60, 85, 79);
  2266.     private Color SuccessText = Color.FromArgb(35, 169, 110);
  2267.     private Color ErrorColor = Color.FromArgb(87, 71, 71);
  2268.     private Color ErrorText = Color.FromArgb(254, 142, 122);
  2269.     private Color InfoColor = Color.FromArgb(70, 91, 94);
  2270.  
  2271.     private Color InfoText = Color.FromArgb(97, 185, 186);
  2272.     #endregion
  2273.  
  2274.     public FlatAlertBox()
  2275.     {
  2276.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  2277.         DoubleBuffered = true;
  2278.         BackColor = Color.FromArgb(60, 70, 73);
  2279.         Size = new Size(576, 42);
  2280.         Location = new Point(10, 61);
  2281.         Font = new Font("Segoe UI", 10);
  2282.         Cursor = Cursors.Hand;
  2283.     }
  2284.  
  2285.     protected override void OnPaint(PaintEventArgs e)
  2286.     {
  2287.         B = new Bitmap(Width, Height);
  2288.         G = Graphics.FromImage(B);
  2289.         W = Width - 1;
  2290.         H = Height - 1;
  2291.  
  2292.         Rectangle Base = new Rectangle(0, 0, W, H);
  2293.  
  2294.         {
  2295.             G.SmoothingMode = 2;
  2296.             G.TextRenderingHint = 5;
  2297.             G.Clear(BackColor);
  2298.  
  2299.             switch (K) {
  2300.                 case _Kind.Success:
  2301.                     //-- Base
  2302.                     G.FillRectangle(new SolidBrush(SuccessColor), Base);
  2303.  
  2304.                     //-- Ellipse
  2305.                     G.FillEllipse(new SolidBrush(SuccessText), new Rectangle(8, 9, 24, 24));
  2306.                     G.FillEllipse(new SolidBrush(SuccessColor), new Rectangle(10, 11, 20, 20));
  2307.  
  2308.                     //-- Checked Sign
  2309.                     G.DrawString("ü", new Font("Wingdings", 22), new SolidBrush(SuccessText), new Rectangle(7, 7, W, H), NearSF);
  2310.                     G.DrawString(Text, Font, new SolidBrush(SuccessText), new Rectangle(48, 12, W, H), NearSF);
  2311.  
  2312.                     //-- X button
  2313.                     G.FillEllipse(new SolidBrush(Color.FromArgb(35, Color.Black)), new Rectangle(W - 30, H - 29, 17, 17));
  2314.                     G.DrawString("r", new Font("Marlett", 8), new SolidBrush(SuccessColor), new Rectangle(W - 28, 16, W, H), NearSF);
  2315.  
  2316.                     switch (State) {
  2317.                         // -- Mouse Over
  2318.                         case MouseState.Over:
  2319.                             G.DrawString("r", new Font("Marlett", 8), new SolidBrush(Color.FromArgb(25, Color.White)), new Rectangle(W - 28, 16, W, H), NearSF);
  2320.                             break;
  2321.                     }
  2322.  
  2323.                     break;
  2324.                 case _Kind.Error:
  2325.                     //-- Base
  2326.                     G.FillRectangle(new SolidBrush(ErrorColor), Base);
  2327.  
  2328.                     //-- Ellipse
  2329.                     G.FillEllipse(new SolidBrush(ErrorText), new Rectangle(8, 9, 24, 24));
  2330.                     G.FillEllipse(new SolidBrush(ErrorColor), new Rectangle(10, 11, 20, 20));
  2331.  
  2332.                     //-- X Sign
  2333.                     G.DrawString("r", new Font("Marlett", 16), new SolidBrush(ErrorText), new Rectangle(6, 11, W, H), NearSF);
  2334.                     G.DrawString(Text, Font, new SolidBrush(ErrorText), new Rectangle(48, 12, W, H), NearSF);
  2335.  
  2336.                     //-- X button
  2337.                     G.FillEllipse(new SolidBrush(Color.FromArgb(35, Color.Black)), new Rectangle(W - 32, H - 29, 17, 17));
  2338.                     G.DrawString("r", new Font("Marlett", 8), new SolidBrush(ErrorColor), new Rectangle(W - 30, 17, W, H), NearSF);
  2339.  
  2340.                     switch (State) {
  2341.                         case MouseState.Over:
  2342.                             // -- Mouse Over
  2343.                             G.DrawString("r", new Font("Marlett", 8), new SolidBrush(Color.FromArgb(25, Color.White)), new Rectangle(W - 30, 15, W, H), NearSF);
  2344.                             break;
  2345.                     }
  2346.  
  2347.                     break;
  2348.                 case _Kind.Info:
  2349.                     //-- Base
  2350.                     G.FillRectangle(new SolidBrush(InfoColor), Base);
  2351.  
  2352.                     //-- Ellipse
  2353.                     G.FillEllipse(new SolidBrush(InfoText), new Rectangle(8, 9, 24, 24));
  2354.                     G.FillEllipse(new SolidBrush(InfoColor), new Rectangle(10, 11, 20, 20));
  2355.  
  2356.                     //-- Info Sign
  2357.                     G.DrawString("¡", new Font("Segoe UI", 20, FontStyle.Bold), new SolidBrush(InfoText), new Rectangle(12, -4, W, H), NearSF);
  2358.                     G.DrawString(Text, Font, new SolidBrush(InfoText), new Rectangle(48, 12, W, H), NearSF);
  2359.  
  2360.                     //-- X button
  2361.                     G.FillEllipse(new SolidBrush(Color.FromArgb(35, Color.Black)), new Rectangle(W - 32, H - 29, 17, 17));
  2362.                     G.DrawString("r", new Font("Marlett", 8), new SolidBrush(InfoColor), new Rectangle(W - 30, 17, W, H), NearSF);
  2363.  
  2364.                     switch (State) {
  2365.                         case MouseState.Over:
  2366.                             // -- Mouse Over
  2367.                             G.DrawString("r", new Font("Marlett", 8), new SolidBrush(Color.FromArgb(25, Color.White)), new Rectangle(W - 30, 17, W, H), NearSF);
  2368.                             break;
  2369.                     }
  2370.                     break;
  2371.             }
  2372.  
  2373.         }
  2374.  
  2375.         base.OnPaint(e);
  2376.         G.Dispose();
  2377.         e.Graphics.InterpolationMode = 7;
  2378.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  2379.         B.Dispose();
  2380.     }
  2381.  
  2382. }
  2383.  
  2384. class FlatProgressBar : Control
  2385. {
  2386.  
  2387.     #region " Variables"
  2388.  
  2389.     private int W;
  2390.     private int H;
  2391.     private int _Value = 0;
  2392.  
  2393.     private int _Maximum = 100;
  2394.     #endregion
  2395.  
  2396.     #region " Properties"
  2397.  
  2398.     #region " Control"
  2399.  
  2400.     [Category("Control")]
  2401.     public int Maximum {
  2402.         get { return _Maximum; }
  2403.         set {
  2404.             switch (value) {
  2405.                 case  // ERROR: Case labels with binary operators are unsupported : LessThan
  2406. _Value:
  2407.                     _Value = value;
  2408.                     break;
  2409.             }
  2410.             _Maximum = value;
  2411.             Invalidate();
  2412.         }
  2413.     }
  2414.  
  2415.     [Category("Control")]
  2416.     public int Value {
  2417.         get {
  2418.             switch (_Value) {
  2419.                 case 0:
  2420.                     return 0;
  2421.                     Invalidate();
  2422.                     break;
  2423.                 default:
  2424.                     return _Value;
  2425.                     Invalidate();
  2426.                     break;
  2427.             }
  2428.         }
  2429.         set {
  2430.             switch (value) {
  2431.                 case  // ERROR: Case labels with binary operators are unsupported : GreaterThan
  2432. _Maximum:
  2433.                     value = _Maximum;
  2434.                     Invalidate();
  2435.                     break;
  2436.             }
  2437.             _Value = value;
  2438.             Invalidate();
  2439.         }
  2440.     }
  2441.  
  2442.     #endregion
  2443.  
  2444.     #region " Colors"
  2445.  
  2446.     [Category("Colors")]
  2447.     public Color ProgressColor {
  2448.         get { return _ProgressColor; }
  2449.         set { _ProgressColor = value; }
  2450.     }
  2451.  
  2452.     [Category("Colors")]
  2453.     public Color DarkerProgress {
  2454.         get { return _DarkerProgress; }
  2455.         set { _DarkerProgress = value; }
  2456.     }
  2457.  
  2458.     #endregion
  2459.  
  2460.     protected override void OnResize(EventArgs e)
  2461.     {
  2462.         base.OnResize(e);
  2463.         Height = 42;
  2464.     }
  2465.  
  2466.     protected override void CreateHandle()
  2467.     {
  2468.         base.CreateHandle();
  2469.         Height = 42;
  2470.     }
  2471.  
  2472.     public void Increment(int Amount)
  2473.     {
  2474.         Value += Amount;
  2475.     }
  2476.  
  2477.     #endregion
  2478.  
  2479.     #region " Colors"
  2480.  
  2481.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  2482.     private Color _ProgressColor = _FlatColor;
  2483.  
  2484.     private Color _DarkerProgress = Color.FromArgb(23, 148, 92);
  2485.     #endregion
  2486.  
  2487.     public FlatProgressBar()
  2488.     {
  2489.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  2490.         DoubleBuffered = true;
  2491.         BackColor = Color.FromArgb(60, 70, 73);
  2492.         Height = 42;
  2493.     }
  2494.  
  2495.     protected override void OnPaint(PaintEventArgs e)
  2496.     {
  2497.         B = new Bitmap(Width, Height);
  2498.         G = Graphics.FromImage(B);
  2499.         W = Width - 1;
  2500.         H = Height - 1;
  2501.  
  2502.         Rectangle Base = new Rectangle(0, 24, W, H);
  2503.         GraphicsPath GP = default(GraphicsPath), GP2 = default(GraphicsPath), GP3 = new GraphicsPath();
  2504.  
  2505.         {
  2506.             G.SmoothingMode = 2;
  2507.             G.PixelOffsetMode = 2;
  2508.             G.TextRenderingHint = 5;
  2509.             G.Clear(BackColor);
  2510.  
  2511.             //-- Progress Value
  2512.             int iValue = Convert.ToInt32(_Value / _Maximum * Width);
  2513.  
  2514.             switch (Value) {
  2515.                 case 0:
  2516.                     //-- Base
  2517.                     G.FillRectangle(new SolidBrush(_BaseColor), Base);
  2518.                     //--Progress
  2519.                     G.FillRectangle(new SolidBrush(_ProgressColor), new Rectangle(0, 24, iValue - 1, H - 1));
  2520.                     break;
  2521.                 case 100:
  2522.                     //-- Base
  2523.                     G.FillRectangle(new SolidBrush(_BaseColor), Base);
  2524.                     //--Progress
  2525.                     G.FillRectangle(new SolidBrush(_ProgressColor), new Rectangle(0, 24, iValue - 1, H - 1));
  2526.                     break;
  2527.                 default:
  2528.                     //-- Base
  2529.                     G.FillRectangle(new SolidBrush(_BaseColor), Base);
  2530.  
  2531.                     //--Progress
  2532.                     GP.AddRectangle(new Rectangle(0, 24, iValue - 1, H - 1));
  2533.                     G.FillPath(new SolidBrush(_ProgressColor), GP);
  2534.  
  2535.                     //-- Hatch Brush
  2536.                     HatchBrush HB = new HatchBrush(HatchStyle.Plaid, _DarkerProgress, _ProgressColor);
  2537.                     G.FillRectangle(HB, new Rectangle(0, 24, iValue - 1, H - 1));
  2538.  
  2539.                     //-- Balloon
  2540.                     Rectangle Balloon = new Rectangle(iValue - 18, 0, 34, 16);
  2541.                     GP2 = Helpers.RoundRec(Balloon, 4);
  2542.                     G.FillPath(new SolidBrush(_BaseColor), GP2);
  2543.  
  2544.                     //-- Arrow
  2545.                     GP3 = Helpers.DrawArrow(iValue - 9, 16, true);
  2546.                     G.FillPath(new SolidBrush(_BaseColor), GP3);
  2547.  
  2548.                     //-- Value > You can add "%" > value & "%"
  2549.                     G.DrawString(Value, new Font("Segoe UI", 10), new SolidBrush(_ProgressColor), new Rectangle(iValue - 11, -2, W, H), NearSF);
  2550.                     break;
  2551.             }
  2552.         }
  2553.  
  2554.         base.OnPaint(e);
  2555.         G.Dispose();
  2556.         e.Graphics.InterpolationMode = 7;
  2557.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  2558.         B.Dispose();
  2559.     }
  2560.  
  2561. }
  2562.  
  2563. class FlatComboBox : System.Windows.Forms.ComboBox
  2564. {
  2565.  
  2566.     #region " Variables"
  2567.  
  2568.     private int W;
  2569.     private int H;
  2570.     private int _StartIndex = 0;
  2571.     private int x;
  2572.  
  2573.     private int y;
  2574.     #endregion
  2575.  
  2576.     #region " Properties"
  2577.  
  2578.     #region " Mouse States"
  2579.  
  2580.     private MouseState State = MouseState.None;
  2581.     protected override void OnMouseDown(MouseEventArgs e)
  2582.     {
  2583.         base.OnMouseDown(e);
  2584.         State = MouseState.Down;
  2585.         Invalidate();
  2586.     }
  2587.     protected override void OnMouseUp(MouseEventArgs e)
  2588.     {
  2589.         base.OnMouseUp(e);
  2590.         State = MouseState.Over;
  2591.         Invalidate();
  2592.     }
  2593.     protected override void OnMouseEnter(EventArgs e)
  2594.     {
  2595.         base.OnMouseEnter(e);
  2596.         State = MouseState.Over;
  2597.         Invalidate();
  2598.     }
  2599.     protected override void OnMouseLeave(EventArgs e)
  2600.     {
  2601.         base.OnMouseLeave(e);
  2602.         State = MouseState.None;
  2603.         Invalidate();
  2604.     }
  2605.  
  2606.     protected override void OnMouseMove(MouseEventArgs e)
  2607.     {
  2608.         base.OnMouseMove(e);
  2609.         x = e.Location.X;
  2610.         y = e.Location.Y;
  2611.         Invalidate();
  2612.         if (e.X < Width - 41)
  2613.             Cursor = Cursors.IBeam;
  2614.         else
  2615.             Cursor = Cursors.Hand;
  2616.     }
  2617.  
  2618.     protected override void OnDrawItem(DrawItemEventArgs e)
  2619.     {
  2620.         base.OnDrawItem(e);
  2621.         Invalidate();
  2622.         if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
  2623.             Invalidate();
  2624.         }
  2625.     }
  2626.  
  2627.     protected override void OnClick(EventArgs e)
  2628.     {
  2629.         base.OnClick(e);
  2630.         Invalidate();
  2631.     }
  2632.  
  2633.     #endregion
  2634.  
  2635.     #region " Colors"
  2636.  
  2637.     [Category("Colors")]
  2638.     public Color HoverColor {
  2639.         get { return _HoverColor; }
  2640.         set { _HoverColor = value; }
  2641.     }
  2642.  
  2643.     #endregion
  2644.  
  2645.     private int StartIndex {
  2646.         get { return _StartIndex; }
  2647.         set {
  2648.             _StartIndex = value;
  2649.             try {
  2650.                 base.SelectedIndex = value;
  2651.             } catch {
  2652.             }
  2653.             Invalidate();
  2654.         }
  2655.     }
  2656.  
  2657.     public void  // ERROR: Handles clauses are not supported in C#
  2658. DrawItem_(System.Object sender, System.Windows.Forms.DrawItemEventArgs e)
  2659.     {
  2660.         if (e.Index < 0)
  2661.             return;
  2662.         e.DrawBackground();
  2663.         e.DrawFocusRectangle();
  2664.  
  2665.         e.Graphics.SmoothingMode = 2;
  2666.         e.Graphics.PixelOffsetMode = 2;
  2667.         e.Graphics.TextRenderingHint = 5;
  2668.         e.Graphics.InterpolationMode = 7;
  2669.  
  2670.         if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
  2671.             //-- Selected item
  2672.             e.Graphics.FillRectangle(new SolidBrush(_HoverColor), e.Bounds);
  2673.         } else {
  2674.             //-- Not Selected
  2675.             e.Graphics.FillRectangle(new SolidBrush(_BaseColor), e.Bounds);
  2676.         }
  2677.  
  2678.         //-- Text
  2679.         e.Graphics.DrawString(base.GetItemText(base.Items(e.Index)), new Font("Segoe UI", 8), Brushes.White, new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, e.Bounds.Width, e.Bounds.Height));
  2680.  
  2681.  
  2682.         e.Graphics.Dispose();
  2683.     }
  2684.  
  2685.     protected override void OnResize(EventArgs e)
  2686.     {
  2687.         base.OnResize(e);
  2688.         Height = 18;
  2689.     }
  2690.  
  2691.     #endregion
  2692.  
  2693.     #region " Colors"
  2694.  
  2695.     private Color _BaseColor = Color.FromArgb(25, 27, 29);
  2696.     private Color _BGColor = Color.FromArgb(45, 47, 49);
  2697.  
  2698.     private Color _HoverColor = Color.FromArgb(35, 168, 109);
  2699.     #endregion
  2700.  
  2701.     public FlatComboBox()
  2702.     {
  2703.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  2704.         DoubleBuffered = true;
  2705.  
  2706.         DrawMode = DrawMode.OwnerDrawFixed;
  2707.         BackColor = Color.FromArgb(45, 45, 48);
  2708.         ForeColor = Color.White;
  2709.         DropDownStyle = ComboBoxStyle.DropDownList;
  2710.         Cursor = Cursors.Hand;
  2711.         StartIndex = 0;
  2712.         ItemHeight = 18;
  2713.         Font = new Font("Segoe UI", 8, FontStyle.Regular);
  2714.     }
  2715.  
  2716.     protected override void OnPaint(PaintEventArgs e)
  2717.     {
  2718.         B = new Bitmap(Width, Height);
  2719.         G = Graphics.FromImage(B);
  2720.         W = Width;
  2721.         H = Height;
  2722.  
  2723.         Rectangle Base = new Rectangle(0, 0, W, H);
  2724.         Rectangle Button = new Rectangle(Convert.ToInt32(W - 40), 0, W, H);
  2725.         GraphicsPath GP = default(GraphicsPath), GP2 = new GraphicsPath();
  2726.  
  2727.         {
  2728.             G.Clear(Color.FromArgb(45, 45, 48));
  2729.             G.SmoothingMode = 2;
  2730.             G.PixelOffsetMode = 2;
  2731.             G.TextRenderingHint = 5;
  2732.  
  2733.             //-- Base
  2734.             G.FillRectangle(new SolidBrush(_BGColor), Base);
  2735.  
  2736.             //-- Button
  2737.             GP.Reset();
  2738.             GP.AddRectangle(Button);
  2739.             G.SetClip(GP);
  2740.             G.FillRectangle(new SolidBrush(_BaseColor), Button);
  2741.             G.ResetClip();
  2742.  
  2743.             //-- Lines
  2744.             G.DrawLine(Pens.White, W - 10, 6, W - 30, 6);
  2745.             G.DrawLine(Pens.White, W - 10, 12, W - 30, 12);
  2746.             G.DrawLine(Pens.White, W - 10, 18, W - 30, 18);
  2747.  
  2748.             //-- Text
  2749.             G.DrawString(Text, Font, Brushes.White, new Point(4, 6), NearSF);
  2750.         }
  2751.  
  2752.         G.Dispose();
  2753.         e.Graphics.InterpolationMode = 7;
  2754.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  2755.         B.Dispose();
  2756.     }
  2757. }
  2758.  
  2759. class FlatStickyButton : Control
  2760. {
  2761.  
  2762.     #region " Variables"
  2763.  
  2764.     private int W;
  2765.     private int H;
  2766.     private MouseState State = MouseState.None;
  2767.  
  2768.     private bool _Rounded = false;
  2769.     #endregion
  2770.  
  2771.     #region " Properties"
  2772.  
  2773.     #region " MouseStates"
  2774.  
  2775.     protected override void OnMouseDown(MouseEventArgs e)
  2776.     {
  2777.         base.OnMouseDown(e);
  2778.         State = MouseState.Down;
  2779.         Invalidate();
  2780.     }
  2781.     protected override void OnMouseUp(MouseEventArgs e)
  2782.     {
  2783.         base.OnMouseUp(e);
  2784.         State = MouseState.Over;
  2785.         Invalidate();
  2786.     }
  2787.     protected override void OnMouseEnter(EventArgs e)
  2788.     {
  2789.         base.OnMouseEnter(e);
  2790.         State = MouseState.Over;
  2791.         Invalidate();
  2792.     }
  2793.     protected override void OnMouseLeave(EventArgs e)
  2794.     {
  2795.         base.OnMouseLeave(e);
  2796.         State = MouseState.None;
  2797.         Invalidate();
  2798.     }
  2799.  
  2800.     #endregion
  2801.  
  2802.     #region " Function"
  2803.  
  2804.     private bool[] GetConnectedSides()
  2805.     {
  2806.         object Bool = new bool[4] {
  2807.             false,
  2808.             false,
  2809.             false,
  2810.             false
  2811.         };
  2812.  
  2813.         foreach (Control B in Parent.Controls) {
  2814.             if (B is FlatStickyButton) {
  2815.                 if (object.ReferenceEquals(B, this) | !Rect.IntersectsWith(Rect))
  2816.                     continue;
  2817.                 object A = Math.Atan2(Strings.Left() - B.Left, Top - B.Top) * 2 / Math.PI;
  2818.                 if (A / 1 == A)
  2819.                     Bool(A + 1) = true;
  2820.             }
  2821.         }
  2822.  
  2823.         return Bool;
  2824.     }
  2825.  
  2826.     private Rectangle Rect {
  2827.         get { return new Rectangle(Left, Top, Width, Height); }
  2828.     }
  2829.  
  2830.     #endregion
  2831.  
  2832.     #region " Colors"
  2833.  
  2834.     [Category("Colors")]
  2835.     public Color BaseColor {
  2836.         get { return _BaseColor; }
  2837.         set { _BaseColor = value; }
  2838.     }
  2839.  
  2840.     [Category("Colors")]
  2841.     public Color TextColor {
  2842.         get { return _TextColor; }
  2843.         set { _TextColor = value; }
  2844.     }
  2845.  
  2846.     [Category("Options")]
  2847.     public bool Rounded {
  2848.         get { return _Rounded; }
  2849.         set { _Rounded = value; }
  2850.     }
  2851.  
  2852.     #endregion
  2853.  
  2854.     protected override void OnResize(EventArgs e)
  2855.     {
  2856.         base.OnResize(e);
  2857.         //Height = 32
  2858.     }
  2859.  
  2860.     protected override void OnCreateControl()
  2861.     {
  2862.         base.OnCreateControl();
  2863.         //Size = New Size(112, 32)
  2864.     }
  2865.  
  2866.     #endregion
  2867.  
  2868.     #region " Colors"
  2869.  
  2870.     private Color _BaseColor = _FlatColor;
  2871.  
  2872.     private Color _TextColor = Color.FromArgb(243, 243, 243);
  2873.     #endregion
  2874.  
  2875.     public FlatStickyButton()
  2876.     {
  2877.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  2878.         DoubleBuffered = true;
  2879.         Size = new Size(106, 32);
  2880.         BackColor = Color.Transparent;
  2881.         Font = new Font("Segoe UI", 12);
  2882.         Cursor = Cursors.Hand;
  2883.     }
  2884.  
  2885.     protected override void OnPaint(PaintEventArgs e)
  2886.     {
  2887.         B = new Bitmap(Width, Height);
  2888.         G = Graphics.FromImage(B);
  2889.         W = Width;
  2890.         H = Height;
  2891.  
  2892.         GraphicsPath GP = new GraphicsPath();
  2893.  
  2894.         object GCS = GetConnectedSides();
  2895.         object RoundedBase = Helpers.RoundRect(0, 0, W, H, 0.3, !(GCS(2) | GCS(1)), !(GCS(1) | GCS(0)), !(GCS(3) | GCS(0)), !(GCS(3) | GCS(2)));
  2896.         Rectangle Base = new Rectangle(0, 0, W, H);
  2897.  
  2898.         {
  2899.             G.SmoothingMode = 2;
  2900.             G.PixelOffsetMode = 2;
  2901.             G.TextRenderingHint = 5;
  2902.             G.Clear(BackColor);
  2903.  
  2904.             switch (State) {
  2905.                 case MouseState.None:
  2906.                     if (Rounded) {
  2907.                         //-- Base
  2908.                         GP = RoundedBase;
  2909.                         G.FillPath(new SolidBrush(_BaseColor), GP);
  2910.  
  2911.                         //-- Text
  2912.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  2913.                     } else {
  2914.                         //-- Base
  2915.                         G.FillRectangle(new SolidBrush(_BaseColor), Base);
  2916.  
  2917.                         //-- Text
  2918.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  2919.                     }
  2920.                     break;
  2921.                 case MouseState.Over:
  2922.                     if (Rounded) {
  2923.                         //-- Base
  2924.                         GP = RoundedBase;
  2925.                         G.FillPath(new SolidBrush(_BaseColor), GP);
  2926.                         G.FillPath(new SolidBrush(Color.FromArgb(20, Color.White)), GP);
  2927.  
  2928.                         //-- Text
  2929.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  2930.                     } else {
  2931.                         //-- Base
  2932.                         G.FillRectangle(new SolidBrush(_BaseColor), Base);
  2933.                         G.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), Base);
  2934.  
  2935.                         //-- Text
  2936.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  2937.                     }
  2938.                     break;
  2939.                 case MouseState.Down:
  2940.                     if (Rounded) {
  2941.                         //-- Base
  2942.                         GP = RoundedBase;
  2943.                         G.FillPath(new SolidBrush(_BaseColor), GP);
  2944.                         G.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), GP);
  2945.  
  2946.                         //-- Text
  2947.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  2948.                     } else {
  2949.                         //-- Base
  2950.                         G.FillRectangle(new SolidBrush(_BaseColor), Base);
  2951.                         G.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.Black)), Base);
  2952.  
  2953.                         //-- Text
  2954.                         G.DrawString(Text, Font, new SolidBrush(_TextColor), Base, CenterSF);
  2955.                     }
  2956.                     break;
  2957.             }
  2958.  
  2959.         }
  2960.  
  2961.         base.OnPaint(e);
  2962.         G.Dispose();
  2963.         e.Graphics.InterpolationMode = 7;
  2964.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  2965.         B.Dispose();
  2966.     }
  2967.  
  2968. }
  2969.  
  2970. class FlatNumeric : Control
  2971. {
  2972.  
  2973.     #region " Variables"
  2974.  
  2975.     private int W;
  2976.     private int H;
  2977.     private MouseState State = MouseState.None;
  2978.     private int x;
  2979.     private int y;
  2980.     private long _Value;
  2981.     private long _Min;
  2982.     private long _Max;
  2983.  
  2984.     private bool Bool;
  2985.     #endregion
  2986.  
  2987.     #region " Properties"
  2988.  
  2989.     public long Value {
  2990.         get { return _Value; }
  2991.         set {
  2992.             if (value <= _Max & value >= _Min)
  2993.                 _Value = value;
  2994.             Invalidate();
  2995.         }
  2996.     }
  2997.  
  2998.     public long Maximum {
  2999.         get { return _Max; }
  3000.         set {
  3001.             if (value > _Min)
  3002.                 _Max = value;
  3003.             if (_Value > _Max)
  3004.                 _Value = _Max;
  3005.             Invalidate();
  3006.         }
  3007.     }
  3008.  
  3009.     public long Minimum {
  3010.         get { return _Min; }
  3011.         set {
  3012.             if (value < _Max)
  3013.                 _Min = value;
  3014.             if (_Value < _Min)
  3015.                 _Value = Minimum;
  3016.             Invalidate();
  3017.         }
  3018.     }
  3019.  
  3020.     protected override void OnMouseMove(MouseEventArgs e)
  3021.     {
  3022.         base.OnMouseMove(e);
  3023.         x = e.Location.X;
  3024.         y = e.Location.Y;
  3025.         Invalidate();
  3026.         if (e.X < Width - 23)
  3027.             Cursor = Cursors.IBeam;
  3028.         else
  3029.             Cursor = Cursors.Hand;
  3030.     }
  3031.  
  3032.     protected override void OnMouseDown(MouseEventArgs e)
  3033.     {
  3034.         base.OnMouseDown(e);
  3035.         if (x > Width - 21 && x < Width - 3) {
  3036.             if (y < 15) {
  3037.                 if ((Value + 1) <= _Max)
  3038.                     _Value += 1;
  3039.             } else {
  3040.                 if ((Value - 1) >= _Min)
  3041.                     _Value -= 1;
  3042.             }
  3043.         } else {
  3044.             Bool = !Bool;
  3045.             Focus();
  3046.         }
  3047.         Invalidate();
  3048.     }
  3049.  
  3050.     protected override void OnKeyPress(KeyPressEventArgs e)
  3051.     {
  3052.         base.OnKeyPress(e);
  3053.         try {
  3054.             if (Bool)
  3055.                 _Value = Convert.ToString(Convert.ToString(_Value) + e.KeyChar.ToString());
  3056.             if (_Value > _Max)
  3057.                 _Value = _Max;
  3058.             Invalidate();
  3059.         } catch {
  3060.         }
  3061.     }
  3062.  
  3063.     protected override void OnKeyDown(KeyEventArgs e)
  3064.     {
  3065.         base.OnKeyDown(e);
  3066.         if (e.KeyCode == Keys.Back) {
  3067.             Value = 0;
  3068.         }
  3069.     }
  3070.  
  3071.     protected override void OnResize(EventArgs e)
  3072.     {
  3073.         base.OnResize(e);
  3074.         Height = 30;
  3075.     }
  3076.  
  3077.     #region " Colors"
  3078.  
  3079.     [Category("Colors")]
  3080.     public Color BaseColor {
  3081.         get { return _BaseColor; }
  3082.         set { _BaseColor = value; }
  3083.     }
  3084.  
  3085.     [Category("Colors")]
  3086.     public Color ButtonColor {
  3087.         get { return _ButtonColor; }
  3088.         set { _ButtonColor = value; }
  3089.     }
  3090.  
  3091.     #endregion
  3092.  
  3093.     #endregion
  3094.  
  3095.     #region " Colors"
  3096.  
  3097.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  3098.  
  3099.     private Color _ButtonColor = _FlatColor;
  3100.     #endregion
  3101.  
  3102.     public FlatNumeric()
  3103.     {
  3104.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
  3105.         DoubleBuffered = true;
  3106.         Font = new Font("Segoe UI", 10);
  3107.         BackColor = Color.FromArgb(60, 70, 73);
  3108.         ForeColor = Color.White;
  3109.         _Min = 0;
  3110.         _Max = 9999999;
  3111.     }
  3112.  
  3113.  
  3114.     protected override void OnPaint(PaintEventArgs e)
  3115.     {
  3116.         B = new Bitmap(Width, Height);
  3117.         G = Graphics.FromImage(B);
  3118.         W = Width;
  3119.         H = Height;
  3120.  
  3121.         Rectangle Base = new Rectangle(0, 0, W, H);
  3122.  
  3123.         {
  3124.             G.SmoothingMode = 2;
  3125.             G.PixelOffsetMode = 2;
  3126.             G.TextRenderingHint = 5;
  3127.             G.Clear(BackColor);
  3128.  
  3129.             //-- Base
  3130.             G.FillRectangle(new SolidBrush(_BaseColor), Base);
  3131.             G.FillRectangle(new SolidBrush(_ButtonColor), new Rectangle(Width - 24, 0, 24, H));
  3132.  
  3133.             //-- Add
  3134.             G.DrawString("+", new Font("Segoe UI", 12), Brushes.White, new Point(Width - 12, 8), CenterSF);
  3135.             //-- Subtract
  3136.             G.DrawString("-", new Font("Segoe UI", 10, FontStyle.Bold), Brushes.White, new Point(Width - 12, 22), CenterSF);
  3137.  
  3138.             //-- Text
  3139.             G.DrawString(Value, Font, Brushes.White, new Rectangle(5, 1, W, H), new StringFormat { LineAlignment = StringAlignment.Center });
  3140.         }
  3141.  
  3142.         base.OnPaint(e);
  3143.         G.Dispose();
  3144.         e.Graphics.InterpolationMode = 7;
  3145.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  3146.         B.Dispose();
  3147.     }
  3148.  
  3149. }
  3150.  
  3151. class FlatListBox : Control
  3152. {
  3153.  
  3154.     #region " Variables"
  3155.  
  3156.     private ListBox ListBx = new ListBox();
  3157.  
  3158.     private string[] _items = { "" };
  3159.     #endregion
  3160.  
  3161.     #region " Poperties"
  3162.  
  3163.     [Category("Options")]
  3164.     public string[] items {
  3165.         get { return _items; }
  3166.         set {
  3167.             _items = value;
  3168.             ListBx.Items.Clear();
  3169.             ListBx.Items.AddRange(value);
  3170.             Invalidate();
  3171.         }
  3172.     }
  3173.  
  3174.     [Category("Colors")]
  3175.     public Color SelectedColor {
  3176.         get { return _SelectedColor; }
  3177.         set { _SelectedColor = value; }
  3178.     }
  3179.  
  3180.     public string SelectedItem {
  3181.         get { return ListBx.SelectedItem; }
  3182.     }
  3183.  
  3184.     public int SelectedIndex {
  3185.         get {
  3186.             return ListBx.SelectedIndex;
  3187.             if (ListBx.SelectedIndex < 0)
  3188.                 return;
  3189.         }
  3190.     }
  3191.  
  3192.     public void Clear()
  3193.     {
  3194.         ListBx.Items.Clear();
  3195.     }
  3196.  
  3197.     public void ClearSelected()
  3198.     {
  3199.         for (int i = (ListBx.SelectedItems.Count - 1); i >= 0; i += -1) {
  3200.             ListBx.Items.Remove(ListBx.SelectedItems(i));
  3201.         }
  3202.     }
  3203.  
  3204.     public void  // ERROR: Handles clauses are not supported in C#
  3205. Drawitem(object sender, DrawItemEventArgs e)
  3206.     {
  3207.         if (e.Index < 0)
  3208.             return;
  3209.         e.DrawBackground();
  3210.         e.DrawFocusRectangle();
  3211.  
  3212.         e.Graphics.SmoothingMode = 2;
  3213.         e.Graphics.PixelOffsetMode = 2;
  3214.         e.Graphics.InterpolationMode = 7;
  3215.         e.Graphics.TextRenderingHint = 5;
  3216.  
  3217.         //-- if selected
  3218.         if (Strings.InStr(e.State.ToString, "Selected,") > 0) {
  3219.             //-- Base
  3220.             e.Graphics.FillRectangle(new SolidBrush(_SelectedColor), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));
  3221.  
  3222.             //-- Text
  3223.             e.Graphics.DrawString(" " + ListBx.Items(e.Index).ToString(), new Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 2);
  3224.         } else {
  3225.             //-- Base
  3226.             e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(51, 53, 55)), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));
  3227.  
  3228.             //-- Text
  3229.             e.Graphics.DrawString(" " + ListBx.Items(e.Index).ToString(), new Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 2);
  3230.         }
  3231.  
  3232.         e.Graphics.Dispose();
  3233.     }
  3234.  
  3235.     protected override void OnCreateControl()
  3236.     {
  3237.         base.OnCreateControl();
  3238.         if (!Controls.Contains(ListBx)) {
  3239.             Controls.Add(ListBx);
  3240.         }
  3241.     }
  3242.  
  3243.     public void AddRange(object[] items)
  3244.     {
  3245.         ListBx.Items.Remove("");
  3246.         ListBx.Items.AddRange(items);
  3247.     }
  3248.  
  3249.     public void AddItem(object item)
  3250.     {
  3251.         ListBx.Items.Remove("");
  3252.         ListBx.Items.Add(item);
  3253.     }
  3254.  
  3255.     #endregion
  3256.  
  3257.     #region " Colors"
  3258.  
  3259.     private Color BaseColor = Color.FromArgb(45, 47, 49);
  3260.  
  3261.     private Color _SelectedColor = _FlatColor;
  3262.     #endregion
  3263.  
  3264.     public FlatListBox()
  3265.     {
  3266.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  3267.         DoubleBuffered = true;
  3268.  
  3269.         ListBx.DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed;
  3270.         ListBx.ScrollAlwaysVisible = false;
  3271.         ListBx.HorizontalScrollbar = false;
  3272.         ListBx.BorderStyle = BorderStyle.None;
  3273.         ListBx.BackColor = BaseColor;
  3274.         ListBx.ForeColor = Color.White;
  3275.         ListBx.Location = new Point(3, 3);
  3276.         ListBx.Font = new Font("Segoe UI", 8);
  3277.         ListBx.ItemHeight = 20;
  3278.         ListBx.Items.Clear();
  3279.         ListBx.IntegralHeight = false;
  3280.  
  3281.         Size = new Size(131, 101);
  3282.         BackColor = BaseColor;
  3283.     }
  3284.  
  3285.     protected override void OnPaint(PaintEventArgs e)
  3286.     {
  3287.         B = new Bitmap(Width, Height);
  3288.         G = Graphics.FromImage(B);
  3289.  
  3290.         Rectangle Base = new Rectangle(0, 0, Width, Height);
  3291.  
  3292.         {
  3293.             G.SmoothingMode = 2;
  3294.             G.PixelOffsetMode = 2;
  3295.             G.TextRenderingHint = 5;
  3296.             G.Clear(BackColor);
  3297.  
  3298.             //-- Size
  3299.             ListBx.Size = new Size(Width - 6, Height - 2);
  3300.  
  3301.             //-- Base
  3302.             G.FillRectangle(new SolidBrush(BaseColor), Base);
  3303.         }
  3304.  
  3305.         base.OnPaint(e);
  3306.         G.Dispose();
  3307.         e.Graphics.InterpolationMode = 7;
  3308.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  3309.         B.Dispose();
  3310.     }
  3311.  
  3312. }
  3313.  
  3314. class FlatContextMenuStrip : ContextMenuStrip
  3315. {
  3316.  
  3317.     protected override void OnTextChanged(EventArgs e)
  3318.     {
  3319.         base.OnTextChanged(e);
  3320.         Invalidate();
  3321.     }
  3322.  
  3323.     public FlatContextMenuStrip() : base()
  3324.     {
  3325.         Renderer = new ToolStripProfessionalRenderer(new TColorTable());
  3326.         ShowImageMargin = false;
  3327.         ForeColor = Color.White;
  3328.         Font = new Font("Segoe UI", 8);
  3329.     }
  3330.  
  3331.     protected override void OnPaint(PaintEventArgs e)
  3332.     {
  3333.         base.OnPaint(e);
  3334.         e.Graphics.TextRenderingHint = 5;
  3335.     }
  3336.  
  3337.     public class TColorTable : ProfessionalColorTable
  3338.     {
  3339.  
  3340.         #region " Properties"
  3341.  
  3342.         #region " Colors"
  3343.  
  3344.         [Category("Colors")]
  3345.         public Color _BackColor {
  3346.             get { return BackColor; }
  3347.             set { BackColor = value; }
  3348.         }
  3349.  
  3350.         [Category("Colors")]
  3351.         public Color _CheckedColor {
  3352.             get { return CheckedColor; }
  3353.             set { CheckedColor = value; }
  3354.         }
  3355.  
  3356.         [Category("Colors")]
  3357.         public Color _BorderColor {
  3358.             get { return BorderColor; }
  3359.             set { BorderColor = value; }
  3360.         }
  3361.  
  3362.         #endregion
  3363.  
  3364.         #endregion
  3365.  
  3366.         #region " Colors"
  3367.  
  3368.         private Color BackColor = Color.FromArgb(45, 47, 49);
  3369.         private Color CheckedColor = _FlatColor;
  3370.  
  3371.         private Color BorderColor = Color.FromArgb(53, 58, 60);
  3372.         #endregion
  3373.  
  3374.         #region " Overrides"
  3375.  
  3376.         public override Color ButtonSelectedBorder {
  3377.             get { return BackColor; }
  3378.         }
  3379.         public override Color CheckBackground {
  3380.             get { return CheckedColor; }
  3381.         }
  3382.         public override Color CheckPressedBackground {
  3383.             get { return CheckedColor; }
  3384.         }
  3385.         public override Color CheckSelectedBackground {
  3386.             get { return CheckedColor; }
  3387.         }
  3388.         public override Color ImageMarginGradientBegin {
  3389.             get { return CheckedColor; }
  3390.         }
  3391.         public override Color ImageMarginGradientEnd {
  3392.             get { return CheckedColor; }
  3393.         }
  3394.         public override Color ImageMarginGradientMiddle {
  3395.             get { return CheckedColor; }
  3396.         }
  3397.         public override Color MenuBorder {
  3398.             get { return BorderColor; }
  3399.         }
  3400.         public override Color MenuItemBorder {
  3401.             get { return BorderColor; }
  3402.         }
  3403.         public override Color MenuItemSelected {
  3404.             get { return CheckedColor; }
  3405.         }
  3406.         public override Color SeparatorDark {
  3407.             get { return BorderColor; }
  3408.         }
  3409.         public override Color ToolStripDropDownBackground {
  3410.             get { return BackColor; }
  3411.         }
  3412.  
  3413.         #endregion
  3414.  
  3415.     }
  3416.  
  3417. }
  3418.  
  3419. [DefaultEvent("Scroll")]
  3420. class FlatTrackBar : Control
  3421. {
  3422.  
  3423.     #region " Variables"
  3424.  
  3425.     private int W;
  3426.     private int H;
  3427.     private int Val;
  3428.     private bool Bool;
  3429.     private Rectangle Track;
  3430.     private Rectangle Knob;
  3431.  
  3432.     private _Style Style_;
  3433.     #endregion
  3434.  
  3435.     #region " Properties"
  3436.  
  3437.     #region " Mouse States"
  3438.  
  3439.     protected override void OnMouseDown(MouseEventArgs e)
  3440.     {
  3441.         base.OnMouseDown(e);
  3442.         if (e.Button == Windows.Forms.MouseButtons.Left) {
  3443.             Val = Convert.ToInt32((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 11));
  3444.             Track = new Rectangle(Val, 0, 10, 20);
  3445.  
  3446.             Bool = Track.Contains(e.Location);
  3447.         }
  3448.     }
  3449.  
  3450.     protected override void OnMouseMove(MouseEventArgs e)
  3451.     {
  3452.         base.OnMouseMove(e);
  3453.         if (Bool && e.X > -1 && e.X < (Width + 1)) {
  3454.             Value = _Minimum + Convert.ToInt32((_Maximum - _Minimum) * (e.X / Width));
  3455.         }
  3456.     }
  3457.  
  3458.     protected override void OnMouseUp(MouseEventArgs e)
  3459.     {
  3460.         base.OnMouseUp(e);
  3461.         Bool = false;
  3462.     }
  3463.  
  3464.     #endregion
  3465.  
  3466.     #region " Styles"
  3467.  
  3468.     [Flags()]
  3469.     public enum _Style
  3470.     {
  3471.         Slider,
  3472.         Knob
  3473.     }
  3474.  
  3475.     public _Style Style {
  3476.         get { return Style_; }
  3477.         set { Style_ = value; }
  3478.     }
  3479.  
  3480.     #endregion
  3481.  
  3482.     #region " Colors"
  3483.  
  3484.     [Category("Colors")]
  3485.     public Color TrackColor {
  3486.         get { return _TrackColor; }
  3487.         set { _TrackColor = value; }
  3488.     }
  3489.  
  3490.     [Category("Colors")]
  3491.     public Color HatchColor {
  3492.         get { return _HatchColor; }
  3493.         set { _HatchColor = value; }
  3494.     }
  3495.  
  3496.     #endregion
  3497.  
  3498.     public event ScrollEventHandler Scroll;
  3499.     public delegate void ScrollEventHandler(object sender);
  3500.     private int _Minimum;
  3501.     public int Minimum {
  3502.         get { return Minimum; }
  3503.         set {
  3504.             if (value < 0) {
  3505.             }
  3506.  
  3507.             _Minimum = value;
  3508.  
  3509.             if (value > _Value)
  3510.                 _Value = value;
  3511.             if (value > _Maximum)
  3512.                 _Maximum = value;
  3513.             Invalidate();
  3514.         }
  3515.     }
  3516.     private int _Maximum = 10;
  3517.     public int Maximum {
  3518.         get { return _Maximum; }
  3519.         set {
  3520.             if (value < 0) {
  3521.             }
  3522.  
  3523.             _Maximum = value;
  3524.             if (value < _Value)
  3525.                 _Value = value;
  3526.             if (value < _Minimum)
  3527.                 _Minimum = value;
  3528.             Invalidate();
  3529.         }
  3530.     }
  3531.     private int _Value;
  3532.     public int Value {
  3533.         get { return _Value; }
  3534.         set {
  3535.             if (value == _Value)
  3536.                 return;
  3537.  
  3538.             if (value > _Maximum || value < _Minimum) {
  3539.             }
  3540.  
  3541.             _Value = value;
  3542.             Invalidate();
  3543.             if (Scroll != null) {
  3544.                 Scroll(this);
  3545.             }
  3546.         }
  3547.     }
  3548.     private bool _ShowValue = false;
  3549.     public bool ShowValue {
  3550.         get { return _ShowValue; }
  3551.         set { _ShowValue = value; }
  3552.     }
  3553.  
  3554.     protected override void OnKeyDown(KeyEventArgs e)
  3555.     {
  3556.         base.OnKeyDown(e);
  3557.         if (e.KeyCode == Keys.Subtract) {
  3558.             if (Value == 0)
  3559.                 return;
  3560.             Value -= 1;
  3561.         } else if (e.KeyCode == Keys.Add) {
  3562.             if (Value == _Maximum)
  3563.                 return;
  3564.             Value += 1;
  3565.         }
  3566.     }
  3567.  
  3568.     protected override void OnTextChanged(EventArgs e)
  3569.     {
  3570.         base.OnTextChanged(e);
  3571.         Invalidate();
  3572.     }
  3573.  
  3574.     protected override void OnResize(EventArgs e)
  3575.     {
  3576.         base.OnResize(e);
  3577.         Height = 23;
  3578.     }
  3579.  
  3580.     #endregion
  3581.  
  3582.     #region " Colors"
  3583.  
  3584.     private Color BaseColor = Color.FromArgb(45, 47, 49);
  3585.     private Color _TrackColor = _FlatColor;
  3586.     private Color SliderColor = Color.FromArgb(25, 27, 29);
  3587.  
  3588.     private Color _HatchColor = Color.FromArgb(23, 148, 92);
  3589.     #endregion
  3590.  
  3591.     public FlatTrackBar()
  3592.     {
  3593.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  3594.         DoubleBuffered = true;
  3595.         Height = 18;
  3596.  
  3597.         BackColor = Color.FromArgb(60, 70, 73);
  3598.     }
  3599.  
  3600.     protected override void OnPaint(PaintEventArgs e)
  3601.     {
  3602.         B = new Bitmap(Width, Height);
  3603.         G = Graphics.FromImage(B);
  3604.         W = Width - 1;
  3605.         H = Height - 1;
  3606.  
  3607.         Rectangle Base = new Rectangle(1, 6, W - 2, 8);
  3608.         GraphicsPath GP = default(GraphicsPath), GP2 = new GraphicsPath();
  3609.  
  3610.         {
  3611.             G.SmoothingMode = 2;
  3612.             G.PixelOffsetMode = 2;
  3613.             G.TextRenderingHint = 5;
  3614.             G.Clear(BackColor);
  3615.  
  3616.             //-- Value
  3617.             Val = Convert.ToInt32((_Value - _Minimum) / (_Maximum - _Minimum) * (W - 10));
  3618.             Track = new Rectangle(Val, 0, 10, 20);
  3619.             Knob = new Rectangle(Val, 4, 11, 14);
  3620.  
  3621.             //-- Base
  3622.             GP.AddRectangle(Base);
  3623.             G.SetClip(GP);
  3624.             G.FillRectangle(new SolidBrush(BaseColor), new Rectangle(0, 7, W, 8));
  3625.             G.FillRectangle(new SolidBrush(_TrackColor), new Rectangle(0, 7, Track.X + Track.Width, 8));
  3626.             G.ResetClip();
  3627.  
  3628.             //-- Hatch Brush
  3629.             HatchBrush HB = new HatchBrush(HatchStyle.Plaid, HatchColor, _TrackColor);
  3630.             G.FillRectangle(HB, new Rectangle(-10, 7, Track.X + Track.Width, 8));
  3631.  
  3632.             //-- Slider/Knob
  3633.             switch (Style) {
  3634.                 case _Style.Slider:
  3635.                     GP2.AddRectangle(Track);
  3636.                     G.FillPath(new SolidBrush(SliderColor), GP2);
  3637.                     break;
  3638.                 case _Style.Knob:
  3639.                     GP2.AddEllipse(Knob);
  3640.                     G.FillPath(new SolidBrush(SliderColor), GP2);
  3641.                     break;
  3642.             }
  3643.  
  3644.             //-- Show the value
  3645.             if (ShowValue) {
  3646.                 G.DrawString(Value, new Font("Segoe UI", 8), Brushes.White, new Rectangle(1, 6, W, H), new StringFormat {
  3647.                     Alignment = StringAlignment.Far,
  3648.                     LineAlignment = StringAlignment.Far
  3649.                 });
  3650.             }
  3651.         }
  3652.  
  3653.         base.OnPaint(e);
  3654.         G.Dispose();
  3655.         e.Graphics.InterpolationMode = 7;
  3656.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  3657.         B.Dispose();
  3658.     }
  3659. }
  3660.  
  3661. class FlatStatusBar : Control
  3662. {
  3663.  
  3664.     #region " Variables"
  3665.  
  3666.     private int W;
  3667.     private int H;
  3668.  
  3669.     private bool _ShowTimeDate = false;
  3670.     #endregion
  3671.  
  3672.     #region " Properties"
  3673.  
  3674.     protected override void CreateHandle()
  3675.     {
  3676.         base.CreateHandle();
  3677.         Dock = DockStyle.Bottom;
  3678.     }
  3679.  
  3680.     protected override void OnTextChanged(EventArgs e)
  3681.     {
  3682.         base.OnTextChanged(e);
  3683.         Invalidate();
  3684.     }
  3685.  
  3686.     #region " Colors"
  3687.  
  3688.     [Category("Colors")]
  3689.     public Color BaseColor {
  3690.         get { return _BaseColor; }
  3691.         set { _BaseColor = value; }
  3692.     }
  3693.  
  3694.     [Category("Colors")]
  3695.     public Color TextColor {
  3696.         get { return _TextColor; }
  3697.         set { _TextColor = value; }
  3698.     }
  3699.  
  3700.     [Category("Colors")]
  3701.     public Color RectColor {
  3702.         get { return _RectColor; }
  3703.         set { _RectColor = value; }
  3704.     }
  3705.  
  3706.     #endregion
  3707.  
  3708.     public bool ShowTimeDate {
  3709.         get { return _ShowTimeDate; }
  3710.         set { _ShowTimeDate = value; }
  3711.     }
  3712.  
  3713.     public string GetTimeDate()
  3714.     {
  3715.         return DateTime.Now.Date + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  3716.     }
  3717.  
  3718.     #endregion
  3719.  
  3720.     #region " Colors"
  3721.  
  3722.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  3723.     private Color _TextColor = Color.White;
  3724.  
  3725.     private Color _RectColor = _FlatColor;
  3726.     #endregion
  3727.  
  3728.     public FlatStatusBar()
  3729.     {
  3730.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  3731.         DoubleBuffered = true;
  3732.         Font = new Font("Segoe UI", 8);
  3733.         ForeColor = Color.White;
  3734.         Size = new Size(Width, 20);
  3735.     }
  3736.  
  3737.     protected override void OnPaint(PaintEventArgs e)
  3738.     {
  3739.         B = new Bitmap(Width, Height);
  3740.         G = Graphics.FromImage(B);
  3741.         W = Width;
  3742.         H = Height;
  3743.  
  3744.         Rectangle Base = new Rectangle(0, 0, W, H);
  3745.  
  3746.         {
  3747.             G.SmoothingMode = 2;
  3748.             G.PixelOffsetMode = 2;
  3749.             G.TextRenderingHint = 5;
  3750.             G.Clear(BaseColor);
  3751.  
  3752.             //-- Base
  3753.             G.FillRectangle(new SolidBrush(BaseColor), Base);
  3754.  
  3755.             //-- Text
  3756.             G.DrawString(Text, Font, Brushes.White, new Rectangle(10, 4, W, H), NearSF);
  3757.  
  3758.             //-- Rectangle
  3759.             G.FillRectangle(new SolidBrush(_RectColor), new Rectangle(4, 4, 4, 14));
  3760.  
  3761.             //-- TimeDate
  3762.             if (ShowTimeDate) {
  3763.                 G.DrawString(GetTimeDate, Font, new SolidBrush(_TextColor), new Rectangle(-4, 2, W, H), new StringFormat {
  3764.                     Alignment = StringAlignment.Far,
  3765.                     LineAlignment = StringAlignment.Center
  3766.                 });
  3767.             }
  3768.         }
  3769.  
  3770.         base.OnPaint(e);
  3771.         G.Dispose();
  3772.         e.Graphics.InterpolationMode = 7;
  3773.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  3774.         B.Dispose();
  3775.     }
  3776. }
  3777.  
  3778. class FlatLabel : Label
  3779. {
  3780.  
  3781.     protected override void OnTextChanged(EventArgs e)
  3782.     {
  3783.         base.OnTextChanged(e);
  3784.         Invalidate();
  3785.     }
  3786.  
  3787.     public FlatLabel()
  3788.     {
  3789.         SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  3790.         Font = new Font("Segoe UI", 8);
  3791.         ForeColor = Color.White;
  3792.         BackColor = Color.Transparent;
  3793.         Text = Text;
  3794.     }
  3795.  
  3796. }
  3797.  
  3798. class FlatTreeView : TreeView
  3799. {
  3800.  
  3801.     #region " Variables"
  3802.  
  3803.  
  3804.     private TreeNodeStates State;
  3805.     #endregion
  3806.  
  3807.     #region " Properties"
  3808.  
  3809.     protected override void OnDrawNode(DrawTreeNodeEventArgs e)
  3810.     {
  3811.         try {
  3812.             Rectangle Bounds = new Rectangle(e.Bounds.Location.X, e.Bounds.Location.Y, e.Bounds.Width, e.Bounds.Height);
  3813.             //e.Node.Nodes.Item.
  3814.             switch (State) {
  3815.                 case TreeNodeStates.Default:
  3816.                     e.Graphics.FillRectangle(Brushes.Red, Bounds);
  3817.                     e.Graphics.DrawString(e.Node.Text, new Font("Segoe UI", 8), Brushes.LimeGreen, new Rectangle(Bounds.X + 2, Bounds.Y + 2, Bounds.Width, Bounds.Height), NearSF);
  3818.                     Invalidate();
  3819.                     break;
  3820.                 case TreeNodeStates.Checked:
  3821.                     e.Graphics.FillRectangle(Brushes.Green, Bounds);
  3822.                     e.Graphics.DrawString(e.Node.Text, new Font("Segoe UI", 8), Brushes.Black, new Rectangle(Bounds.X + 2, Bounds.Y + 2, Bounds.Width, Bounds.Height), NearSF);
  3823.                     Invalidate();
  3824.                     break;
  3825.                 case TreeNodeStates.Selected:
  3826.                     e.Graphics.FillRectangle(Brushes.Green, Bounds);
  3827.                     e.Graphics.DrawString(e.Node.Text, new Font("Segoe UI", 8), Brushes.Black, new Rectangle(Bounds.X + 2, Bounds.Y + 2, Bounds.Width, Bounds.Height), NearSF);
  3828.                     Invalidate();
  3829.                     break;
  3830.             }
  3831.  
  3832.         } catch (Exception ex) {
  3833.             Interaction.MsgBox(ex.Message);
  3834.         }
  3835.  
  3836.         base.OnDrawNode(e);
  3837.     }
  3838.  
  3839.     #endregion
  3840.  
  3841.     #region " Colors"
  3842.  
  3843.     private Color _BaseColor = Color.FromArgb(45, 47, 49);
  3844.  
  3845.     private Color _LineColor = Color.FromArgb(25, 27, 29);
  3846.     #endregion
  3847.  
  3848.     public FlatTreeView()
  3849.     {
  3850.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  3851.         DoubleBuffered = true;
  3852.  
  3853.         BackColor = _BaseColor;
  3854.         ForeColor = Color.White;
  3855.         LineColor = _LineColor;
  3856.         DrawMode = TreeViewDrawMode.OwnerDrawAll;
  3857.     }
  3858.  
  3859.     protected override void OnPaint(PaintEventArgs e)
  3860.     {
  3861.         B = new Bitmap(Width, Height);
  3862.         G = Graphics.FromImage(B);
  3863.  
  3864.         Rectangle Base = new Rectangle(0, 0, Width, Height);
  3865.  
  3866.         {
  3867.             G.SmoothingMode = 2;
  3868.             G.PixelOffsetMode = 2;
  3869.             G.TextRenderingHint = 5;
  3870.             G.Clear(BackColor);
  3871.  
  3872.             G.FillRectangle(new SolidBrush(_BaseColor), Base);
  3873.             G.DrawString(Text, new Font("Segoe UI", 8), Brushes.Black, new Rectangle(Bounds.X + 2, Bounds.Y + 2, Bounds.Width, Bounds.Height), NearSF);
  3874.  
  3875.         }
  3876.  
  3877.         base.OnPaint(e);
  3878.         G.Dispose();
  3879.         e.Graphics.InterpolationMode = 7;
  3880.         e.Graphics.DrawImageUnscaled(B, 0, 0);
  3881.         B.Dispose();
  3882.     }
  3883.  
  3884. }
  3885.  
  3886. //=======================================================
  3887. //Service provided by Telerik (www.telerik.com)
  3888. //Conversion powered by NRefactory.
  3889. //Twitter: @telerik, @toddanglin
  3890. //Facebook: facebook.com/telerik
  3891. //=======================================================
Advertisement
Add Comment
Please, Sign In to add comment