Advertisement
gh-xv

iTalk Theme - C#

Aug 8th, 2014
7,238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 157.75 KB | None | 0 0
  1.     #region Imports
  2.  
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Drawing;
  8. using System.Drawing.Drawing2D;
  9. using System.Drawing.Text;
  10. using System.Runtime.InteropServices;
  11. using System.Text;
  12. using System.Windows.Forms;
  13.  
  14. #endregion
  15.  
  16. //|------DO-NOT-REMOVE------|
  17. //
  18. // Creator: HazelDev
  19. // Site   : HazelDev.com
  20. // Created: 23.Jul.2014
  21. // Changed: 24.Jan.2015
  22. // Version: 1.4.0
  23. //
  24. //|------DO-NOT-REMOVE------|
  25.  
  26. namespace iTalk
  27. {
  28.  
  29.     #region RoundRect
  30.  
  31.     // [CREDIT][DO NOT REMOVE]
  32.     //
  33.     // This module was written by Aeonhack
  34.     //
  35.     // [CREDIT][DO NOT REMOVE]
  36.  
  37.     static class RoundRectangle
  38.     {
  39.         public static GraphicsPath RoundRect(Rectangle Rectangle, int Curve)
  40.         {
  41.             GraphicsPath GP = new GraphicsPath();
  42.             int EndArcWidth = Curve * 2;
  43.             GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -180, 90);
  44.             GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -90, 90);
  45.             GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 0, 90);
  46.             GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 90, 90);
  47.             GP.AddLine(new Point(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
  48.             return GP;
  49.         }
  50.  
  51.         public static GraphicsPath RoundRect(int X, int Y, int Width, int Height, int Curve)
  52.         {
  53.             Rectangle Rectangle = new Rectangle(X, Y, Width, Height);
  54.             GraphicsPath GP = new GraphicsPath();
  55.             int EndArcWidth = Curve * 2;
  56.             GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -180, 90);
  57.             GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -90, 90);
  58.             GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 0, 90);
  59.             GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 90, 90);
  60.             GP.AddLine(new Point(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
  61.             return GP;
  62.         }
  63.     }
  64.  
  65.     #endregion
  66.  
  67.     #region  Control Renderer
  68.  
  69.     #region  Color Table
  70.  
  71.     public abstract class xColorTable
  72.     {
  73.         public abstract Color TextColor { get; }
  74.         public abstract Color Background { get; }
  75.         public abstract Color SelectionBorder { get; }
  76.         public abstract Color SelectionTopGradient { get; }
  77.         public abstract Color SelectionMidGradient { get; }
  78.         public abstract Color SelectionBottomGradient { get; }
  79.         public abstract Color PressedBackground { get; }
  80.         public abstract Color CheckedBackground { get; }
  81.         public abstract Color CheckedSelectedBackground { get; }
  82.         public abstract Color DropdownBorder { get; }
  83.         public abstract Color Arrow { get; }
  84.         public abstract Color OverflowBackground { get; }
  85.     }
  86.  
  87.     public abstract class ColorTable
  88.     {
  89.         public abstract xColorTable CommonColorTable { get; }
  90.         public abstract Color BackgroundTopGradient { get; }
  91.         public abstract Color BackgroundBottomGradient { get; }
  92.         public abstract Color DroppedDownItemBackground { get; }
  93.         public abstract Color DropdownTopGradient { get; }
  94.         public abstract Color DropdownBottomGradient { get; }
  95.         public abstract Color Separator { get; }
  96.         public abstract Color ImageMargin { get; }
  97.     }
  98.  
  99.     public class MSColorTable : ColorTable
  100.     {
  101.  
  102.         private xColorTable _CommonColorTable;
  103.  
  104.         public MSColorTable()
  105.         {
  106.             _CommonColorTable = new DefaultCColorTable();
  107.         }
  108.  
  109.         public override xColorTable CommonColorTable
  110.         {
  111.             get
  112.             {
  113.                 return _CommonColorTable;
  114.             }
  115.         }
  116.  
  117.         public override System.Drawing.Color BackgroundTopGradient
  118.         {
  119.             get
  120.             {
  121.                 return Color.FromArgb(246, 246, 246);
  122.             }
  123.         }
  124.  
  125.         public override System.Drawing.Color BackgroundBottomGradient
  126.         {
  127.             get
  128.             {
  129.                 return Color.FromArgb(226, 226, 226);
  130.             }
  131.         }
  132.  
  133.         public override System.Drawing.Color DropdownTopGradient
  134.         {
  135.             get
  136.             {
  137.                 return Color.FromArgb(246, 246, 246);
  138.             }
  139.         }
  140.  
  141.         public override System.Drawing.Color DropdownBottomGradient
  142.         {
  143.             get
  144.             {
  145.                 return Color.FromArgb(246, 246, 246);
  146.             }
  147.         }
  148.  
  149.         public override System.Drawing.Color DroppedDownItemBackground
  150.         {
  151.             get
  152.             {
  153.                 return Color.FromArgb(240, 240, 240);
  154.             }
  155.         }
  156.  
  157.         public override System.Drawing.Color Separator
  158.         {
  159.             get
  160.             {
  161.                 return Color.FromArgb(190, 195, 203);
  162.             }
  163.         }
  164.  
  165.         public override System.Drawing.Color ImageMargin
  166.         {
  167.             get
  168.             {
  169.                 return Color.FromArgb(240, 240, 240);
  170.             }
  171.         }
  172.     }
  173.  
  174.     public class DefaultCColorTable : xColorTable
  175.     {
  176.  
  177.         public override System.Drawing.Color CheckedBackground
  178.         {
  179.             get
  180.             {
  181.                 return Color.FromArgb(230, 230, 230);
  182.             }
  183.         }
  184.  
  185.         public override System.Drawing.Color CheckedSelectedBackground
  186.         {
  187.             get
  188.             {
  189.                 return Color.FromArgb(230, 230, 230);
  190.             }
  191.         }
  192.  
  193.         public override System.Drawing.Color SelectionBorder
  194.         {
  195.             get
  196.             {
  197.                 return Color.FromArgb(180, 180, 180);
  198.             }
  199.         }
  200.  
  201.         public override System.Drawing.Color SelectionTopGradient
  202.         {
  203.             get
  204.             {
  205.                 return Color.FromArgb(240, 240, 240);
  206.             }
  207.         }
  208.  
  209.         public override System.Drawing.Color SelectionMidGradient
  210.         {
  211.             get
  212.             {
  213.                 return Color.FromArgb(235, 235, 235);
  214.             }
  215.         }
  216.  
  217.         public override System.Drawing.Color SelectionBottomGradient
  218.         {
  219.             get
  220.             {
  221.                 return Color.FromArgb(230, 230, 230);
  222.             }
  223.         }
  224.  
  225.         public override System.Drawing.Color PressedBackground
  226.         {
  227.             get
  228.             {
  229.                 return Color.FromArgb(232, 232, 232);
  230.             }
  231.         }
  232.  
  233.         public override System.Drawing.Color TextColor
  234.         {
  235.             get
  236.             {
  237.                 return Color.FromArgb(80, 80, 80);
  238.             }
  239.         }
  240.  
  241.         public override System.Drawing.Color Background
  242.         {
  243.             get
  244.             {
  245.                 return Color.FromArgb(188, 199, 216);
  246.             }
  247.         }
  248.  
  249.         public override System.Drawing.Color DropdownBorder
  250.         {
  251.             get
  252.             {
  253.                 return Color.LightGray;
  254.             }
  255.         }
  256.  
  257.         public override System.Drawing.Color Arrow
  258.         {
  259.             get
  260.             {
  261.                 return Color.Black;
  262.             }
  263.         }
  264.  
  265.         public override System.Drawing.Color OverflowBackground
  266.         {
  267.             get
  268.             {
  269.                 return Color.FromArgb(213, 220, 232);
  270.             }
  271.         }
  272.     }
  273.  
  274.     #endregion
  275.     #region  Renderer
  276.  
  277.     public class ControlRenderer : ToolStripProfessionalRenderer
  278.     {
  279.  
  280.         public ControlRenderer()
  281.             : this(new MSColorTable())
  282.         {
  283.         }
  284.  
  285.         public ControlRenderer(ColorTable ColorTable)
  286.         {
  287.             this.ColorTable = ColorTable;
  288.         }
  289.  
  290.         private ColorTable _ColorTable;
  291.         public new ColorTable ColorTable
  292.         {
  293.             get
  294.             {
  295.                 if (_ColorTable == null)
  296.                 {
  297.                     _ColorTable = new MSColorTable();
  298.                 }
  299.                 return _ColorTable;
  300.             }
  301.             set
  302.             {
  303.                 _ColorTable = value;
  304.             }
  305.         }
  306.  
  307.         protected override void OnRenderToolStripBackground(System.Windows.Forms.ToolStripRenderEventArgs e)
  308.         {
  309.             base.OnRenderToolStripBackground(e);
  310.  
  311.             // Menu strip bar gradient
  312.             using (LinearGradientBrush LGB = new LinearGradientBrush(e.AffectedBounds, this.ColorTable.BackgroundTopGradient, this.ColorTable.BackgroundBottomGradient, LinearGradientMode.Vertical))
  313.             {
  314.                 e.Graphics.FillRectangle(LGB, e.AffectedBounds);
  315.             }
  316.  
  317.         }
  318.  
  319.         protected override void OnRenderToolStripBorder(System.Windows.Forms.ToolStripRenderEventArgs e)
  320.         {
  321.             if (e.ToolStrip.Parent == null)
  322.             {
  323.                 // Draw border around the menu drop-down
  324.                 Rectangle Rect = new Rectangle(0, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
  325.                 using (Pen P1 = new Pen(this.ColorTable.CommonColorTable.DropdownBorder))
  326.                 {
  327.                     e.Graphics.DrawRectangle(P1, Rect);
  328.                 }
  329.  
  330.  
  331.                 // Fill the gap between menu drop-down and owner item
  332.                 using (SolidBrush B1 = new SolidBrush(this.ColorTable.DroppedDownItemBackground))
  333.                 {
  334.                     e.Graphics.FillRectangle(B1, e.ConnectedArea);
  335.                 }
  336.  
  337.             }
  338.         }
  339.  
  340.         protected override void OnRenderMenuItemBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  341.         {
  342.             if (e.Item.Enabled)
  343.             {
  344.                 if (e.Item.Selected)
  345.                 {
  346.                     if (!e.Item.IsOnDropDown)
  347.                     {
  348.                         Rectangle SelRect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1);
  349.                         RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, SelRect);
  350.                     }
  351.                     else
  352.                     {
  353.                         Rectangle SelRect = new Rectangle(2, 0, e.Item.Width - 4, e.Item.Height - 1);
  354.                         RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, SelRect);
  355.                     }
  356.                 }
  357.  
  358.                 if (((ToolStripMenuItem)e.Item).DropDown.Visible && !e.Item.IsOnDropDown)
  359.                 {
  360.                     Rectangle BorderRect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height);
  361.                     // Fill the background
  362.                     Rectangle BackgroundRect = new Rectangle(1, 1, e.Item.Width - 2, e.Item.Height + 2);
  363.                     using (SolidBrush B1 = new SolidBrush(this.ColorTable.DroppedDownItemBackground))
  364.                     {
  365.                         e.Graphics.FillRectangle(B1, BackgroundRect);
  366.                     }
  367.  
  368.  
  369.                     // Draw border
  370.                     using (Pen P1 = new Pen(this.ColorTable.CommonColorTable.DropdownBorder))
  371.                     {
  372.                         RectDrawing.DrawRoundedRectangle(e.Graphics, P1, System.Convert.ToSingle(BorderRect.X), System.Convert.ToSingle(BorderRect.Y), System.Convert.ToSingle(BorderRect.Width), System.Convert.ToSingle(BorderRect.Height), 2);
  373.                     }
  374.  
  375.                 }
  376.                 e.Item.ForeColor = this.ColorTable.CommonColorTable.TextColor;
  377.             }
  378.         }
  379.  
  380.         protected override void OnRenderItemText(System.Windows.Forms.ToolStripItemTextRenderEventArgs e)
  381.         {
  382.             e.TextColor = this.ColorTable.CommonColorTable.TextColor;
  383.             base.OnRenderItemText(e);
  384.         }
  385.  
  386.         protected override void OnRenderItemCheck(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
  387.         {
  388.             base.OnRenderItemCheck(e);
  389.  
  390.             Rectangle rect = new Rectangle(3, 1, e.Item.Height - 3, e.Item.Height - 3);
  391.             Color c = default(Color);
  392.  
  393.             if (e.Item.Selected)
  394.             {
  395.                 c = this.ColorTable.CommonColorTable.CheckedSelectedBackground;
  396.             }
  397.             else
  398.             {
  399.                 c = this.ColorTable.CommonColorTable.CheckedBackground;
  400.             }
  401.  
  402.             using (SolidBrush b = new SolidBrush(c))
  403.             {
  404.                 e.Graphics.FillRectangle(b, rect);
  405.             }
  406.  
  407.  
  408.             using (Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder))
  409.             {
  410.                 e.Graphics.DrawRectangle(p, rect);
  411.             }
  412.  
  413.  
  414.             e.Graphics.DrawString("ΓΌ", new Font("Wingdings", 13, FontStyle.Regular), Brushes.Black, new Point(4, 2));
  415.         }
  416.  
  417.         protected override void OnRenderSeparator(System.Windows.Forms.ToolStripSeparatorRenderEventArgs e)
  418.         {
  419.             base.OnRenderSeparator(e);
  420.             int PT1 = 28;
  421.             int PT2 = System.Convert.ToInt32(e.Item.Width);
  422.             int Y = 3;
  423.             using (Pen P1 = new Pen(this.ColorTable.Separator))
  424.             {
  425.                 e.Graphics.DrawLine(P1, PT1, Y, PT2, Y);
  426.             }
  427.  
  428.         }
  429.  
  430.         protected override void OnRenderImageMargin(System.Windows.Forms.ToolStripRenderEventArgs e)
  431.         {
  432.             base.OnRenderImageMargin(e);
  433.  
  434.             Rectangle BackgroundRect = new Rectangle(0, -1, e.ToolStrip.Width, e.ToolStrip.Height + 1);
  435.             using (LinearGradientBrush LGB = new LinearGradientBrush(BackgroundRect,
  436.                     this.ColorTable.DropdownTopGradient,
  437.                     this.ColorTable.DropdownBottomGradient,
  438.                     LinearGradientMode.Vertical))
  439.             {
  440.                 e.Graphics.FillRectangle(LGB, BackgroundRect);
  441.             }
  442.  
  443.  
  444.             using (SolidBrush B1 = new SolidBrush(this.ColorTable.ImageMargin))
  445.             {
  446.                 e.Graphics.FillRectangle(B1, e.AffectedBounds);
  447.             }
  448.  
  449.         }
  450.  
  451.         protected override void OnRenderButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  452.         {
  453.             Rectangle rect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1);
  454.             bool @checked = System.Convert.ToBoolean(((ToolStripButton)e.Item).Checked);
  455.             bool drawBorder = false;
  456.  
  457.             if (@checked)
  458.             {
  459.                 drawBorder = true;
  460.  
  461.                 if (e.Item.Selected && !e.Item.Pressed)
  462.                 {
  463.                     using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.CheckedSelectedBackground))
  464.                     {
  465.                         e.Graphics.FillRectangle(b, rect);
  466.                     }
  467.  
  468.                 }
  469.                 else
  470.                 {
  471.                     using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.CheckedBackground))
  472.                     {
  473.                         e.Graphics.FillRectangle(b, rect);
  474.                     }
  475.  
  476.                 }
  477.  
  478.             }
  479.             else
  480.             {
  481.  
  482.                 if (e.Item.Pressed)
  483.                 {
  484.                     drawBorder = true;
  485.                     using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground))
  486.                     {
  487.                         e.Graphics.FillRectangle(b, rect);
  488.                     }
  489.  
  490.                 }
  491.                 else if (e.Item.Selected)
  492.                 {
  493.                     drawBorder = true;
  494.                     RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, rect);
  495.                 }
  496.  
  497.             }
  498.  
  499.             if (drawBorder)
  500.             {
  501.                 using (Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder))
  502.                 {
  503.                     e.Graphics.DrawRectangle(p, rect);
  504.                 }
  505.  
  506.             }
  507.         }
  508.  
  509.         protected override void OnRenderDropDownButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  510.         {
  511.             Rectangle rect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1);
  512.             bool drawBorder = false;
  513.  
  514.             if (e.Item.Pressed)
  515.             {
  516.                 drawBorder = true;
  517.                 using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground))
  518.                 {
  519.                     e.Graphics.FillRectangle(b, rect);
  520.                 }
  521.  
  522.             }
  523.             else if (e.Item.Selected)
  524.             {
  525.                 drawBorder = true;
  526.                 RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, rect);
  527.             }
  528.  
  529.             if (drawBorder)
  530.             {
  531.                 using (Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder))
  532.                 {
  533.                     e.Graphics.DrawRectangle(p, rect);
  534.                 }
  535.  
  536.             }
  537.         }
  538.  
  539.         protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
  540.         {
  541.             base.OnRenderSplitButtonBackground(e);
  542.             bool drawBorder = false;
  543.             bool drawSeparator = true;
  544.             ToolStripSplitButton item = (ToolStripSplitButton)e.Item;
  545.             checked
  546.             {
  547.                 Rectangle btnRect = new Rectangle(0, 0, item.ButtonBounds.Width - 1, item.ButtonBounds.Height - 1);
  548.                 Rectangle borderRect = new Rectangle(0, 0, item.Bounds.Width - 1, item.Bounds.Height - 1);
  549.                 bool flag = item.DropDownButtonPressed;
  550.                 if (flag)
  551.                 {
  552.                     drawBorder = true;
  553.                     drawSeparator = false;
  554.                     SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground);
  555.                     try
  556.                     {
  557.                         e.Graphics.FillRectangle(b, borderRect);
  558.                     }
  559.                     finally
  560.                     {
  561.                         flag = (b != null);
  562.                         if (flag)
  563.                         {
  564.                             ((IDisposable)b).Dispose();
  565.                         }
  566.                     }
  567.                 }
  568.                 else
  569.                 {
  570.                     flag = item.DropDownButtonSelected;
  571.                     if (flag)
  572.                     {
  573.                         drawBorder = true;
  574.                         RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, borderRect);
  575.                     }
  576.                 }
  577.                 flag = item.ButtonPressed;
  578.                 if (flag)
  579.                 {
  580.                     SolidBrush b2 = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground);
  581.                     try
  582.                     {
  583.                         e.Graphics.FillRectangle(b2, btnRect);
  584.                     }
  585.                     finally
  586.                     {
  587.                         flag = (b2 != null);
  588.                         if (flag)
  589.                         {
  590.                             ((IDisposable)b2).Dispose();
  591.                         }
  592.                     }
  593.                 }
  594.                 flag = drawBorder;
  595.                 if (flag)
  596.                 {
  597.                     Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder);
  598.                     try
  599.                     {
  600.                         e.Graphics.DrawRectangle(p, borderRect);
  601.                         flag = drawSeparator;
  602.                         if (flag)
  603.                         {
  604.                             e.Graphics.DrawRectangle(p, btnRect);
  605.                         }
  606.                     }
  607.                     finally
  608.                     {
  609.                         flag = (p != null);
  610.                         if (flag)
  611.                         {
  612.                             ((IDisposable)p).Dispose();
  613.                         }
  614.                     }
  615.                     this.DrawCustomArrow(e.Graphics, item);
  616.                 }
  617.             }
  618.         }
  619.  
  620.  
  621.         private void DrawCustomArrow(Graphics g, ToolStripSplitButton item)
  622.         {
  623.             int dropWidth = System.Convert.ToInt32(item.DropDownButtonBounds.Width - 1);
  624.             int dropHeight = System.Convert.ToInt32(item.DropDownButtonBounds.Height - 1);
  625.             float triangleWidth = dropWidth / 2.0F + 1;
  626.             float triangleLeft = System.Convert.ToSingle(item.DropDownButtonBounds.Left + (dropWidth - triangleWidth) / 2.0F);
  627.             float triangleHeight = triangleWidth / 2.0F;
  628.             float triangleTop = System.Convert.ToSingle(item.DropDownButtonBounds.Top + (dropHeight - triangleHeight) / 2.0F + 1);
  629.             RectangleF arrowRect = new RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight);
  630.  
  631.             this.DrawCustomArrow(g, item, Rectangle.Round(arrowRect));
  632.         }
  633.  
  634.         private void DrawCustomArrow(Graphics g, ToolStripItem item, Rectangle rect)
  635.         {
  636.             ToolStripArrowRenderEventArgs arrowEventArgs = new ToolStripArrowRenderEventArgs(g, item, rect, this.ColorTable.CommonColorTable.Arrow, ArrowDirection.Down);
  637.             base.OnRenderArrow(arrowEventArgs);
  638.         }
  639.  
  640.         protected override void OnRenderOverflowButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  641.         {
  642.             Rectangle rect = default(Rectangle);
  643.             Rectangle rectEnd = default(Rectangle);
  644.             rect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 2);
  645.             rectEnd = new Rectangle(rect.X - 5, rect.Y, rect.Width - 5, rect.Height);
  646.  
  647.             if (e.Item.Pressed)
  648.             {
  649.                 using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground))
  650.                 {
  651.                     e.Graphics.FillRectangle(b, rect);
  652.                 }
  653.  
  654.             }
  655.             else if (e.Item.Selected)
  656.             {
  657.                 RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, rect);
  658.             }
  659.             else
  660.             {
  661.                 using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.OverflowBackground))
  662.                 {
  663.                     e.Graphics.FillRectangle(b, rect);
  664.                 }
  665.  
  666.             }
  667.  
  668.             using (Pen P1 = new Pen(this.ColorTable.CommonColorTable.Background))
  669.             {
  670.                 RectDrawing.DrawRoundedRectangle(e.Graphics, P1, System.Convert.ToSingle(rectEnd.X), System.Convert.ToSingle(rectEnd.Y), System.Convert.ToSingle(rectEnd.Width), System.Convert.ToSingle(rectEnd.Height), 3);
  671.             }
  672.  
  673.  
  674.             // Icon
  675.             int w = System.Convert.ToInt32(rect.Width - 1);
  676.             int h = System.Convert.ToInt32(rect.Height - 1);
  677.             float triangleWidth = w / 2.0F + 1;
  678.             float triangleLeft = System.Convert.ToSingle(rect.Left + (w - triangleWidth) / 2.0F + 3);
  679.             float triangleHeight = triangleWidth / 2.0F;
  680.             float triangleTop = System.Convert.ToSingle(rect.Top + (h - triangleHeight) / 2.0F + 7);
  681.             RectangleF arrowRect = new RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight);
  682.             this.DrawCustomArrow(e.Graphics, e.Item, Rectangle.Round(arrowRect));
  683.  
  684.             using (Pen p = new Pen(this.ColorTable.CommonColorTable.Arrow))
  685.             {
  686.                 e.Graphics.DrawLine(p, triangleLeft + 2, triangleTop - 2, triangleLeft + triangleWidth - 2, triangleTop - 2);
  687.             }
  688.  
  689.         }
  690.     }
  691.  
  692.     #endregion
  693.     #region  Drawing
  694.  
  695.     public class RectDrawing
  696.     {
  697.  
  698.         public static void DrawSelection(Graphics G, xColorTable ColorTable, Rectangle Rect)
  699.         {
  700.             Rectangle TopRect = default(Rectangle);
  701.             Rectangle BottomRect = default(Rectangle);
  702.             Rectangle FillRect = new Rectangle(Rect.X + 1, Rect.Y + 1, Rect.Width - 1, Rect.Height - 1);
  703.  
  704.             TopRect = FillRect;
  705.             TopRect.Height -= System.Convert.ToInt32(TopRect.Height / 2);
  706.             BottomRect = new Rectangle(TopRect.X, TopRect.Bottom, TopRect.Width, FillRect.Height - TopRect.Height);
  707.  
  708.             // Top gradient
  709.             using (LinearGradientBrush LGB = new LinearGradientBrush(TopRect, ColorTable.SelectionTopGradient, ColorTable.SelectionMidGradient, LinearGradientMode.Vertical))
  710.             {
  711.                 G.FillRectangle(LGB, TopRect);
  712.             }
  713.  
  714.  
  715.             // Bottom
  716.             using (SolidBrush B1 = new SolidBrush(ColorTable.SelectionBottomGradient))
  717.             {
  718.                 G.FillRectangle(B1, BottomRect);
  719.             }
  720.  
  721.  
  722.             // Border
  723.             using (Pen P1 = new Pen(ColorTable.SelectionBorder))
  724.             {
  725.                 RectDrawing.DrawRoundedRectangle(G, P1, System.Convert.ToSingle(Rect.X), System.Convert.ToSingle(Rect.Y), System.Convert.ToSingle(Rect.Width), System.Convert.ToSingle(Rect.Height), 2);
  726.             }
  727.  
  728.         }
  729.  
  730.         public static void DrawRoundedRectangle(Graphics G, Pen P, float X, float Y, float W, float H, float Rad)
  731.         {
  732.  
  733.             using (GraphicsPath gp = new GraphicsPath())
  734.             {
  735.                 gp.AddLine(X + Rad, Y, X + W - (Rad * 2), Y);
  736.                 gp.AddArc(X + W - (Rad * 2), Y, Rad * 2, Rad * 2, 270, 90);
  737.                 gp.AddLine(X + W, Y + Rad, X + W, Y + H - (Rad * 2));
  738.                 gp.AddArc(X + W - (Rad * 2), Y + H - (Rad * 2), Rad * 2, Rad * 2, 0, 90);
  739.                 gp.AddLine(X + W - (Rad * 2), Y + H, X + Rad, Y + H);
  740.                 gp.AddArc(X, Y + H - (Rad * 2), Rad * 2, Rad * 2, 90, 90);
  741.                 gp.AddLine(X, Y + H - (Rad * 2), X, Y + Rad);
  742.                 gp.AddArc(X, Y, Rad * 2, Rad * 2, 180, 90);
  743.                 gp.CloseFigure();
  744.  
  745.                 G.SmoothingMode = SmoothingMode.AntiAlias;
  746.                 G.DrawPath(P, gp);
  747.                 G.SmoothingMode = SmoothingMode.Default;
  748.             }
  749.  
  750.         }
  751.     }
  752.  
  753.     #endregion
  754.  
  755.     #endregion
  756.     #region  ThemeContainer
  757.  
  758.     public class iTalk_ThemeContainer : ContainerControl
  759.     {
  760.  
  761.  
  762.         #region  Variables
  763.  
  764.         private Point MouseP = new Point(0, 0);
  765.         private bool Cap = false;
  766.         private int MoveHeight;
  767.         private string _TextBottom = null;
  768.         const int BorderCurve = 7;
  769.         protected MouseState State;
  770.         private bool HasShown;
  771.         private Rectangle HeaderRect;
  772.  
  773.         #endregion
  774.         #region  Enums
  775.  
  776.         public enum MouseState
  777.         {
  778.             None = 0,
  779.             Over = 1,
  780.             Down = 2
  781.         }
  782.  
  783.         #endregion
  784.         #region  Properties
  785.  
  786.         private bool _Sizable = true;
  787.         public bool Sizable
  788.         {
  789.             get
  790.             {
  791.                 return _Sizable;
  792.             }
  793.             set
  794.             {
  795.                 _Sizable = value;
  796.             }
  797.         }
  798.  
  799.         private bool _SmartBounds = false;
  800.         public bool SmartBounds
  801.         {
  802.             get
  803.             {
  804.                 return _SmartBounds;
  805.             }
  806.             set
  807.             {
  808.                 _SmartBounds = value;
  809.             }
  810.         }
  811.  
  812.         private bool _IsParentForm;
  813.         protected bool IsParentForm
  814.         {
  815.             get
  816.             {
  817.                 return _IsParentForm;
  818.             }
  819.         }
  820.  
  821.         protected bool IsParentMdi
  822.         {
  823.             get
  824.             {
  825.                 if (Parent == null)
  826.                 {
  827.                     return false;
  828.                 }
  829.                 return Parent.Parent != null;
  830.             }
  831.         }
  832.  
  833.         private bool _ControlMode;
  834.         protected bool ControlMode
  835.         {
  836.             get
  837.             {
  838.                 return _ControlMode;
  839.             }
  840.             set
  841.             {
  842.                 _ControlMode = value;
  843.                 Invalidate();
  844.             }
  845.         }
  846.  
  847.         private FormStartPosition _StartPosition;
  848.         public FormStartPosition StartPosition
  849.         {
  850.             get
  851.             {
  852.                 if (_IsParentForm && !_ControlMode)
  853.                 {
  854.                     return ParentForm.StartPosition;
  855.                 }
  856.                 else
  857.                 {
  858.                     return _StartPosition;
  859.                 }
  860.             }
  861.             set
  862.             {
  863.                 _StartPosition = value;
  864.  
  865.                 if (_IsParentForm && !_ControlMode)
  866.                 {
  867.                     ParentForm.StartPosition = value;
  868.                 }
  869.             }
  870.         }
  871.  
  872.         #endregion
  873.         #region  EventArgs
  874.  
  875.         protected sealed override void OnParentChanged(EventArgs e)
  876.         {
  877.             base.OnParentChanged(e);
  878.  
  879.             if (Parent == null)
  880.             {
  881.                 return;
  882.             }
  883.             _IsParentForm = Parent is Form;
  884.  
  885.             if (!_ControlMode)
  886.             {
  887.                 InitializeMessages();
  888.  
  889.                 if (_IsParentForm)
  890.                 {
  891.                     this.ParentForm.FormBorderStyle = FormBorderStyle.None;
  892.                     this.ParentForm.TransparencyKey = Color.Fuchsia;
  893.  
  894.                     if (!DesignMode)
  895.                     {
  896.                         ParentForm.Shown += FormShown;
  897.                     }
  898.                 }
  899.                 Parent.BackColor = BackColor;
  900.                 Parent.MinimumSize = new Size(126, 39);
  901.             }
  902.         }
  903.  
  904.         protected sealed override void OnSizeChanged(EventArgs e)
  905.         {
  906.             base.OnSizeChanged(e);
  907.             if (!_ControlMode)
  908.             {
  909.                 HeaderRect = new Rectangle(0, 0, Width - 14, MoveHeight - 7);
  910.             }
  911.             Invalidate();
  912.         }
  913.  
  914.         protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  915.         {
  916.             base.OnMouseDown(e);
  917.             if (e.Button == MouseButtons.Left)
  918.             {
  919.                 SetState(MouseState.Down);
  920.             }
  921.             if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized || _ControlMode))
  922.             {
  923.                 if (HeaderRect.Contains(e.Location))
  924.                 {
  925.                     Capture = false;
  926.                     WM_LMBUTTONDOWN = true;
  927.                     DefWndProc(ref Messages[0]);
  928.                 }
  929.                 else if (_Sizable && !(Previous == 0))
  930.                 {
  931.                     Capture = false;
  932.                     WM_LMBUTTONDOWN = true;
  933.                     DefWndProc(ref Messages[Previous]);
  934.                 }
  935.             }
  936.         }
  937.  
  938.         protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  939.         {
  940.             base.OnMouseUp(e);
  941.             Cap = false;
  942.         }
  943.  
  944.         protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  945.         {
  946.             base.OnMouseMove(e);
  947.             if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized))
  948.             {
  949.                 if (_Sizable && !_ControlMode)
  950.                 {
  951.                     InvalidateMouse();
  952.                 }
  953.             }
  954.             if (Cap)
  955.             {
  956.                 Parent.Location = (System.Drawing.Point)((object)(System.Convert.ToDouble(MousePosition) - System.Convert.ToDouble(MouseP)));
  957.             }
  958.         }
  959.  
  960.         protected override void OnInvalidated(System.Windows.Forms.InvalidateEventArgs e)
  961.         {
  962.             base.OnInvalidated(e);
  963.             ParentForm.Text = Text;
  964.         }
  965.  
  966.         protected override void OnPaintBackground(PaintEventArgs e)
  967.         {
  968.             base.OnPaintBackground(e);
  969.         }
  970.  
  971.         protected override void OnTextChanged(System.EventArgs e)
  972.         {
  973.             base.OnTextChanged(e);
  974.             Invalidate();
  975.         }
  976.  
  977.         private void FormShown(object sender, EventArgs e)
  978.         {
  979.             if (_ControlMode || HasShown)
  980.             {
  981.                 return;
  982.             }
  983.  
  984.             if (_StartPosition == FormStartPosition.CenterParent || _StartPosition == FormStartPosition.CenterScreen)
  985.             {
  986.                 Rectangle SB = Screen.PrimaryScreen.Bounds;
  987.                 Rectangle CB = ParentForm.Bounds;
  988.                 ParentForm.Location = new Point(SB.Width / 2 - CB.Width / 2, SB.Height / 2 - CB.Width / 2);
  989.             }
  990.             HasShown = true;
  991.         }
  992.  
  993.         #endregion
  994.         #region  Mouse & Size
  995.  
  996.         private void SetState(MouseState current)
  997.         {
  998.             State = current;
  999.             Invalidate();
  1000.         }
  1001.  
  1002.         private Point GetIndexPoint;
  1003.         private bool B1x;
  1004.         private bool B2x;
  1005.         private bool B3;
  1006.         private bool B4;
  1007.         private int GetIndex()
  1008.         {
  1009.             GetIndexPoint = PointToClient(MousePosition);
  1010.             B1x = GetIndexPoint.X < 7;
  1011.             B2x = GetIndexPoint.X > Width - 7;
  1012.             B3 = GetIndexPoint.Y < 7;
  1013.             B4 = GetIndexPoint.Y > Height - 7;
  1014.  
  1015.             if (B1x && B3)
  1016.             {
  1017.                 return 4;
  1018.             }
  1019.             if (B1x && B4)
  1020.             {
  1021.                 return 7;
  1022.             }
  1023.             if (B2x && B3)
  1024.             {
  1025.                 return 5;
  1026.             }
  1027.             if (B2x && B4)
  1028.             {
  1029.                 return 8;
  1030.             }
  1031.             if (B1x)
  1032.             {
  1033.                 return 1;
  1034.             }
  1035.             if (B2x)
  1036.             {
  1037.                 return 2;
  1038.             }
  1039.             if (B3)
  1040.             {
  1041.                 return 3;
  1042.             }
  1043.             if (B4)
  1044.             {
  1045.                 return 6;
  1046.             }
  1047.             return 0;
  1048.         }
  1049.  
  1050.         private int Current;
  1051.         private int Previous;
  1052.         private void InvalidateMouse()
  1053.         {
  1054.             Current = GetIndex();
  1055.             if (Current == Previous)
  1056.             {
  1057.                 return;
  1058.             }
  1059.  
  1060.             Previous = Current;
  1061.             switch (Previous)
  1062.             {
  1063.                 case 0:
  1064.                     Cursor = Cursors.Default;
  1065.                     break;
  1066.                 case 6:
  1067.                     Cursor = Cursors.SizeNS;
  1068.                     break;
  1069.                 case 8:
  1070.                     Cursor = Cursors.SizeNWSE;
  1071.                     break;
  1072.                 case 7:
  1073.                     Cursor = Cursors.SizeNESW;
  1074.                     break;
  1075.             }
  1076.         }
  1077.  
  1078.         private Message[] Messages = new Message[9];
  1079.         private void InitializeMessages()
  1080.         {
  1081.             Messages[0] = Message.Create(Parent.Handle, 161, new IntPtr(2), IntPtr.Zero);
  1082.             for (int I = 1; I <= 8; I++)
  1083.             {
  1084.                 Messages[I] = Message.Create(Parent.Handle, 161, new IntPtr(I + 9), IntPtr.Zero);
  1085.             }
  1086.         }
  1087.  
  1088.         private void CorrectBounds(Rectangle bounds)
  1089.         {
  1090.             if (Parent.Width > bounds.Width)
  1091.             {
  1092.                 Parent.Width = bounds.Width;
  1093.             }
  1094.             if (Parent.Height > bounds.Height)
  1095.             {
  1096.                 Parent.Height = bounds.Height;
  1097.             }
  1098.  
  1099.             int X = Parent.Location.X;
  1100.             int Y = Parent.Location.Y;
  1101.  
  1102.             if (X < bounds.X)
  1103.             {
  1104.                 X = bounds.X;
  1105.             }
  1106.             if (Y < bounds.Y)
  1107.             {
  1108.                 Y = bounds.Y;
  1109.             }
  1110.  
  1111.             int Width = bounds.X + bounds.Width;
  1112.             int Height = bounds.Y + bounds.Height;
  1113.  
  1114.             if (X + Parent.Width > Width)
  1115.             {
  1116.                 X = Width - Parent.Width;
  1117.             }
  1118.             if (Y + Parent.Height > Height)
  1119.             {
  1120.                 Y = Height - Parent.Height;
  1121.             }
  1122.  
  1123.             Parent.Location = new Point(X, Y);
  1124.         }
  1125.  
  1126.         private bool WM_LMBUTTONDOWN;
  1127.         protected override void WndProc(ref Message m)
  1128.         {
  1129.             base.WndProc(ref m);
  1130.  
  1131.             if (WM_LMBUTTONDOWN && m.Msg == 513)
  1132.             {
  1133.                 WM_LMBUTTONDOWN = false;
  1134.  
  1135.                 SetState(MouseState.Over);
  1136.                 if (!_SmartBounds)
  1137.                 {
  1138.                     return;
  1139.                 }
  1140.  
  1141.                 if (IsParentMdi)
  1142.                 {
  1143.                     CorrectBounds(new Rectangle(Point.Empty, Parent.Parent.Size));
  1144.                 }
  1145.                 else
  1146.                 {
  1147.                     CorrectBounds(Screen.FromControl(Parent).WorkingArea);
  1148.                 }
  1149.             }
  1150.         }
  1151.  
  1152.         #endregion
  1153.  
  1154.         protected override void OnCreateControl()
  1155.         {
  1156.             base.OnCreateControl();
  1157.             this.ParentForm.FormBorderStyle = FormBorderStyle.None;
  1158.             this.ParentForm.TransparencyKey = Color.Fuchsia;
  1159.         }
  1160.  
  1161.         protected override void CreateHandle()
  1162.         {
  1163.             base.CreateHandle();
  1164.         }
  1165.  
  1166.         public iTalk_ThemeContainer()
  1167.         {
  1168.             SetStyle((ControlStyles)(139270), true);
  1169.             Dock = DockStyle.Fill;
  1170.             MoveHeight = 25;
  1171.             Padding = new Padding(3, 28, 3, 28);
  1172.             Font = new Font("Segoe UI", 8, FontStyle.Regular);
  1173.             ForeColor = Color.FromArgb(142, 142, 142);
  1174.             BackColor = Color.FromArgb(246, 246, 246);
  1175.             DoubleBuffered = true;
  1176.         }
  1177.  
  1178.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  1179.         {
  1180.             base.OnPaint(e);
  1181.  
  1182.             Bitmap B = new Bitmap(Width, Height);
  1183.             Graphics G = Graphics.FromImage(B);
  1184.             Rectangle ClientRectangle = new Rectangle(0, 0, Width - 1, Height - 1);
  1185.             Color TransparencyKey = this.ParentForm.TransparencyKey;
  1186.  
  1187.             G.SmoothingMode = SmoothingMode.Default;
  1188.             G.Clear(TransparencyKey);
  1189.  
  1190.             // Draw the container borders
  1191.             G.FillPath(new SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(ClientRectangle, BorderCurve));
  1192.             // Draw a rectangle in which the controls should be added on
  1193.             G.FillPath(new SolidBrush(Color.FromArgb(246, 246, 246)), RoundRectangle.RoundRect(new Rectangle(2, 20, Width - 5, Height - 42), BorderCurve));
  1194.  
  1195.             // Patch the header with a rectangle that has a curve so its border will remain within container bounds
  1196.             G.FillPath(new SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(new Rectangle(2, 2, (int)(Width / 2 + 2), 16), BorderCurve));
  1197.             G.FillPath(new SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(new Rectangle((int)(Width / 2 - 3), 2, (int)(Width / 2), 16), BorderCurve));
  1198.             // Fill the header rectangle below the patch
  1199.             G.FillRectangle(new SolidBrush(Color.FromArgb(52, 52, 52)), new Rectangle(2, 15, Width - 5, 10));
  1200.  
  1201.             // Increase the thickness of the container borders
  1202.             G.DrawPath(new Pen(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(new Rectangle(2, 2, Width - 5, Height - 5), BorderCurve));
  1203.             G.DrawPath(new Pen(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(ClientRectangle, BorderCurve));
  1204.  
  1205.             // Draw the string from the specified 'Text' property on the header rectangle
  1206.             G.DrawString(Text, new Font("Trebuchet MS", 10, FontStyle.Bold), new SolidBrush(Color.FromArgb(221, 221, 221)), new Rectangle(BorderCurve, BorderCurve - 4, Width - 1, 22), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Near });
  1207.  
  1208.  
  1209.             // Draws a rectangle at the bottom of the container
  1210.             G.FillRectangle(new SolidBrush(Color.FromArgb(52, 52, 52)), 0, Height - 25, Width - 3, 22 - 2);
  1211.             G.DrawLine(new Pen(Color.FromArgb(52, 52, 52)), 5, Height - 5, Width - 6, Height - 5);
  1212.             G.DrawLine(new Pen(Color.FromArgb(52, 52, 52)), 7, Height - 4, Width - 7, Height - 4);
  1213.  
  1214.             G.DrawString(_TextBottom, new Font("Trebuchet MS", 10, FontStyle.Bold), new SolidBrush(Color.FromArgb(221, 221, 221)), 5, Height - 23);
  1215.  
  1216.             e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  1217.             G.Dispose();
  1218.             B.Dispose();
  1219.         }
  1220.     }
  1221.  
  1222.     #endregion
  1223.     #region ControlBox
  1224.  
  1225.     public class iTalk_ControlBox : Control
  1226.     {
  1227.  
  1228.         #region Enums
  1229.  
  1230.         public enum MouseState : byte
  1231.         {
  1232.             None = 0,
  1233.             Over = 1,
  1234.             Down = 2,
  1235.             Block = 3
  1236.         }
  1237.  
  1238.         #endregion
  1239.         #region Variables
  1240.  
  1241.         MouseState State = MouseState.None;
  1242.         int i;
  1243.         Rectangle CloseRect = new Rectangle(28, 0, 47, 18);
  1244.         Rectangle MinimizeRect = new Rectangle(0, 0, 28, 18);
  1245.  
  1246.         #endregion
  1247.         #region EventArgs
  1248.  
  1249.         protected override void OnMouseClick(MouseEventArgs e)
  1250.         {
  1251.             base.OnMouseClick(e);
  1252.             if (i > 0 & i < 28)
  1253.             {
  1254.                 this.FindForm().WindowState = FormWindowState.Minimized;
  1255.             }
  1256.             else if (i > 30 & i < 75)
  1257.             {
  1258.                 this.FindForm().Close();
  1259.             }
  1260.  
  1261.             State = MouseState.Down;
  1262.         }
  1263.  
  1264.         protected override void OnMouseEnter(System.EventArgs e)
  1265.         {
  1266.             base.OnMouseEnter(e);
  1267.             State = MouseState.Over;
  1268.             Invalidate();
  1269.         }
  1270.  
  1271.         protected override void OnMouseLeave(System.EventArgs e)
  1272.         {
  1273.             base.OnMouseLeave(e);
  1274.             State = MouseState.None;
  1275.             Invalidate();
  1276.         }
  1277.  
  1278.         protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  1279.         {
  1280.             base.OnMouseUp(e);
  1281.             State = MouseState.Over;
  1282.             Invalidate();
  1283.         }
  1284.  
  1285.         protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  1286.         {
  1287.             base.OnMouseMove(e);
  1288.             i = e.Location.X;
  1289.             Invalidate();
  1290.         }
  1291.  
  1292.         protected override void OnResize(EventArgs e)
  1293.         {
  1294.             base.OnResize(e);
  1295.             Width = 77;
  1296.             Height = 19;
  1297.         }
  1298.  
  1299.         #endregion
  1300.  
  1301.         public iTalk_ControlBox()
  1302.         {
  1303.             SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  1304.             BackColor = Color.Transparent;
  1305.             DoubleBuffered = true;
  1306.             Anchor = AnchorStyles.Top | AnchorStyles.Right;
  1307.         }
  1308.         protected override void OnCreateControl()
  1309.         {
  1310.             base.OnCreateControl();
  1311.             Point location = new Point(checked(this.FindForm().Width - 81), -1);
  1312.             this.Location = location;
  1313.         }
  1314.  
  1315.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  1316.         {
  1317.             base.OnPaint(e);
  1318.  
  1319.             Bitmap B = new Bitmap(Width, Height);
  1320.             Graphics G = Graphics.FromImage(B);
  1321.             GraphicsPath GP_MinimizeRect = new GraphicsPath();
  1322.             GraphicsPath GP_CloseRect = new GraphicsPath();
  1323.  
  1324.             GP_MinimizeRect.AddRectangle(MinimizeRect);
  1325.             GP_CloseRect.AddRectangle(CloseRect);
  1326.             G.Clear(BackColor);
  1327.  
  1328.             switch (State)
  1329.             {
  1330.                 case MouseState.None:
  1331.                 NonePoint:
  1332.                     LinearGradientBrush MinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1333.                     G.FillPath(MinimizeGradient, GP_MinimizeRect);
  1334.                     G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect);
  1335.                     G.DrawString("0", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16);
  1336.  
  1337.                     LinearGradientBrush CloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1338.                     G.FillPath(CloseGradient, GP_CloseRect);
  1339.                     G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect);
  1340.                     G.DrawString("r", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16);
  1341.                     break;
  1342.                 case MouseState.Over:
  1343.                     if (i > 0 & i < 28)
  1344.                     {
  1345.                         LinearGradientBrush xMinimizeGradient = new LinearGradientBrush(this.MinimizeRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90f);
  1346.                         G.FillPath(xMinimizeGradient, GP_MinimizeRect);
  1347.                         G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect);
  1348.                         G.DrawString("0", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16);
  1349.  
  1350.                         LinearGradientBrush xCloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1351.                         G.FillPath(xCloseGradient, GP_CloseRect);
  1352.                         G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect);
  1353.                         G.DrawString("r", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16);
  1354.                     }
  1355.                     else if (i > 30 & i < 75)
  1356.                     {
  1357.                         LinearGradientBrush xCloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90);
  1358.                         G.FillPath(xCloseGradient, GP_CloseRect);
  1359.                         G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect);
  1360.                         G.DrawString("r", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16);
  1361.  
  1362.                         LinearGradientBrush xMinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1363.                         G.FillPath(xMinimizeGradient, RoundRectangle.RoundRect(MinimizeRect, 1));
  1364.                         G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect);
  1365.                         G.DrawString("0", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16);
  1366.                     }
  1367.                     else
  1368.                     {
  1369.                         goto NonePoint; // Return to [MouseState = None]    
  1370.                     }
  1371.                     break;
  1372.             }
  1373.  
  1374.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  1375.             G.Dispose();
  1376.             GP_CloseRect.Dispose();
  1377.             GP_MinimizeRect.Dispose();
  1378.             B.Dispose();
  1379.         }
  1380.     }
  1381.  
  1382.     #endregion
  1383.     #region Button 1
  1384.  
  1385.     class iTalk_Button_1 : Control
  1386.     {
  1387.  
  1388.         #region Variables
  1389.  
  1390.         private int MouseState;
  1391.         private GraphicsPath Shape;
  1392.         private LinearGradientBrush InactiveGB;
  1393.         private LinearGradientBrush PressedGB;
  1394.         private LinearGradientBrush PressedContourGB;
  1395.         private Rectangle R1;
  1396.         private Pen P1;
  1397.         private Pen P3;
  1398.         private Image _Image;
  1399.         private Size _ImageSize;
  1400.         private StringAlignment _TextAlignment = StringAlignment.Center;
  1401.         private Color _TextColor = Color.FromArgb(150, 150, 150);
  1402.         private ContentAlignment _ImageAlign = ContentAlignment.MiddleLeft;
  1403.  
  1404.         #endregion
  1405.         #region Image Designer
  1406.  
  1407.         private static PointF ImageLocation(StringFormat SF, SizeF Area, SizeF ImageArea)
  1408.         {
  1409.             PointF MyPoint = default(PointF);
  1410.             switch (SF.Alignment)
  1411.             {
  1412.                 case StringAlignment.Center:
  1413.                     MyPoint.X = Convert.ToSingle((Area.Width - ImageArea.Width) / 2);
  1414.                     break;
  1415.                 case StringAlignment.Near:
  1416.                     MyPoint.X = 2;
  1417.                     break;
  1418.                 case StringAlignment.Far:
  1419.                     MyPoint.X = Area.Width - ImageArea.Width - 2;
  1420.  
  1421.                     break;
  1422.             }
  1423.  
  1424.             switch (SF.LineAlignment)
  1425.             {
  1426.                 case StringAlignment.Center:
  1427.                     MyPoint.Y = Convert.ToSingle((Area.Height - ImageArea.Height) / 2);
  1428.                     break;
  1429.                 case StringAlignment.Near:
  1430.                     MyPoint.Y = 2;
  1431.                     break;
  1432.                 case StringAlignment.Far:
  1433.                     MyPoint.Y = Area.Height - ImageArea.Height - 2;
  1434.                     break;
  1435.             }
  1436.             return MyPoint;
  1437.         }
  1438.  
  1439.         private StringFormat GetStringFormat(ContentAlignment _ContentAlignment)
  1440.         {
  1441.             StringFormat SF = new StringFormat();
  1442.             switch (_ContentAlignment)
  1443.             {
  1444.                 case ContentAlignment.MiddleCenter:
  1445.                     SF.LineAlignment = StringAlignment.Center;
  1446.                     SF.Alignment = StringAlignment.Center;
  1447.                     break;
  1448.                 case ContentAlignment.MiddleLeft:
  1449.                     SF.LineAlignment = StringAlignment.Center;
  1450.                     SF.Alignment = StringAlignment.Near;
  1451.                     break;
  1452.                 case ContentAlignment.MiddleRight:
  1453.                     SF.LineAlignment = StringAlignment.Center;
  1454.                     SF.Alignment = StringAlignment.Far;
  1455.                     break;
  1456.                 case ContentAlignment.TopCenter:
  1457.                     SF.LineAlignment = StringAlignment.Near;
  1458.                     SF.Alignment = StringAlignment.Center;
  1459.                     break;
  1460.                 case ContentAlignment.TopLeft:
  1461.                     SF.LineAlignment = StringAlignment.Near;
  1462.                     SF.Alignment = StringAlignment.Near;
  1463.                     break;
  1464.                 case ContentAlignment.TopRight:
  1465.                     SF.LineAlignment = StringAlignment.Near;
  1466.                     SF.Alignment = StringAlignment.Far;
  1467.                     break;
  1468.                 case ContentAlignment.BottomCenter:
  1469.                     SF.LineAlignment = StringAlignment.Far;
  1470.                     SF.Alignment = StringAlignment.Center;
  1471.                     break;
  1472.                 case ContentAlignment.BottomLeft:
  1473.                     SF.LineAlignment = StringAlignment.Far;
  1474.                     SF.Alignment = StringAlignment.Near;
  1475.                     break;
  1476.                 case ContentAlignment.BottomRight:
  1477.                     SF.LineAlignment = StringAlignment.Far;
  1478.                     SF.Alignment = StringAlignment.Far;
  1479.                     break;
  1480.             }
  1481.             return SF;
  1482.         }
  1483.  
  1484.         #endregion
  1485.         #region Properties
  1486.  
  1487.         public Image Image
  1488.         {
  1489.             get { return _Image; }
  1490.             set
  1491.             {
  1492.                 if (value == null)
  1493.                 {
  1494.                     _ImageSize = Size.Empty;
  1495.                 }
  1496.                 else
  1497.                 {
  1498.                     _ImageSize = value.Size;
  1499.                 }
  1500.  
  1501.                 _Image = value;
  1502.                 Invalidate();
  1503.             }
  1504.         }
  1505.  
  1506.         protected Size ImageSize
  1507.         {
  1508.             get { return _ImageSize; }
  1509.         }
  1510.  
  1511.         public ContentAlignment ImageAlign
  1512.         {
  1513.             get { return _ImageAlign; }
  1514.             set
  1515.             {
  1516.                 _ImageAlign = value;
  1517.                 Invalidate();
  1518.             }
  1519.         }
  1520.  
  1521.         public StringAlignment TextAlignment
  1522.         {
  1523.             get { return this._TextAlignment; }
  1524.             set
  1525.             {
  1526.                 this._TextAlignment = value;
  1527.                 this.Invalidate();
  1528.             }
  1529.         }
  1530.  
  1531.         public override Color ForeColor
  1532.         {
  1533.             get { return this._TextColor; }
  1534.             set
  1535.             {
  1536.                 this._TextColor = value;
  1537.                 this.Invalidate();
  1538.             }
  1539.         }
  1540.  
  1541.         #endregion
  1542.         #region EventArgs
  1543.  
  1544.         protected override void OnMouseUp(MouseEventArgs e)
  1545.         {
  1546.             MouseState = 0;
  1547.             Invalidate();
  1548.             base.OnMouseUp(e);
  1549.         }
  1550.         protected override void OnMouseDown(MouseEventArgs e)
  1551.         {
  1552.             MouseState = 1;
  1553.             Invalidate();
  1554.             base.OnMouseDown(e);
  1555.         }
  1556.  
  1557.         protected override void OnMouseLeave(EventArgs e)
  1558.         {
  1559.             MouseState = 0;
  1560.             Invalidate();
  1561.             base.OnMouseLeave(e);
  1562.         }
  1563.  
  1564.         protected override void OnTextChanged(System.EventArgs e)
  1565.         {
  1566.             Invalidate();
  1567.             base.OnTextChanged(e);
  1568.         }
  1569.  
  1570.         #endregion
  1571.  
  1572.         public iTalk_Button_1()
  1573.         {
  1574.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  1575.  
  1576.             BackColor = Color.Transparent;
  1577.             DoubleBuffered = true;
  1578.             Font = new Font("Segoe UI", 12);
  1579.             ForeColor = Color.FromArgb(150, 150, 150);
  1580.             Size = new Size(166, 40);
  1581.             _TextAlignment = StringAlignment.Center;
  1582.             P1 = new Pen(Color.FromArgb(190, 190, 190)); // P1 = Border color
  1583.         }
  1584.  
  1585.         protected override void OnResize(System.EventArgs e)
  1586.         {
  1587.             if (Width > 0 && Height > 0)
  1588.             {
  1589.                 Shape = new GraphicsPath();
  1590.                 R1 = new Rectangle(0, 0, Width, Height);
  1591.  
  1592.                 InactiveGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(251, 251, 251), Color.FromArgb(225, 225, 225), 90f);
  1593.                 PressedGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(235, 235, 235), Color.FromArgb(223, 223, 223), 90f);
  1594.                 PressedContourGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(167, 167, 167), Color.FromArgb(167, 167, 167), 90f);
  1595.  
  1596.                 P3 = new Pen(PressedContourGB);
  1597.             }
  1598.  
  1599.             var _Shape = Shape;
  1600.             _Shape.AddArc(0, 0, 10, 10, 180, 90);
  1601.             _Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  1602.             _Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  1603.             _Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  1604.             _Shape.CloseAllFigures();
  1605.  
  1606.             Invalidate();
  1607.             base.OnResize(e);
  1608.         }
  1609.  
  1610.         protected override void OnPaint(PaintEventArgs e)
  1611.         {
  1612.             var _G = e.Graphics;
  1613.             _G.SmoothingMode = SmoothingMode.HighQuality;
  1614.             PointF ipt = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize);
  1615.  
  1616.             switch (MouseState)
  1617.             {
  1618.                 case 0:
  1619.                     _G.FillPath(InactiveGB, Shape);
  1620.                     _G.DrawPath(P1, Shape);
  1621.                     if ((Image == null))
  1622.                     {
  1623.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1624.                         {
  1625.                             Alignment = _TextAlignment,
  1626.                             LineAlignment = StringAlignment.Center
  1627.                         });
  1628.                     }
  1629.                     else
  1630.                     {
  1631.                         _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1632.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1633.                         {
  1634.                             Alignment = _TextAlignment,
  1635.                             LineAlignment = StringAlignment.Center
  1636.                         });
  1637.                     }
  1638.                     break;
  1639.                 case 1:
  1640.                     _G.FillPath(PressedGB, Shape);
  1641.                     _G.DrawPath(P3, Shape);
  1642.  
  1643.                     if ((Image == null))
  1644.                     {
  1645.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1646.                         {
  1647.                             Alignment = _TextAlignment,
  1648.                             LineAlignment = StringAlignment.Center
  1649.                         });
  1650.                     }
  1651.                     else
  1652.                     {
  1653.                         _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1654.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1655.                         {
  1656.                             Alignment = _TextAlignment,
  1657.                             LineAlignment = StringAlignment.Center
  1658.                         });
  1659.                     }
  1660.                     break;
  1661.             }
  1662.             base.OnPaint(e);
  1663.         }
  1664.     }
  1665.  
  1666.     #endregion
  1667.     #region Button 2
  1668.  
  1669.     class iTalk_Button_2 : Control
  1670.     {
  1671.  
  1672.         #region Variables
  1673.  
  1674.         private int MouseState;
  1675.         private GraphicsPath Shape;
  1676.         private LinearGradientBrush InactiveGB;
  1677.         private LinearGradientBrush PressedGB;
  1678.         private LinearGradientBrush PressedContourGB;
  1679.         private Rectangle R1;
  1680.         private Pen P1;
  1681.         private Pen P3;
  1682.         private Image _Image;
  1683.         private Size _ImageSize;
  1684.         private StringAlignment _TextAlignment = StringAlignment.Center;
  1685.         private ContentAlignment _ImageAlign = ContentAlignment.MiddleLeft;
  1686.  
  1687.         #endregion
  1688.         #region Image Designer
  1689.  
  1690.         private static PointF ImageLocation(StringFormat SF, SizeF Area, SizeF ImageArea)
  1691.         {
  1692.             PointF MyPoint = default(PointF);
  1693.             switch (SF.Alignment)
  1694.             {
  1695.                 case StringAlignment.Center:
  1696.                     MyPoint.X = Convert.ToSingle((Area.Width - ImageArea.Width) / 2);
  1697.                     break;
  1698.                 case StringAlignment.Near:
  1699.                     MyPoint.X = 2;
  1700.                     break;
  1701.                 case StringAlignment.Far:
  1702.                     MyPoint.X = Area.Width - ImageArea.Width - 2;
  1703.                     break;
  1704.             }
  1705.  
  1706.             switch (SF.LineAlignment)
  1707.             {
  1708.                 case StringAlignment.Center:
  1709.                     MyPoint.Y = Convert.ToSingle((Area.Height - ImageArea.Height) / 2);
  1710.                     break;
  1711.                 case StringAlignment.Near:
  1712.                     MyPoint.Y = 2;
  1713.                     break;
  1714.                 case StringAlignment.Far:
  1715.                     MyPoint.Y = Area.Height - ImageArea.Height - 2;
  1716.                     break;
  1717.             }
  1718.             return MyPoint;
  1719.         }
  1720.  
  1721.         private StringFormat GetStringFormat(ContentAlignment _ContentAlignment)
  1722.         {
  1723.             StringFormat SF = new StringFormat();
  1724.             switch (_ContentAlignment)
  1725.             {
  1726.                 case ContentAlignment.MiddleCenter:
  1727.                     SF.LineAlignment = StringAlignment.Center;
  1728.                     SF.Alignment = StringAlignment.Center;
  1729.                     break;
  1730.                 case ContentAlignment.MiddleLeft:
  1731.                     SF.LineAlignment = StringAlignment.Center;
  1732.                     SF.Alignment = StringAlignment.Near;
  1733.                     break;
  1734.                 case ContentAlignment.MiddleRight:
  1735.                     SF.LineAlignment = StringAlignment.Center;
  1736.                     SF.Alignment = StringAlignment.Far;
  1737.                     break;
  1738.                 case ContentAlignment.TopCenter:
  1739.                     SF.LineAlignment = StringAlignment.Near;
  1740.                     SF.Alignment = StringAlignment.Center;
  1741.                     break;
  1742.                 case ContentAlignment.TopLeft:
  1743.                     SF.LineAlignment = StringAlignment.Near;
  1744.                     SF.Alignment = StringAlignment.Near;
  1745.                     break;
  1746.                 case ContentAlignment.TopRight:
  1747.                     SF.LineAlignment = StringAlignment.Near;
  1748.                     SF.Alignment = StringAlignment.Far;
  1749.                     break;
  1750.                 case ContentAlignment.BottomCenter:
  1751.                     SF.LineAlignment = StringAlignment.Far;
  1752.                     SF.Alignment = StringAlignment.Center;
  1753.                     break;
  1754.                 case ContentAlignment.BottomLeft:
  1755.                     SF.LineAlignment = StringAlignment.Far;
  1756.                     SF.Alignment = StringAlignment.Near;
  1757.                     break;
  1758.                 case ContentAlignment.BottomRight:
  1759.                     SF.LineAlignment = StringAlignment.Far;
  1760.                     SF.Alignment = StringAlignment.Far;
  1761.                     break;
  1762.             }
  1763.             return SF;
  1764.         }
  1765.  
  1766.         #endregion
  1767.         #region Properties
  1768.  
  1769.         public Image Image
  1770.         {
  1771.             get { return _Image; }
  1772.             set
  1773.             {
  1774.                 if (value == null)
  1775.                 {
  1776.                     _ImageSize = Size.Empty;
  1777.                 }
  1778.                 else
  1779.                 {
  1780.                     _ImageSize = value.Size;
  1781.                 }
  1782.  
  1783.                 _Image = value;
  1784.                 Invalidate();
  1785.             }
  1786.         }
  1787.  
  1788.         public StringAlignment TextAlignment
  1789.         {
  1790.             get { return this._TextAlignment; }
  1791.             set
  1792.             {
  1793.                 this._TextAlignment = value;
  1794.                 this.Invalidate();
  1795.             }
  1796.         }
  1797.  
  1798.         protected Size ImageSize
  1799.         {
  1800.             get { return _ImageSize; }
  1801.         }
  1802.  
  1803.         public ContentAlignment ImageAlign
  1804.         {
  1805.             get { return _ImageAlign; }
  1806.             set
  1807.             {
  1808.                 _ImageAlign = value;
  1809.                 Invalidate();
  1810.             }
  1811.         }
  1812.  
  1813.         #endregion
  1814.         #region EventArgs
  1815.  
  1816.         protected override void OnMouseUp(MouseEventArgs e)
  1817.         {
  1818.             MouseState = 0;
  1819.             Invalidate();
  1820.             base.OnMouseUp(e);
  1821.         }
  1822.         protected override void OnMouseDown(MouseEventArgs e)
  1823.         {
  1824.             MouseState = 1;
  1825.             Invalidate();
  1826.             base.OnMouseDown(e);
  1827.         }
  1828.  
  1829.         protected override void OnMouseLeave(EventArgs e)
  1830.         {
  1831.             MouseState = 0;
  1832.             // [Inactive]
  1833.             Invalidate();
  1834.             // Update control
  1835.             base.OnMouseLeave(e);
  1836.         }
  1837.  
  1838.         protected override void OnTextChanged(System.EventArgs e)
  1839.         {
  1840.             Invalidate();
  1841.             base.OnTextChanged(e);
  1842.         }
  1843.  
  1844.         #endregion
  1845.  
  1846.         public iTalk_Button_2()
  1847.         {
  1848.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  1849.  
  1850.             BackColor = Color.Transparent;
  1851.             DoubleBuffered = true;
  1852.             Font = new Font("Segoe UI", 14);
  1853.             ForeColor = Color.White;
  1854.             Size = new Size(166, 40);
  1855.             _TextAlignment = StringAlignment.Center;
  1856.             P1 = new Pen(Color.FromArgb(0, 118, 176));
  1857.         }
  1858.  
  1859.         protected override void OnResize(System.EventArgs e)
  1860.         {
  1861.             base.OnResize(e);
  1862.             if (Width > 0 && Height > 0)
  1863.             {
  1864.                 Shape = new GraphicsPath();
  1865.                 R1 = new Rectangle(0, 0, Width, Height);
  1866.  
  1867.                 InactiveGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(0, 176, 231), Color.FromArgb(0, 152, 224), 90f);
  1868.                 PressedGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(0, 118, 176), Color.FromArgb(0, 149, 222), 90f);
  1869.                 PressedContourGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(0, 118, 176), Color.FromArgb(0, 118, 176), 90f);
  1870.  
  1871.                 P3 = new Pen(PressedContourGB);
  1872.             }
  1873.  
  1874.             var _Shape = Shape;
  1875.             _Shape.AddArc(0, 0, 10, 10, 180, 90);
  1876.             _Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  1877.             _Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  1878.             _Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  1879.             _Shape.CloseAllFigures();
  1880.  
  1881.             Invalidate();
  1882.         }
  1883.  
  1884.         protected override void OnPaint(PaintEventArgs e)
  1885.         {
  1886.             var _G = e.Graphics;
  1887.             _G.SmoothingMode = SmoothingMode.HighQuality;
  1888.  
  1889.             PointF ipt = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize);
  1890.  
  1891.             switch (MouseState)
  1892.             {
  1893.                 case 0:
  1894.                     _G.FillPath(InactiveGB, Shape);
  1895.                     _G.DrawPath(P1, Shape);
  1896.                     if ((Image == null))
  1897.                     {
  1898.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1899.                         {
  1900.                             Alignment = _TextAlignment,
  1901.                             LineAlignment = StringAlignment.Center
  1902.                         });
  1903.                     }
  1904.                     else
  1905.                     {
  1906.                         _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1907.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1908.                         {
  1909.                             Alignment = _TextAlignment,
  1910.                             LineAlignment = StringAlignment.Center
  1911.                         });
  1912.                     }
  1913.                     break;
  1914.                 case 1:
  1915.                     _G.FillPath(PressedGB, Shape);
  1916.                     _G.DrawPath(P3, Shape);
  1917.                     if ((Image == null))
  1918.                     {
  1919.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1920.                         {
  1921.                             Alignment = _TextAlignment,
  1922.                             LineAlignment = StringAlignment.Center
  1923.                         });
  1924.                     }
  1925.                     else
  1926.                     {
  1927.                         _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1928.                         _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1929.                         {
  1930.                             Alignment = _TextAlignment,
  1931.                             LineAlignment = StringAlignment.Center
  1932.                         });
  1933.                     }
  1934.                     break;
  1935.             }
  1936.             base.OnPaint(e);
  1937.         }
  1938.     }
  1939.  
  1940.     #endregion
  1941.     #region Toggle Button
  1942.  
  1943.     [DefaultEvent("ToggledChanged")]
  1944.     class iTalk_Toggle : Control
  1945.     {
  1946.  
  1947.         #region Designer
  1948.  
  1949.         //|------DO-NOT-REMOVE------|
  1950.         //|---------CREDITS---------|
  1951.  
  1952.         // Pill class and functions were originally created by Tedd
  1953.         // Last edited by Tedd on: 12/20/2013
  1954.         // Modified by HazelDev on: 1/4/2014
  1955.  
  1956.         //|---------CREDITS---------|
  1957.         //|------DO-NOT-REMOVE------|
  1958.  
  1959.         public class PillStyle
  1960.         {
  1961.             public bool Left;
  1962.             public bool Right;
  1963.         }
  1964.  
  1965.         public GraphicsPath Pill(Rectangle Rectangle, PillStyle PillStyle)
  1966.         {
  1967.             GraphicsPath functionReturnValue = default(GraphicsPath);
  1968.             functionReturnValue = new GraphicsPath();
  1969.  
  1970.             if (PillStyle.Left)
  1971.             {
  1972.                 functionReturnValue.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, Rectangle.Height, Rectangle.Height), -270, 180);
  1973.             }
  1974.             else
  1975.             {
  1976.                 functionReturnValue.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height, Rectangle.X, Rectangle.Y);
  1977.             }
  1978.  
  1979.             if (PillStyle.Right)
  1980.             {
  1981.                 functionReturnValue.AddArc(new Rectangle(Rectangle.X + Rectangle.Width - Rectangle.Height, Rectangle.Y, Rectangle.Height, Rectangle.Height), -90, 180);
  1982.             }
  1983.             else
  1984.             {
  1985.                 functionReturnValue.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height);
  1986.             }
  1987.  
  1988.             functionReturnValue.CloseAllFigures();
  1989.             return functionReturnValue;
  1990.         }
  1991.  
  1992.         public object Pill(int X, int Y, int Width, int Height, PillStyle PillStyle)
  1993.         {
  1994.             return Pill(new Rectangle(X, Y, Width, Height), PillStyle);
  1995.         }
  1996.  
  1997.         #endregion
  1998.         #region Enums
  1999.  
  2000.         public enum _Type
  2001.         {
  2002.             YesNo,
  2003.             OnOff,
  2004.             IO
  2005.         }
  2006.  
  2007.         #endregion
  2008.         #region Variables
  2009.  
  2010.         private Timer AnimationTimer = new Timer { Interval = 1 };
  2011.         private int ToggleLocation = 0;
  2012.         public event ToggledChangedEventHandler ToggledChanged;
  2013.         public delegate void ToggledChangedEventHandler();
  2014.         private bool _Toggled;
  2015.         private _Type ToggleType;
  2016.         private Rectangle Bar;
  2017.         private Size cHandle = new Size(15, 20);
  2018.  
  2019.         #endregion
  2020.         #region Properties
  2021.  
  2022.         public bool Toggled
  2023.         {
  2024.             get { return _Toggled; }
  2025.             set
  2026.             {
  2027.                 _Toggled = value;
  2028.                 Invalidate();
  2029.  
  2030.                 if (ToggledChanged != null)
  2031.                 {
  2032.                     ToggledChanged();
  2033.                 }
  2034.             }
  2035.         }
  2036.  
  2037.         public _Type Type
  2038.         {
  2039.             get { return ToggleType; }
  2040.             set
  2041.             {
  2042.                 ToggleType = value;
  2043.                 Invalidate();
  2044.             }
  2045.         }
  2046.  
  2047.         #endregion
  2048.         #region EventArgs
  2049.  
  2050.         protected override void OnResize(EventArgs e)
  2051.         {
  2052.             base.OnResize(e);
  2053.             Width = 41;
  2054.             Height = 23;
  2055.         }
  2056.  
  2057.         protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  2058.         {
  2059.             base.OnMouseUp(e);
  2060.             Toggled = !Toggled;
  2061.         }
  2062.  
  2063.         #endregion
  2064.  
  2065.         public iTalk_Toggle()
  2066.         {
  2067.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
  2068.             AnimationTimer.Tick += new EventHandler(AnimationTimer_Tick);
  2069.         }
  2070.         protected override void OnHandleCreated(EventArgs e)
  2071.         {
  2072.             base.OnHandleCreated(e);
  2073.             AnimationTimer.Start();
  2074.         }
  2075.  
  2076.         void AnimationTimer_Tick(object sender, EventArgs e)
  2077.         {
  2078.             //  Create a slide animation when toggled on/off
  2079.             if ((_Toggled == true))
  2080.             {
  2081.                 if ((ToggleLocation < 100))
  2082.                 {
  2083.                     ToggleLocation += 10;
  2084.                     this.Invalidate(false);
  2085.                 }
  2086.             }
  2087.             else if ((ToggleLocation > 0))
  2088.             {
  2089.                 ToggleLocation -= 10;
  2090.                 this.Invalidate(false);
  2091.             }
  2092.         }
  2093.  
  2094.         protected override void OnPaint(PaintEventArgs e)
  2095.         {
  2096.             base.OnPaint(e);
  2097.             Graphics G = e.Graphics;
  2098.             G.Clear(Parent.BackColor);
  2099.             checked
  2100.             {
  2101.                 Point point = new Point(0, (int)Math.Round(unchecked((double)this.Height / 2.0 - (double)this.cHandle.Height / 2.0)));
  2102.                 Point arg_A8_0 = point;
  2103.                 Point point2 = new Point(0, (int)Math.Round(unchecked((double)this.Height / 2.0 + (double)this.cHandle.Height / 2.0)));
  2104.                 LinearGradientBrush Gradient = new LinearGradientBrush(arg_A8_0, point2, Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240));
  2105.                 this.Bar = new Rectangle(8, 10, this.Width - 21, this.Height - 21);
  2106.  
  2107.                 G.SmoothingMode = SmoothingMode.AntiAlias;
  2108.                 G.FillPath(Gradient, (GraphicsPath)this.Pill(0, (int)Math.Round(unchecked((double)this.Height / 2.0 - (double)this.cHandle.Height / 2.0)), this.Width - 1, this.cHandle.Height - 5, new iTalk_Toggle.PillStyle
  2109.                 {
  2110.                     Left = true,
  2111.                     Right = true
  2112.                 }));
  2113.                 G.DrawPath(new Pen(Color.FromArgb(177, 177, 176)), (GraphicsPath)this.Pill(0, (int)Math.Round(unchecked((double)this.Height / 2.0 - (double)this.cHandle.Height / 2.0)), this.Width - 1, this.cHandle.Height - 5, new iTalk_Toggle.PillStyle
  2114.                 {
  2115.                     Left = true,
  2116.                     Right = true
  2117.                 }));
  2118.                 Gradient.Dispose();
  2119.                 switch (this.ToggleType)
  2120.                 {
  2121.                     case iTalk_Toggle._Type.YesNo:
  2122.                         {
  2123.                             bool toggled = this.Toggled;
  2124.                             if (toggled)
  2125.                             {
  2126.                                 G.DrawString("Yes", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 7), (float)this.Bar.Y, new StringFormat
  2127.                                 {
  2128.                                     Alignment = StringAlignment.Center,
  2129.                                     LineAlignment = StringAlignment.Center
  2130.                                 });
  2131.                             }
  2132.                             else
  2133.                             {
  2134.                                 G.DrawString("No", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 18), (float)this.Bar.Y, new StringFormat
  2135.                                 {
  2136.                                     Alignment = StringAlignment.Center,
  2137.                                     LineAlignment = StringAlignment.Center
  2138.                                 });
  2139.                             }
  2140.                             break;
  2141.                         }
  2142.                     case iTalk_Toggle._Type.OnOff:
  2143.                         {
  2144.                             bool toggled = this.Toggled;
  2145.                             if (toggled)
  2146.                             {
  2147.                                 G.DrawString("On", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 7), (float)this.Bar.Y, new StringFormat
  2148.                                 {
  2149.                                     Alignment = StringAlignment.Center,
  2150.                                     LineAlignment = StringAlignment.Center
  2151.                                 });
  2152.                             }
  2153.                             else
  2154.                             {
  2155.                                 G.DrawString("Off", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 18), (float)this.Bar.Y, new StringFormat
  2156.                                 {
  2157.                                     Alignment = StringAlignment.Center,
  2158.                                     LineAlignment = StringAlignment.Center
  2159.                                 });
  2160.                             }
  2161.                             break;
  2162.                         }
  2163.                     case iTalk_Toggle._Type.IO:
  2164.                         {
  2165.                             bool toggled = this.Toggled;
  2166.                             if (toggled)
  2167.                             {
  2168.                                 G.DrawString("I", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 7), (float)this.Bar.Y, new StringFormat
  2169.                                 {
  2170.                                     Alignment = StringAlignment.Center,
  2171.                                     LineAlignment = StringAlignment.Center
  2172.                                 });
  2173.                             }
  2174.                             else
  2175.                             {
  2176.                                 G.DrawString("O", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 18), (float)this.Bar.Y, new StringFormat
  2177.                                 {
  2178.                                     Alignment = StringAlignment.Center,
  2179.                                     LineAlignment = StringAlignment.Center
  2180.                                 });
  2181.                             }
  2182.                             break;
  2183.                         }
  2184.                 }
  2185.                 G.FillEllipse(new SolidBrush(Color.FromArgb(249, 249, 249)), this.Bar.X + (int)Math.Round(unchecked((double)this.Bar.Width * ((double)this.ToggleLocation / 80.0))) - (int)Math.Round((double)this.cHandle.Width / 2.0), this.Bar.Y + (int)Math.Round((double)this.Bar.Height / 2.0) - (int)Math.Round(unchecked((double)this.cHandle.Height / 2.0 - 1.0)), this.cHandle.Width, this.cHandle.Height - 5);
  2186.                 G.DrawEllipse(new Pen(Color.FromArgb(177, 177, 176)), this.Bar.X + (int)Math.Round(unchecked((double)this.Bar.Width * ((double)this.ToggleLocation / 80.0) - (double)checked((int)Math.Round((double)this.cHandle.Width / 2.0)))), this.Bar.Y + (int)Math.Round((double)this.Bar.Height / 2.0) - (int)Math.Round(unchecked((double)this.cHandle.Height / 2.0 - 1.0)), this.cHandle.Width, this.cHandle.Height - 5);
  2187.             }
  2188.         }
  2189.     }
  2190.     #endregion
  2191.     #region Label
  2192.  
  2193.     class iTalk_Label : Label
  2194.     {
  2195.  
  2196.         public iTalk_Label()
  2197.         {
  2198.             Font = new Font("Segoe UI", 8);
  2199.             ForeColor = Color.FromArgb(142, 142, 142);
  2200.             BackColor = Color.Transparent;
  2201.         }
  2202.     }
  2203.  
  2204.     #endregion
  2205.     #region Link Label
  2206.  
  2207.     class iTalk_LinkLabel : LinkLabel
  2208.     {
  2209.  
  2210.         public iTalk_LinkLabel()
  2211.         {
  2212.             Font = new Font("Segoe UI", 8, FontStyle.Regular);
  2213.             BackColor = Color.Transparent;
  2214.             LinkColor = Color.FromArgb(51, 153, 225);
  2215.             ActiveLinkColor = Color.FromArgb(0, 101, 202);
  2216.             VisitedLinkColor = Color.FromArgb(0, 101, 202);
  2217.             LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
  2218.         }
  2219.     }
  2220.  
  2221.     #endregion
  2222.     #region Header Label
  2223.  
  2224.     class iTalk_HeaderLabel : Label
  2225.     {
  2226.  
  2227.         public iTalk_HeaderLabel()
  2228.         {
  2229.             Font = new Font("Segoe UI", 25, FontStyle.Regular);
  2230.             ForeColor = Color.FromArgb(80, 80, 80);
  2231.             BackColor = Color.Transparent;
  2232.         }
  2233.     }
  2234.  
  2235.     #endregion
  2236.     #region Big TextBox
  2237.  
  2238.     [DefaultEvent("TextChanged")]
  2239.     class iTalk_TextBox_Big : Control
  2240.     {
  2241.         #region Variables
  2242.  
  2243.         public TextBox iTalkTB = new TextBox();
  2244.         private GraphicsPath Shape;
  2245.         private int _maxchars = 32767;
  2246.         private bool _ReadOnly;
  2247.         private bool _Multiline;
  2248.         private Image _Image;
  2249.         private Size _ImageSize;
  2250.         private HorizontalAlignment ALNType;
  2251.         private bool isPasswordMasked = false;
  2252.         private Pen P1;
  2253.         private SolidBrush B1;
  2254.  
  2255.         #endregion
  2256.         #region Properties
  2257.  
  2258.         public HorizontalAlignment TextAlignment
  2259.         {
  2260.             get { return ALNType; }
  2261.             set
  2262.             {
  2263.                 ALNType = value;
  2264.                 Invalidate();
  2265.             }
  2266.         }
  2267.         public int MaxLength
  2268.         {
  2269.             get { return _maxchars; }
  2270.             set
  2271.             {
  2272.                 _maxchars = value;
  2273.                 iTalkTB.MaxLength = MaxLength;
  2274.                 Invalidate();
  2275.             }
  2276.         }
  2277.  
  2278.         public bool UseSystemPasswordChar
  2279.         {
  2280.             get { return isPasswordMasked; }
  2281.             set
  2282.             {
  2283.                 iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar;
  2284.                 isPasswordMasked = value;
  2285.                 Invalidate();
  2286.             }
  2287.         }
  2288.         public bool ReadOnly
  2289.         {
  2290.             get { return _ReadOnly; }
  2291.             set
  2292.             {
  2293.                 _ReadOnly = value;
  2294.                 if (iTalkTB != null)
  2295.                 {
  2296.                     iTalkTB.ReadOnly = value;
  2297.                 }
  2298.             }
  2299.         }
  2300.         public bool Multiline
  2301.         {
  2302.             get { return _Multiline; }
  2303.             set
  2304.             {
  2305.                 _Multiline = value;
  2306.                 if (iTalkTB != null)
  2307.                 {
  2308.                     iTalkTB.Multiline = value;
  2309.  
  2310.                     if (value)
  2311.                     {
  2312.                         iTalkTB.Height = Height - 23;
  2313.                     }
  2314.                     else
  2315.                     {
  2316.                         Height = iTalkTB.Height + 23;
  2317.                     }
  2318.                 }
  2319.  
  2320.             }
  2321.         }
  2322.  
  2323.         public Image Image
  2324.         {
  2325.             get
  2326.             {
  2327.                 return _Image;
  2328.             }
  2329.             set
  2330.             {
  2331.                 if (value == null)
  2332.                 {
  2333.                     _ImageSize = Size.Empty;
  2334.                 }
  2335.                 else
  2336.                 {
  2337.                     _ImageSize = value.Size;
  2338.                 }
  2339.  
  2340.                 _Image = value;
  2341.  
  2342.                 if (Image == null)
  2343.                 {
  2344.                     iTalkTB.Location = new Point(8, 10);
  2345.                 }
  2346.                 else
  2347.                 {
  2348.                     iTalkTB.Location = new Point(35, 11);
  2349.                 }
  2350.                 Invalidate();
  2351.             }
  2352.         }
  2353.  
  2354.         protected Size ImageSize
  2355.         {
  2356.             get
  2357.             {
  2358.                 return _ImageSize;
  2359.             }
  2360.         }
  2361.  
  2362.         #endregion
  2363.         #region EventArgs
  2364.  
  2365.         protected override void OnTextChanged(System.EventArgs e)
  2366.         {
  2367.             base.OnTextChanged(e);
  2368.             iTalkTB.Text = Text;
  2369.             Invalidate();
  2370.         }
  2371.  
  2372.         private void OnBaseTextChanged(object s, EventArgs e)
  2373.         {
  2374.             Text = iTalkTB.Text;
  2375.         }
  2376.  
  2377.         protected override void OnForeColorChanged(System.EventArgs e)
  2378.         {
  2379.             base.OnForeColorChanged(e);
  2380.             iTalkTB.ForeColor = ForeColor;
  2381.             Invalidate();
  2382.         }
  2383.  
  2384.         protected override void OnFontChanged(System.EventArgs e)
  2385.         {
  2386.             base.OnFontChanged(e);
  2387.             iTalkTB.Font = Font;
  2388.         }
  2389.  
  2390.         protected override void OnPaintBackground(PaintEventArgs e)
  2391.         {
  2392.             base.OnPaintBackground(e);
  2393.         }
  2394.  
  2395.         private void _OnKeyDown(object Obj, KeyEventArgs e)
  2396.         {
  2397.             if (e.Control && e.KeyCode == Keys.A)
  2398.             {
  2399.                 iTalkTB.SelectAll();
  2400.                 e.SuppressKeyPress = true;
  2401.             }
  2402.             if (e.Control && e.KeyCode == Keys.C)
  2403.             {
  2404.                 iTalkTB.Copy();
  2405.                 e.SuppressKeyPress = true;
  2406.             }
  2407.         }
  2408.  
  2409.         protected override void OnResize(System.EventArgs e)
  2410.         {
  2411.             base.OnResize(e);
  2412.             if (_Multiline)
  2413.             {
  2414.                 iTalkTB.Height = Height - 23;
  2415.             }
  2416.             else
  2417.             {
  2418.                 Height = iTalkTB.Height + 23;
  2419.             }
  2420.  
  2421.             Shape = new GraphicsPath();
  2422.             var _with1 = Shape;
  2423.             _with1.AddArc(0, 0, 10, 10, 180, 90);
  2424.             _with1.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2425.             _with1.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2426.             _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  2427.             _with1.CloseAllFigures();
  2428.         }
  2429.  
  2430.         protected override void OnGotFocus(System.EventArgs e)
  2431.         {
  2432.             base.OnGotFocus(e);
  2433.             iTalkTB.Focus();
  2434.         }
  2435.  
  2436.         #endregion
  2437.         public void AddTextBox()
  2438.         {
  2439.             var _TB = iTalkTB;
  2440.             _TB.Location = new Point(7, 10);
  2441.             _TB.Text = string.Empty;
  2442.             _TB.BorderStyle = BorderStyle.None;
  2443.             _TB.TextAlign = HorizontalAlignment.Left;
  2444.             _TB.Font = new Font("Tahoma", 11);
  2445.             _TB.UseSystemPasswordChar = UseSystemPasswordChar;
  2446.             _TB.Multiline = false;
  2447.             iTalkTB.KeyDown += _OnKeyDown;
  2448.             iTalkTB.TextChanged += OnBaseTextChanged;
  2449.         }
  2450.  
  2451.         public iTalk_TextBox_Big()
  2452.         {
  2453.             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2454.             SetStyle(ControlStyles.UserPaint, true);
  2455.  
  2456.             AddTextBox();
  2457.             Controls.Add(iTalkTB);
  2458.  
  2459.             P1 = new Pen(Color.FromArgb(180, 180, 180)); // P1 = Border color
  2460.             B1 = new SolidBrush(Color.White); // B1 = Rect Background color
  2461.             BackColor = Color.Transparent;
  2462.             ForeColor = Color.DimGray;
  2463.  
  2464.             Text = null;
  2465.             Font = new Font("Tahoma", 11);
  2466.             Size = new Size(135, 43);
  2467.             DoubleBuffered = true;
  2468.         }
  2469.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2470.         {
  2471.             base.OnPaint(e);
  2472.             Bitmap B = new Bitmap(Width, Height);
  2473.             Graphics G = Graphics.FromImage(B);
  2474.  
  2475.             G.SmoothingMode = SmoothingMode.AntiAlias;
  2476.  
  2477.             if (Image == null)
  2478.             {
  2479.                 iTalkTB.Width = Width - 18;
  2480.             }
  2481.             else
  2482.             {
  2483.                 iTalkTB.Width = Width - 45;
  2484.             }
  2485.  
  2486.             iTalkTB.TextAlign = TextAlignment;
  2487.             iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar;
  2488.  
  2489.             G.Clear(Color.Transparent);
  2490.             G.FillPath(B1, Shape); // Draw background
  2491.             G.DrawPath(P1, Shape); // Draw border
  2492.  
  2493.  
  2494.             if (Image != null)
  2495.             {
  2496.                 G.DrawImage(_Image, 5, 8, 24, 24);
  2497.                 // 24x24 is the perfect size of the image
  2498.             }
  2499.  
  2500.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  2501.             G.Dispose();
  2502.             B.Dispose();
  2503.         }
  2504.     }
  2505.  
  2506.     #endregion
  2507.     #region Small TextBox
  2508.  
  2509.     [DefaultEvent("TextChanged")]
  2510.     class iTalk_TextBox_Small : Control
  2511.     {
  2512.         #region Variables
  2513.  
  2514.         public TextBox iTalkTB = new TextBox();
  2515.         private GraphicsPath Shape;
  2516.         private int _maxchars = 32767;
  2517.         private bool _ReadOnly;
  2518.         private bool _Multiline;
  2519.         private HorizontalAlignment ALNType;
  2520.         private bool isPasswordMasked = false;
  2521.         private Pen P1;
  2522.         private SolidBrush B1;
  2523.  
  2524.         #endregion
  2525.         #region Properties
  2526.  
  2527.         public HorizontalAlignment TextAlignment
  2528.         {
  2529.             get { return ALNType; }
  2530.             set
  2531.             {
  2532.                 ALNType = value;
  2533.                 Invalidate();
  2534.             }
  2535.         }
  2536.         public int MaxLength
  2537.         {
  2538.             get { return _maxchars; }
  2539.             set
  2540.             {
  2541.                 _maxchars = value;
  2542.                 iTalkTB.MaxLength = MaxLength;
  2543.                 Invalidate();
  2544.             }
  2545.         }
  2546.  
  2547.         public bool UseSystemPasswordChar
  2548.         {
  2549.             get { return isPasswordMasked; }
  2550.             set
  2551.             {
  2552.                 iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar;
  2553.                 isPasswordMasked = value;
  2554.                 Invalidate();
  2555.             }
  2556.         }
  2557.         public bool ReadOnly
  2558.         {
  2559.             get { return _ReadOnly; }
  2560.             set
  2561.             {
  2562.                 _ReadOnly = value;
  2563.                 if (iTalkTB != null)
  2564.                 {
  2565.                     iTalkTB.ReadOnly = value;
  2566.                 }
  2567.             }
  2568.         }
  2569.         public bool Multiline
  2570.         {
  2571.             get { return _Multiline; }
  2572.             set
  2573.             {
  2574.                 _Multiline = value;
  2575.                 if (iTalkTB != null)
  2576.                 {
  2577.                     iTalkTB.Multiline = value;
  2578.  
  2579.                     if (value)
  2580.                     {
  2581.                         iTalkTB.Height = Height - 10;
  2582.                     }
  2583.                     else
  2584.                     {
  2585.                         Height = iTalkTB.Height + 10;
  2586.                     }
  2587.                 }
  2588.             }
  2589.         }
  2590.  
  2591.         #endregion
  2592.         #region EventArgs
  2593.  
  2594.         protected override void OnTextChanged(System.EventArgs e)
  2595.         {
  2596.             base.OnTextChanged(e);
  2597.             iTalkTB.Text = Text;
  2598.             Invalidate();
  2599.         }
  2600.  
  2601.         private void OnBaseTextChanged(object s, EventArgs e)
  2602.         {
  2603.             Text = iTalkTB.Text;
  2604.         }
  2605.  
  2606.         protected override void OnForeColorChanged(System.EventArgs e)
  2607.         {
  2608.             base.OnForeColorChanged(e);
  2609.             iTalkTB.ForeColor = ForeColor;
  2610.             Invalidate();
  2611.         }
  2612.  
  2613.         protected override void OnFontChanged(System.EventArgs e)
  2614.         {
  2615.             base.OnFontChanged(e);
  2616.             iTalkTB.Font = Font;
  2617.         }
  2618.  
  2619.         protected override void OnPaintBackground(PaintEventArgs e)
  2620.         {
  2621.             base.OnPaintBackground(e);
  2622.         }
  2623.  
  2624.         private void _OnKeyDown(object Obj, KeyEventArgs e)
  2625.         {
  2626.             if (e.Control && e.KeyCode == Keys.A)
  2627.             {
  2628.                 iTalkTB.SelectAll();
  2629.                 e.SuppressKeyPress = true;
  2630.             }
  2631.             if (e.Control && e.KeyCode == Keys.C)
  2632.             {
  2633.                 iTalkTB.Copy();
  2634.                 e.SuppressKeyPress = true;
  2635.             }
  2636.         }
  2637.  
  2638.         protected override void OnResize(System.EventArgs e)
  2639.         {
  2640.             base.OnResize(e);
  2641.             if (_Multiline)
  2642.             {
  2643.                 iTalkTB.Height = Height - 10;
  2644.             }
  2645.             else
  2646.             {
  2647.                 Height = iTalkTB.Height + 10;
  2648.             }
  2649.  
  2650.             Shape = new GraphicsPath();
  2651.             var _with1 = Shape;
  2652.             _with1.AddArc(0, 0, 10, 10, 180, 90);
  2653.             _with1.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2654.             _with1.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2655.             _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  2656.             _with1.CloseAllFigures();
  2657.         }
  2658.  
  2659.         protected override void OnGotFocus(System.EventArgs e)
  2660.         {
  2661.             base.OnGotFocus(e);
  2662.             iTalkTB.Focus();
  2663.         }
  2664.  
  2665.         #endregion
  2666.         public void AddTextBox()
  2667.         {
  2668.             var _TB = iTalkTB;
  2669.             _TB.Size = new Size(Width - 10, 33);
  2670.             _TB.Location = new Point(7, 5);
  2671.             _TB.Text = string.Empty;
  2672.             _TB.BorderStyle = BorderStyle.None;
  2673.             _TB.TextAlign = HorizontalAlignment.Left;
  2674.             _TB.Font = new Font("Tahoma", 11);
  2675.             _TB.UseSystemPasswordChar = UseSystemPasswordChar;
  2676.             _TB.Multiline = false;
  2677.             iTalkTB.KeyDown += _OnKeyDown;
  2678.             iTalkTB.TextChanged += OnBaseTextChanged;
  2679.         }
  2680.  
  2681.         public iTalk_TextBox_Small()
  2682.         {
  2683.             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2684.             SetStyle(ControlStyles.UserPaint, true);
  2685.  
  2686.             AddTextBox();
  2687.             Controls.Add(iTalkTB);
  2688.  
  2689.             P1 = new Pen(Color.FromArgb(180, 180, 180)); // P1 = Border color
  2690.             B1 = new SolidBrush(Color.White); // B1 = Rect Background color
  2691.             BackColor = Color.Transparent;
  2692.             ForeColor = Color.DimGray;
  2693.  
  2694.             Text = null;
  2695.             Font = new Font("Tahoma", 11);
  2696.             Size = new Size(135, 33);
  2697.             DoubleBuffered = true;
  2698.         }
  2699.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2700.         {
  2701.             base.OnPaint(e);
  2702.             Bitmap B = new Bitmap(Width, Height);
  2703.             Graphics G = Graphics.FromImage(B);
  2704.  
  2705.             G.SmoothingMode = SmoothingMode.AntiAlias;
  2706.  
  2707.             var _TB = iTalkTB;
  2708.             _TB.Width = Width - 10;
  2709.             _TB.TextAlign = TextAlignment;
  2710.             _TB.UseSystemPasswordChar = UseSystemPasswordChar;
  2711.  
  2712.             G.Clear(Color.Transparent);
  2713.             G.FillPath(B1, Shape); // Draw background
  2714.             G.DrawPath(P1, Shape); // Draw border
  2715.  
  2716.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  2717.             G.Dispose();
  2718.             B.Dispose();
  2719.         }
  2720.  
  2721.     }
  2722.  
  2723.     #endregion
  2724.     #region RichTextBox
  2725.  
  2726.     [DefaultEvent("TextChanged")]
  2727.     class iTalk_RichTextBox : Control
  2728.     {
  2729.  
  2730.         #region Variables
  2731.  
  2732.         public RichTextBox iTalkRTB = new RichTextBox();
  2733.         private bool _ReadOnly;
  2734.         private bool _WordWrap;
  2735.         private bool _AutoWordSelection;
  2736.         private GraphicsPath Shape;
  2737.  
  2738.         #endregion
  2739.         #region Properties
  2740.  
  2741.         public override string Text
  2742.         {
  2743.             get { return iTalkRTB.Text; }
  2744.             set
  2745.             {
  2746.                 iTalkRTB.Text = value;
  2747.                 Invalidate();
  2748.             }
  2749.         }
  2750.         public bool ReadOnly
  2751.         {
  2752.             get { return _ReadOnly; }
  2753.             set
  2754.             {
  2755.                 _ReadOnly = value;
  2756.                 if (iTalkRTB != null)
  2757.                 {
  2758.                     iTalkRTB.ReadOnly = value;
  2759.                 }
  2760.             }
  2761.         }
  2762.         public bool WordWrap
  2763.         {
  2764.             get { return _WordWrap; }
  2765.             set
  2766.             {
  2767.                 _WordWrap = value;
  2768.                 if (iTalkRTB != null)
  2769.                 {
  2770.                     iTalkRTB.WordWrap = value;
  2771.                 }
  2772.             }
  2773.         }
  2774.         public bool AutoWordSelection
  2775.         {
  2776.             get { return _AutoWordSelection; }
  2777.             set
  2778.             {
  2779.                 _AutoWordSelection = value;
  2780.                 if (iTalkRTB != null)
  2781.                 {
  2782.                     iTalkRTB.AutoWordSelection = value;
  2783.                 }
  2784.             }
  2785.         }
  2786.         #endregion
  2787.         #region EventArgs
  2788.  
  2789.         protected override void OnForeColorChanged(System.EventArgs e)
  2790.         {
  2791.             base.OnForeColorChanged(e);
  2792.             iTalkRTB.ForeColor = ForeColor;
  2793.             Invalidate();
  2794.         }
  2795.  
  2796.         protected override void OnFontChanged(System.EventArgs e)
  2797.         {
  2798.             base.OnFontChanged(e);
  2799.             iTalkRTB.Font = Font;
  2800.         }
  2801.         protected override void OnPaintBackground(PaintEventArgs e)
  2802.         {
  2803.             base.OnPaintBackground(e);
  2804.         }
  2805.  
  2806.         protected override void OnSizeChanged(System.EventArgs e)
  2807.         {
  2808.             base.OnSizeChanged(e);
  2809.             iTalkRTB.Size = new Size(Width - 13, Height - 11);
  2810.         }
  2811.  
  2812.  
  2813.         protected override void OnResize(System.EventArgs e)
  2814.         {
  2815.             base.OnResize(e);
  2816.  
  2817.             Shape = new GraphicsPath();
  2818.             var _Shape = Shape;
  2819.             _Shape.AddArc(0, 0, 10, 10, 180, 90);
  2820.             _Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2821.             _Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2822.             _Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  2823.             _Shape.CloseAllFigures();
  2824.         }
  2825.  
  2826.         public void _TextChanged(object s, EventArgs e)
  2827.         {
  2828.             iTalkRTB.Text = Text;
  2829.         }
  2830.  
  2831.         #endregion
  2832.  
  2833.         public void AddRichTextBox()
  2834.         {
  2835.             var _RTB = iTalkRTB;
  2836.             _RTB.BackColor = Color.White;
  2837.             _RTB.Size = new Size(Width - 10, 100);
  2838.             _RTB.Location = new Point(7, 5);
  2839.             _RTB.Text = string.Empty;
  2840.             _RTB.BorderStyle = BorderStyle.None;
  2841.             _RTB.Font = new Font("Tahoma", 10);
  2842.             _RTB.Multiline = true;
  2843.         }
  2844.  
  2845.         public iTalk_RichTextBox()
  2846.             : base()
  2847.         {
  2848.  
  2849.             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2850.             SetStyle(ControlStyles.UserPaint, true);
  2851.  
  2852.             AddRichTextBox();
  2853.             Controls.Add(iTalkRTB);
  2854.             BackColor = Color.Transparent;
  2855.             ForeColor = Color.DimGray;
  2856.  
  2857.             Text = null;
  2858.             Font = new Font("Tahoma", 10);
  2859.             Size = new Size(150, 100);
  2860.             WordWrap = true;
  2861.             AutoWordSelection = false;
  2862.             DoubleBuffered = true;
  2863.  
  2864.             TextChanged += _TextChanged;
  2865.         }
  2866.  
  2867.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2868.         {
  2869.             base.OnPaint(e);
  2870.             Bitmap B = new Bitmap(this.Width, this.Height);
  2871.             Graphics G = Graphics.FromImage(B);
  2872.             G.SmoothingMode = SmoothingMode.AntiAlias;
  2873.             G.Clear(Color.Transparent);
  2874.             G.FillPath(Brushes.White, this.Shape);
  2875.             G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), this.Shape);
  2876.             G.Dispose();
  2877.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  2878.             B.Dispose();
  2879.         }
  2880.     }
  2881.  
  2882.     #endregion
  2883.     #region  NumericUpDown
  2884.  
  2885.     public class iTalk_NumericUpDown : Control
  2886.     {
  2887.  
  2888.         #region  Enums
  2889.  
  2890.         public enum _TextAlignment
  2891.         {
  2892.             Near,
  2893.             Center
  2894.         }
  2895.  
  2896.         #endregion
  2897.         #region  Variables
  2898.  
  2899.         private GraphicsPath Shape;
  2900.         private Pen P1;
  2901.         private SolidBrush B1;
  2902.  
  2903.         private long _Value;
  2904.         private long _Minimum;
  2905.         private long _Maximum;
  2906.         private int Xval;
  2907.         private int Yval;
  2908.         private bool KeyboardNum;
  2909.         private _TextAlignment MyStringAlignment;
  2910.  
  2911.         #endregion
  2912.         #region  Properties
  2913.  
  2914.         public long Value
  2915.         {
  2916.             get
  2917.             {
  2918.                 return _Value;
  2919.             }
  2920.             set
  2921.             {
  2922.                 if (value <= _Maximum & value >= _Minimum)
  2923.                 {
  2924.                     _Value = value;
  2925.                 }
  2926.                 Invalidate();
  2927.             }
  2928.         }
  2929.  
  2930.         public long Minimum
  2931.         {
  2932.             get
  2933.             {
  2934.                 return _Minimum;
  2935.             }
  2936.             set
  2937.             {
  2938.                 if (value < _Maximum)
  2939.                 {
  2940.                     _Minimum = value;
  2941.                 }
  2942.                 if (_Value < _Minimum)
  2943.                 {
  2944.                     _Value = Minimum;
  2945.                 }
  2946.                 Invalidate();
  2947.             }
  2948.         }
  2949.  
  2950.         public long Maximum
  2951.         {
  2952.             get
  2953.             {
  2954.                 return _Maximum;
  2955.             }
  2956.             set
  2957.             {
  2958.                 if (value > _Minimum)
  2959.                 {
  2960.                     _Maximum = value;
  2961.                 }
  2962.                 if (_Value > _Maximum)
  2963.                 {
  2964.                     _Value = _Maximum;
  2965.                 }
  2966.                 Invalidate();
  2967.             }
  2968.         }
  2969.  
  2970.         public _TextAlignment TextAlignment
  2971.         {
  2972.             get
  2973.             {
  2974.                 return MyStringAlignment;
  2975.             }
  2976.             set
  2977.             {
  2978.                 MyStringAlignment = value;
  2979.                 Invalidate();
  2980.             }
  2981.         }
  2982.  
  2983.         #endregion
  2984.         #region  EventArgs
  2985.  
  2986.         protected override void OnResize(System.EventArgs e)
  2987.         {
  2988.             base.OnResize(e);
  2989.             Height = 28;
  2990.             Shape = new GraphicsPath();
  2991.             Shape.AddArc(0, 0, 10, 10, 180, 90);
  2992.             Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2993.             Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2994.             Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  2995.             Shape.CloseAllFigures();
  2996.         }
  2997.  
  2998.         protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  2999.         {
  3000.             base.OnMouseMove(e);
  3001.             Xval = e.Location.X;
  3002.             Yval = e.Location.Y;
  3003.             Invalidate();
  3004.  
  3005.             if (e.X < Width - 24)
  3006.             {
  3007.                 Cursor = Cursors.IBeam;
  3008.             }
  3009.             else
  3010.             {
  3011.                 Cursor = Cursors.Default;
  3012.             }
  3013.         }
  3014.  
  3015.         protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  3016.         {
  3017.             base.OnMouseClick(e);
  3018.             if (Xval > this.Width - 23 && Xval < this.Width - 3)
  3019.             {
  3020.                 if (Yval < 15)
  3021.                 {
  3022.                     if ((Value + 1) <= _Maximum)
  3023.                     {
  3024.                         _Value++;
  3025.                     }
  3026.                 }
  3027.                 else
  3028.                 {
  3029.                     if ((Value - 1) >= _Minimum)
  3030.                     {
  3031.                         _Value--;
  3032.                     }
  3033.                 }
  3034.             }
  3035.             else
  3036.             {
  3037.                 KeyboardNum = !KeyboardNum;
  3038.                 Focus();
  3039.             }
  3040.             Invalidate();
  3041.         }
  3042.  
  3043.         protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
  3044.         {
  3045.             base.OnKeyPress(e);
  3046.             try
  3047.             {
  3048.                 if (KeyboardNum == true)
  3049.                 {
  3050.                     _Value = long.Parse((_Value).ToString() + e.KeyChar.ToString().ToString());
  3051.                 }
  3052.                 if (_Value > _Maximum)
  3053.                 {
  3054.                     _Value = _Maximum;
  3055.                 }
  3056.             }
  3057.             catch (Exception)
  3058.             {
  3059.             }
  3060.         }
  3061.  
  3062.         protected override void OnKeyUp(System.Windows.Forms.KeyEventArgs e)
  3063.         {
  3064.             base.OnKeyUp(e);
  3065.             if (e.KeyCode == Keys.Back)
  3066.             {
  3067.                 string TemporaryValue = _Value.ToString();
  3068.                 TemporaryValue = TemporaryValue.Remove(Convert.ToInt32(TemporaryValue.Length - 1));
  3069.                 if (TemporaryValue.Length == 0)
  3070.                 {
  3071.                     TemporaryValue = "0";
  3072.                 }
  3073.                 _Value = Convert.ToInt32(TemporaryValue);
  3074.             }
  3075.             Invalidate();
  3076.         }
  3077.  
  3078.         protected override void OnMouseWheel(MouseEventArgs e)
  3079.         {
  3080.             base.OnMouseWheel(e);
  3081.             if (e.Delta > 0)
  3082.             {
  3083.                 if ((Value + 1) <= _Maximum)
  3084.                 {
  3085.                     _Value++;
  3086.                 }
  3087.                 Invalidate();
  3088.             }
  3089.             else
  3090.             {
  3091.                 if ((Value - 1) >= _Minimum)
  3092.                 {
  3093.                     _Value--;
  3094.                 }
  3095.                 Invalidate();
  3096.             }
  3097.         }
  3098.  
  3099.         #endregion
  3100.  
  3101.         public iTalk_NumericUpDown()
  3102.         {
  3103.             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  3104.             SetStyle(ControlStyles.UserPaint, true);
  3105.  
  3106.             P1 = new Pen(Color.FromArgb(180, 180, 180)); // P1 = Border color
  3107.             B1 = new SolidBrush(Color.White); // B1 = Rect Background color
  3108.             BackColor = Color.Transparent;
  3109.             ForeColor = Color.DimGray;
  3110.  
  3111.             _Minimum = 0;
  3112.             _Maximum = 100;
  3113.  
  3114.             Font = new Font("Tahoma", 11);
  3115.             Size = new Size(70, 28);
  3116.             MinimumSize = new Size(62, 28);
  3117.             DoubleBuffered = true;
  3118.         }
  3119.  
  3120.         public void Increment(int Value)
  3121.         {
  3122.             this._Value += Value;
  3123.             Invalidate();
  3124.         }
  3125.  
  3126.         public void Decrement(int Value)
  3127.         {
  3128.             this._Value -= Value;
  3129.             Invalidate();
  3130.         }
  3131.  
  3132.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  3133.         {
  3134.             base.OnPaint(e);
  3135.             Bitmap B = new Bitmap(Width, Height);
  3136.             Graphics G = Graphics.FromImage(B);
  3137.  
  3138.             G.SmoothingMode = SmoothingMode.AntiAlias;
  3139.  
  3140.             G.Clear(Color.Transparent); // Set control background color
  3141.             G.FillPath(B1, Shape); // Draw background
  3142.             G.DrawPath(P1, Shape); // Draw border
  3143.  
  3144.             LinearGradientBrush ColorGradient = new LinearGradientBrush(new Rectangle(Width - 23, 4, 19, 19), Color.FromArgb(241, 241, 241), Color.FromArgb(241, 241, 241), 90.0F);
  3145.             G.FillRectangle(ColorGradient, ColorGradient.Rectangle); // Fills the body of the rectangle
  3146.  
  3147.             G.DrawRectangle(new Pen(Color.FromArgb(252, 252, 252)), new Rectangle(Width - 22, 5, 17, 17));
  3148.             G.DrawRectangle(new Pen(Color.FromArgb(180, 180, 180)), new Rectangle(Width - 23, 4, 19, 19));
  3149.  
  3150.             G.DrawLine(new Pen(Color.FromArgb(250, 252, 250)), new Point(Width - 22, Height - 16), new Point(Width - 5, Height - 16));
  3151.             G.DrawLine(new Pen(Color.FromArgb(180, 180, 180)), new Point(Width - 22, Height - 15), new Point(Width - 5, Height - 15));
  3152.             G.DrawLine(new Pen(Color.FromArgb(250, 250, 250)), new Point(Width - 22, Height - 14), new Point(Width - 5, Height - 14));
  3153.  
  3154.             G.DrawString("+", new Font("Tahoma", 8), Brushes.Gray, Width - 19, Height - 26);
  3155.             G.DrawString("-", new Font("Tahoma", 12), Brushes.Gray, Width - 19, Height - 20);
  3156.  
  3157.             switch (MyStringAlignment)
  3158.             {
  3159.                 case _TextAlignment.Near:
  3160.                     G.DrawString(System.Convert.ToString(Value), Font, new SolidBrush(ForeColor), new Rectangle(5, 0, Width - 1, Height - 1), new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
  3161.                     break;
  3162.                 case _TextAlignment.Center:
  3163.                     G.DrawString(System.Convert.ToString(Value), Font, new SolidBrush(ForeColor), new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  3164.                     break;
  3165.             }
  3166.  
  3167.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  3168.             G.Dispose();
  3169.             B.Dispose();
  3170.         }
  3171.     }
  3172.  
  3173.     #endregion
  3174.     #region Left Chat Bubble
  3175.  
  3176.     public class iTalk_ChatBubble_L : Control
  3177.     {
  3178.  
  3179.         #region Variables
  3180.  
  3181.         private GraphicsPath Shape;
  3182.         private Color _TextColor = Color.FromArgb(52, 52, 52);
  3183.         private Color _BubbleColor = Color.FromArgb(217, 217, 217);
  3184.         private bool _DrawBubbleArrow = true;
  3185.  
  3186.         #endregion
  3187.         #region Properties
  3188.  
  3189.         public override Color ForeColor
  3190.         {
  3191.             get { return this._TextColor; }
  3192.             set
  3193.             {
  3194.                 this._TextColor = value;
  3195.                 this.Invalidate();
  3196.             }
  3197.         }
  3198.  
  3199.         public Color BubbleColor
  3200.         {
  3201.             get { return this._BubbleColor; }
  3202.             set
  3203.             {
  3204.                 this._BubbleColor = value;
  3205.                 this.Invalidate();
  3206.             }
  3207.         }
  3208.  
  3209.         public bool DrawBubbleArrow
  3210.         {
  3211.             get { return _DrawBubbleArrow; }
  3212.             set
  3213.             {
  3214.                 _DrawBubbleArrow = value;
  3215.                 Invalidate();
  3216.             }
  3217.         }
  3218.  
  3219.         #endregion
  3220.  
  3221.         public iTalk_ChatBubble_L()
  3222.         {
  3223.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  3224.             DoubleBuffered = true;
  3225.             Size = new Size(152, 38);
  3226.             BackColor = Color.Transparent;
  3227.             ForeColor = Color.FromArgb(52, 52, 52);
  3228.             Font = new Font("Segoe UI", 10);
  3229.         }
  3230.  
  3231.         protected override void OnResize(System.EventArgs e)
  3232.         {
  3233.             Shape = new GraphicsPath();
  3234.  
  3235.             var _Shape = Shape;
  3236.             _Shape.AddArc(9, 0, 10, 10, 180, 90);
  3237.             _Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  3238.             _Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  3239.             _Shape.AddArc(9, Height - 11, 10, 10, 90, 90);
  3240.             _Shape.CloseAllFigures();
  3241.  
  3242.             Invalidate();
  3243.             base.OnResize(e);
  3244.         }
  3245.  
  3246.         protected override void OnPaint(PaintEventArgs e)
  3247.         {
  3248.             base.OnPaint(e);
  3249.             Bitmap B = new Bitmap(this.Width, this.Height);
  3250.             Graphics G = Graphics.FromImage(B);
  3251.             var _G = G;
  3252.             _G.SmoothingMode = SmoothingMode.HighQuality;
  3253.             _G.PixelOffsetMode = PixelOffsetMode.HighQuality;
  3254.             _G.Clear(BackColor);
  3255.  
  3256.             // Fill the body of the bubble with the specified color
  3257.             _G.FillPath(new SolidBrush(_BubbleColor), Shape);
  3258.             // Draw the string specified in 'Text' property
  3259.             _G.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(15, 4, Width - 17, Height - 5));
  3260.  
  3261.             // Draw a polygon on the right side of the bubble
  3262.             if (_DrawBubbleArrow == true)
  3263.             {
  3264.                 Point[] p = {
  3265.                             new Point(9, Height - 19),
  3266.                             new Point(0, Height - 25),
  3267.                             new Point(9, Height - 30)
  3268.                         };
  3269.                 _G.FillPolygon(new SolidBrush(_BubbleColor), p);
  3270.                 _G.DrawPolygon(new Pen(new SolidBrush(_BubbleColor)), p);
  3271.             }
  3272.             G.Dispose();
  3273.             e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
  3274.             e.Graphics.DrawImageUnscaled(B, 0, 0);
  3275.             B.Dispose();
  3276.         }
  3277.     }
  3278.  
  3279.     #endregion
  3280.     #region Right Chat Bubble
  3281.  
  3282.     public class iTalk_ChatBubble_R : Control
  3283.     {
  3284.  
  3285.         #region Variables
  3286.  
  3287.         private GraphicsPath Shape;
  3288.         private Color _TextColor = Color.FromArgb(52, 52, 52);
  3289.         private Color _BubbleColor = Color.FromArgb(192, 206, 215);
  3290.         private bool _DrawBubbleArrow = true;
  3291.  
  3292.         #endregion
  3293.         #region Properties
  3294.  
  3295.         public override Color ForeColor
  3296.         {
  3297.             get { return this._TextColor; }
  3298.             set
  3299.             {
  3300.                 this._TextColor = value;
  3301.                 this.Invalidate();
  3302.             }
  3303.         }
  3304.  
  3305.         public Color BubbleColor
  3306.         {
  3307.             get { return this._BubbleColor; }
  3308.             set
  3309.             {
  3310.                 this._BubbleColor = value;
  3311.                 this.Invalidate();
  3312.             }
  3313.         }
  3314.  
  3315.         public bool DrawBubbleArrow
  3316.         {
  3317.             get { return _DrawBubbleArrow; }
  3318.             set
  3319.             {
  3320.                 _DrawBubbleArrow = value;
  3321.                 Invalidate();
  3322.             }
  3323.         }
  3324.  
  3325.         #endregion
  3326.  
  3327.         public iTalk_ChatBubble_R()
  3328.         {
  3329.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  3330.             DoubleBuffered = true;
  3331.             Size = new Size(152, 38);
  3332.             BackColor = Color.Transparent;
  3333.             ForeColor = Color.FromArgb(52, 52, 52);
  3334.             Font = new Font("Segoe UI", 10);
  3335.         }
  3336.  
  3337.         protected override void OnResize(System.EventArgs e)
  3338.         {
  3339.             base.OnResize(e);
  3340.             Shape = new GraphicsPath();
  3341.  
  3342.             var _with1 = Shape;
  3343.             _with1.AddArc(0, 0, 10, 10, 180, 90);
  3344.             _with1.AddArc(Width - 18, 0, 10, 10, -90, 90);
  3345.             _with1.AddArc(Width - 18, Height - 11, 10, 10, 0, 90);
  3346.             _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  3347.             _with1.CloseAllFigures();
  3348.  
  3349.             Invalidate();
  3350.         }
  3351.  
  3352.         protected override void OnPaint(PaintEventArgs e)
  3353.         {
  3354.             base.OnPaint(e);
  3355.             Bitmap B = new Bitmap(this.Width, this.Height);
  3356.             Graphics G = Graphics.FromImage(B);
  3357.  
  3358.             var _G = G;
  3359.             _G.SmoothingMode = SmoothingMode.HighQuality;
  3360.             _G.PixelOffsetMode = PixelOffsetMode.HighQuality;
  3361.             _G.Clear(BackColor);
  3362.  
  3363.             // Fill the body of the bubble with the specified color
  3364.             _G.FillPath(new SolidBrush(_BubbleColor), Shape);
  3365.             // Draw the string specified in 'Text' property
  3366.             _G.DrawString(Text, Font, new SolidBrush(ForeColor), (new Rectangle(6, 4, Width - 15, Height)));
  3367.  
  3368.             // Draw a polygon on the right side of the bubble
  3369.             if (_DrawBubbleArrow == true)
  3370.             {
  3371.                 Point[] p = {
  3372.             new Point(Width - 8, Height - 19),
  3373.             new Point(Width, Height - 25),
  3374.             new Point(Width - 8, Height - 30)
  3375.         };
  3376.                 _G.FillPolygon(new SolidBrush(_BubbleColor), p);
  3377.                 _G.DrawPolygon(new Pen(new SolidBrush(_BubbleColor)), p);
  3378.             }
  3379.  
  3380.             G.Dispose();
  3381.             e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
  3382.             e.Graphics.DrawImageUnscaled(B, 0, 0);
  3383.             B.Dispose();
  3384.         }
  3385.     }
  3386.  
  3387.     #endregion
  3388.     #region Separator
  3389.  
  3390.     public class iTalk_Separator : Control
  3391.     {
  3392.  
  3393.         public iTalk_Separator()
  3394.         {
  3395.             SetStyle(ControlStyles.ResizeRedraw, true);
  3396.             this.Size = new Size(120, 10);
  3397.         }
  3398.  
  3399.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  3400.         {
  3401.             base.OnPaint(e);
  3402.             e.Graphics.DrawLine(new Pen(Color.FromArgb(184, 183, 188)), 0, 5, Width, 5);
  3403.         }
  3404.     }
  3405.  
  3406.     #endregion
  3407.     #region Panel
  3408.  
  3409.     class iTalk_Panel : ContainerControl
  3410.     {
  3411.  
  3412.  
  3413.         private GraphicsPath Shape;
  3414.         public iTalk_Panel()
  3415.         {
  3416.             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  3417.             SetStyle(ControlStyles.UserPaint, true);
  3418.  
  3419.             BackColor = Color.Transparent;
  3420.             this.Size = new Size(187, 117);
  3421.             Padding = new Padding(5, 5, 5, 5);
  3422.             DoubleBuffered = true;
  3423.         }
  3424.  
  3425.         protected override void OnResize(System.EventArgs e)
  3426.         {
  3427.             base.OnResize(e);
  3428.  
  3429.             Shape = new GraphicsPath();
  3430.             var _with1 = Shape;
  3431.             _with1.AddArc(0, 0, 10, 10, 180, 90);
  3432.             _with1.AddArc(Width - 11, 0, 10, 10, -90, 90);
  3433.             _with1.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  3434.             _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  3435.             _with1.CloseAllFigures();
  3436.         }
  3437.  
  3438.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  3439.         {
  3440.             base.OnPaint(e);
  3441.             Bitmap B = new Bitmap(Width, Height);
  3442.             Graphics G = Graphics.FromImage(B);
  3443.  
  3444.             G.SmoothingMode = SmoothingMode.HighQuality;
  3445.  
  3446.             G.Clear(Color.Transparent);
  3447.             G.FillPath(Brushes.White, Shape); // Draw RTB background
  3448.             G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), Shape); // Draw border
  3449.  
  3450.             G.Dispose();
  3451.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  3452.             B.Dispose();
  3453.         }
  3454.     }
  3455.  
  3456.     #endregion
  3457.     #region GroupBox
  3458.  
  3459.     public class iTalk_GroupBox : ContainerControl
  3460.     {
  3461.  
  3462.         public iTalk_GroupBox()
  3463.         {
  3464.             SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
  3465.             BackColor = Color.Transparent;
  3466.             DoubleBuffered = true;
  3467.             this.Size = new Size(212, 104);
  3468.             this.MinimumSize = new Size(136, 50);
  3469.             this.Padding = new Padding(5, 28, 5, 5);
  3470.         }
  3471.  
  3472.         protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  3473.         {
  3474.             base.OnPaint(e);
  3475.             Bitmap B = new Bitmap(Width, Height);
  3476.             Graphics G = Graphics.FromImage(B);
  3477.             Rectangle TitleBox = new Rectangle(51, 3, Width - 103, 18);
  3478.             Rectangle box = new Rectangle(0, 0, Width - 1, Height - 10);
  3479.  
  3480.             G.Clear(Color.Transparent);
  3481.             G.SmoothingMode = SmoothingMode.HighQuality;
  3482.  
  3483.             // Draw the body of the GroupBox
  3484.             G.FillPath(Brushes.White, RoundRectangle.RoundRect(new Rectangle(1, 12, Width - 3, box.Height - 1), 8));
  3485.             // Draw the border of the GroupBox
  3486.             G.DrawPath(new Pen(Color.FromArgb(159, 159, 161)), RoundRectangle.RoundRect(new Rectangle(1, 12, Width - 3, Height - 13), 8));
  3487.  
  3488.             // Draw the background of the title box
  3489.             G.FillPath(Brushes.White, RoundRectangle.RoundRect(TitleBox, 1));
  3490.             // Draw the border of the title box
  3491.             G.DrawPath(new Pen(Color.FromArgb(182, 180, 186)), RoundRectangle.RoundRect(TitleBox, 4));
  3492.             // Draw the specified string from 'Text' property inside the title box
  3493.             G.DrawString(Text, new Font("Tahoma", 9, FontStyle.Regular), new SolidBrush(Color.FromArgb(53, 53, 53)), TitleBox, new StringFormat
  3494.             {
  3495.                 Alignment = StringAlignment.Center,
  3496.                 LineAlignment = StringAlignment.Center
  3497.             });
  3498.  
  3499.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  3500.             G.Dispose();
  3501.             B.Dispose();
  3502.         }
  3503.     }
  3504.  
  3505.     #endregion
  3506.     #region CheckBox
  3507.  
  3508.     [DefaultEvent("CheckedChanged")]
  3509.     class iTalk_CheckBox : Control
  3510.     {
  3511.  
  3512.         #region Variables
  3513.  
  3514.         private GraphicsPath Shape;
  3515.         private LinearGradientBrush GB;
  3516.         private Rectangle R1;
  3517.         private Rectangle R2;
  3518.         private bool _Checked;
  3519.         public event CheckedChangedEventHandler CheckedChanged;
  3520.         public delegate void CheckedChangedEventHandler(object sender);
  3521.  
  3522.         #endregion
  3523.         #region Properties
  3524.  
  3525.         public bool Checked
  3526.         {
  3527.             get { return _Checked; }
  3528.             set
  3529.             {
  3530.                 _Checked = value;
  3531.                 if (CheckedChanged != null)
  3532.                 {
  3533.                     CheckedChanged(this);
  3534.                 }
  3535.                 Invalidate();
  3536.             }
  3537.         }
  3538.  
  3539.         #endregion
  3540.  
  3541.         public iTalk_CheckBox()
  3542.         {
  3543.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  3544.  
  3545.             BackColor = Color.Transparent;
  3546.             DoubleBuffered = true;
  3547.             Font = new Font("Segoe UI", 10);
  3548.             Size = new Size(120, 26);
  3549.         }
  3550.  
  3551.         protected override void OnClick(EventArgs e)
  3552.         {
  3553.             _Checked = !_Checked;
  3554.             if (CheckedChanged != null)
  3555.             {
  3556.                 CheckedChanged(this);
  3557.             }
  3558.             Invalidate();
  3559.             base.OnClick(e);
  3560.         }
  3561.  
  3562.         protected override void OnTextChanged(System.EventArgs e)
  3563.         {
  3564.             Invalidate();
  3565.             base.OnTextChanged(e);
  3566.         }
  3567.  
  3568.         protected override void OnResize(System.EventArgs e)
  3569.         {
  3570.             if (Width > 0 && Height > 0)
  3571.             {
  3572.                 Shape = new GraphicsPath();
  3573.  
  3574.                 R1 = new Rectangle(17, 0, Width, Height + 1);
  3575.                 R2 = new Rectangle(0, 0, Width, Height);
  3576.                 GB = new LinearGradientBrush(new Rectangle(0, 0, 25, 25), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240), 90);
  3577.  
  3578.                 var _Shape = Shape;
  3579.                 _Shape.AddArc(0, 0, 7, 7, 180, 90);
  3580.                 _Shape.AddArc(7, 0, 7, 7, -90, 90);
  3581.                 _Shape.AddArc(7, 7, 7, 7, 0, 90);
  3582.                 _Shape.AddArc(0, 7, 7, 7, 90, 90);
  3583.                 _Shape.CloseAllFigures();
  3584.                 Height = 15;
  3585.             }
  3586.  
  3587.             Invalidate();
  3588.             base.OnResize(e);
  3589.         }
  3590.  
  3591.         protected override void OnPaint(PaintEventArgs e)
  3592.         {
  3593.             base.OnPaint(e);
  3594.  
  3595.             var _G = e.Graphics;
  3596.             _G.Clear(Color.FromArgb(246, 246, 246));
  3597.             _G.SmoothingMode = SmoothingMode.AntiAlias;
  3598.             // Fill the body of the CheckBox
  3599.             _G.FillPath(GB, Shape);
  3600.             // Draw the border
  3601.             _G.DrawPath(new Pen(Color.FromArgb(160, 160, 160)), Shape);
  3602.             // Draw the string
  3603.             _G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(142, 142, 142)), R1, new StringFormat { LineAlignment = StringAlignment.Center });
  3604.  
  3605.             if (Checked)
  3606.             {
  3607.                 _G.DrawString("ΓΌ", new Font("Wingdings", 14), new SolidBrush(Color.FromArgb(142, 142, 142)), new Rectangle(-2, 1, Width, Height), new StringFormat { LineAlignment = StringAlignment.Center });
  3608.             }
  3609.             e.Dispose();
  3610.         }
  3611.     }
  3612.  
  3613.     #endregion
  3614.     #region RadioButton
  3615.  
  3616.     [DefaultEvent("CheckedChanged")]
  3617.     class iTalk_RadioButton : Control
  3618.     {
  3619.  
  3620.         #region Enums
  3621.  
  3622.         public enum MouseState : byte
  3623.         {
  3624.             None = 0,
  3625.             Over = 1,
  3626.             Down = 2,
  3627.             Block = 3
  3628.         }
  3629.  
  3630.         #endregion
  3631.         #region Variables
  3632.  
  3633.         private bool _Checked;
  3634.         public event CheckedChangedEventHandler CheckedChanged;
  3635.         public delegate void CheckedChangedEventHandler(object sender);
  3636.  
  3637.         #endregion
  3638.         #region Properties
  3639.  
  3640.         public bool Checked
  3641.         {
  3642.             get { return _Checked; }
  3643.             set
  3644.             {
  3645.                 _Checked = value;
  3646.                 InvalidateControls();
  3647.                 if (CheckedChanged != null)
  3648.                 {
  3649.                     CheckedChanged(this);
  3650.                 }
  3651.                 Invalidate();
  3652.             }
  3653.         }
  3654.  
  3655.         #endregion
  3656.         #region EventArgs
  3657.  
  3658.         protected override void OnTextChanged(System.EventArgs e)
  3659.         {
  3660.             Invalidate();
  3661.             base.OnTextChanged(e);
  3662.         }
  3663.  
  3664.         protected override void OnResize(EventArgs e)
  3665.         {
  3666.             base.OnResize(e);
  3667.             Height = 15;
  3668.         }
  3669.  
  3670.         protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  3671.         {
  3672.             if (!_Checked)
  3673.                 Checked = true;
  3674.             base.OnMouseDown(e);
  3675.         }
  3676.  
  3677.         #endregion
  3678.  
  3679.         public iTalk_RadioButton()
  3680.         {
  3681.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  3682.             BackColor = Color.Transparent;
  3683.             Font = new Font("Segoe UI", 10);
  3684.             Width = 132;
  3685.         }
  3686.  
  3687.         private void InvalidateControls()
  3688.         {
  3689.             if (!IsHandleCreated || !_Checked)
  3690.                 return;
  3691.  
  3692.             foreach (Control _Control in Parent.Controls)
  3693.             {
  3694.                 if (!object.ReferenceEquals(_Control, this) && _Control is iTalk_RadioButton)
  3695.                 {
  3696.                     ((iTalk_RadioButton)_Control).Checked = false;
  3697.                 }
  3698.             }
  3699.         }
  3700.  
  3701.         protected override void OnPaint(PaintEventArgs e)
  3702.         {
  3703.             base.OnPaint(e);
  3704.             var _G = e.Graphics;
  3705.  
  3706.             _G.Clear(Color.FromArgb(246, 246, 246));
  3707.             _G.SmoothingMode = SmoothingMode.AntiAlias;
  3708.  
  3709.             LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(14, 14)), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240), 90);
  3710.             _G.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(14, 14)));
  3711.  
  3712.             GraphicsPath GP = new GraphicsPath();
  3713.             GP.AddEllipse(new Rectangle(0, 0, 14, 14));
  3714.             _G.SetClip(GP);
  3715.             _G.ResetClip();
  3716.  
  3717.             // Draw ellipse border
  3718.             _G.DrawEllipse(new Pen(Color.FromArgb(160, 160, 160)), new Rectangle(new Point(0, 0), new Size(14, 14)));
  3719.  
  3720.             // Draw an ellipse inside the body
  3721.             if (_Checked)
  3722.             {
  3723.                 SolidBrush EllipseColor = new SolidBrush(Color.FromArgb(142, 142, 142));
  3724.                 _G.FillEllipse(EllipseColor, new Rectangle(new Point(4, 4), new Size(6, 6)));
  3725.             }
  3726.             // Draw the string specified in 'Text' property
  3727.             _G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(142, 142, 142)), 16, 8, new StringFormat { LineAlignment = StringAlignment.Center });
  3728.  
  3729.             e.Dispose();
  3730.         }
  3731.     }
  3732.  
  3733.     #endregion
  3734.     #region Notification Number
  3735.  
  3736.     class iTalk_NotificationNumber : Control
  3737.     {
  3738.         #region Variables
  3739.  
  3740.         private int _Value = 0;
  3741.         private int _Maximum = 99;
  3742.  
  3743.         #endregion
  3744.         #region Properties
  3745.  
  3746.         public int Value
  3747.         {
  3748.             get
  3749.             {
  3750.                 if (this._Value == 0)
  3751.                 {
  3752.                     return 0;
  3753.                 }
  3754.                 return this._Value;
  3755.             }
  3756.             set
  3757.             {
  3758.                 if (value > this._Maximum)
  3759.                 {
  3760.                     value = this._Maximum;
  3761.                 }
  3762.                 this._Value = value;
  3763.                 this.Invalidate();
  3764.             }
  3765.         }
  3766.  
  3767.         public int Maximum
  3768.         {
  3769.             get
  3770.             {
  3771.                 return this._Maximum;
  3772.             }
  3773.             set
  3774.             {
  3775.                 if (value < this._Value)
  3776.                 {
  3777.                     this._Value = value;
  3778.                 }
  3779.                 this._Maximum = value;
  3780.                 this.Invalidate();
  3781.             }
  3782.         }
  3783.  
  3784.  
  3785.  
  3786.         #endregion
  3787.  
  3788.         public iTalk_NotificationNumber()
  3789.         {
  3790.             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  3791.             SetStyle(ControlStyles.UserPaint, true);
  3792.  
  3793.             Text = null;
  3794.             DoubleBuffered = true;
  3795.         }
  3796.  
  3797.         protected override void OnResize(EventArgs e)
  3798.         {
  3799.             base.OnResize(e);
  3800.             Height = 20;
  3801.             Width = 20;
  3802.         }
  3803.  
  3804.         protected override void OnPaint(PaintEventArgs e)
  3805.         {
  3806.             base.OnPaint(e);
  3807.             var _G = e.Graphics;
  3808.             string myString = _Value.ToString();
  3809.             _G.Clear(BackColor);
  3810.             _G.SmoothingMode = SmoothingMode.AntiAlias;
  3811.             LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(18, 20)), Color.FromArgb(197, 69, 68), Color.FromArgb(176, 52, 52), 90f);
  3812.  
  3813.             // Fills the body with LGB gradient
  3814.             _G.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(18, 18)));
  3815.             // Draw border
  3816.             _G.DrawEllipse(new Pen(Color.FromArgb(205, 70, 66)), new Rectangle(new Point(0, 0), new Size(18, 18)));
  3817.             _G.DrawString(myString, new Font("Segoe UI", 8, FontStyle.Bold), new SolidBrush(Color.FromArgb(255, 255, 253)), new Rectangle(0, 0, Width - 2, Height), new StringFormat
  3818.             {
  3819.                 Alignment = StringAlignment.Center,
  3820.                 LineAlignment = StringAlignment.Center
  3821.             });
  3822.             e.Dispose();
  3823.         }
  3824.  
  3825.     }
  3826.  
  3827.     #endregion
  3828.     #region ListView
  3829.  
  3830.     class iTalk_Listview : ListView
  3831.     {
  3832.  
  3833.         [DllImport("uxtheme", CharSet = CharSet.Unicode)]
  3834.         public static extern int SetWindowTheme(IntPtr hWnd, string textSubAppName, string textSubIdList);
  3835.  
  3836.         public iTalk_Listview()
  3837.         {
  3838.             this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
  3839.             this.DoubleBuffered = true;
  3840.             HeaderStyle = ColumnHeaderStyle.Nonclickable;
  3841.             BorderStyle = System.Windows.Forms.BorderStyle.None;
  3842.         }
  3843.  
  3844.         protected override void OnHandleCreated(EventArgs e)
  3845.         {
  3846.             iTalk_Listview.SetWindowTheme(this.Handle, "explorer", null);
  3847.             base.OnHandleCreated(e);
  3848.         }
  3849.     }
  3850.  
  3851.     #endregion
  3852.     #region ComboBox
  3853.  
  3854.     class iTalk_ComboBox : ComboBox
  3855.     {
  3856.  
  3857.         #region Variables
  3858.  
  3859.         private int _StartIndex = 0;
  3860.         private Color _HoverSelectionColor = Color.FromArgb(241, 241, 241);
  3861.  
  3862.         #endregion
  3863.         #region Custom Properties
  3864.  
  3865.         public int StartIndex
  3866.         {
  3867.             get { return _StartIndex; }
  3868.             set
  3869.             {
  3870.                 _StartIndex = value;
  3871.                 try
  3872.                 {
  3873.                     base.SelectedIndex = value;
  3874.                 }
  3875.                 catch
  3876.                 {
  3877.                 }
  3878.                 Invalidate();
  3879.             }
  3880.         }
  3881.  
  3882.         public Color HoverSelectionColor
  3883.         {
  3884.             get { return _HoverSelectionColor; }
  3885.             set
  3886.             {
  3887.                 _HoverSelectionColor = value;
  3888.                 Invalidate();
  3889.             }
  3890.         }
  3891.  
  3892.         #endregion
  3893.         #region EventArgs
  3894.  
  3895.         protected override void OnDrawItem(DrawItemEventArgs e)
  3896.         {
  3897.             if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
  3898.             {
  3899.                 e.Graphics.FillRectangle(new SolidBrush(_HoverSelectionColor), e.Bounds);
  3900.             }
  3901.             else
  3902.             {
  3903.                 e.Graphics.FillRectangle(Brushes.White, e.Bounds);
  3904.             }
  3905.  
  3906.             if (!(e.Index == -1))
  3907.             {
  3908.                 e.Graphics.DrawString(GetItemText(Items[e.Index]), e.Font, Brushes.DimGray, e.Bounds);
  3909.             }
  3910.         }
  3911.  
  3912.         protected override void OnLostFocus(EventArgs e)
  3913.         {
  3914.             base.OnLostFocus(e);
  3915.             SuspendLayout();
  3916.             Update();
  3917.             ResumeLayout();
  3918.         }
  3919.  
  3920.         protected override void OnPaintBackground(PaintEventArgs e)
  3921.         {
  3922.             base.OnPaintBackground(e);
  3923.         }
  3924.  
  3925.         #endregion
  3926.  
  3927.         public iTalk_ComboBox()
  3928.         {
  3929.             SetStyle((ControlStyles)139286, true);
  3930.             SetStyle(ControlStyles.Selectable, false);
  3931.  
  3932.             DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
  3933.             DropDownStyle = ComboBoxStyle.DropDownList;
  3934.  
  3935.             BackColor = Color.FromArgb(246, 246, 246);
  3936.             ForeColor = Color.FromArgb(142, 142, 142);
  3937.             Size = new Size(135, 26);
  3938.             ItemHeight = 20;
  3939.             DropDownHeight = 100;
  3940.             Font = new Font("Segoe UI", 10, FontStyle.Regular);
  3941.         }
  3942.  
  3943.         protected override void OnPaint(PaintEventArgs e)
  3944.         {
  3945.             base.OnPaint(e);
  3946.             LinearGradientBrush LGB = default(LinearGradientBrush);
  3947.             GraphicsPath GP = default(GraphicsPath);
  3948.  
  3949.             e.Graphics.Clear(BackColor);
  3950.             e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
  3951.  
  3952.             // Create a curvy border
  3953.             GP = RoundRectangle.RoundRect(0, 0, Width - 1, Height - 1, 5);
  3954.             // Fills the body of the rectangle with a gradient
  3955.             LGB = new LinearGradientBrush(ClientRectangle, Color.FromArgb(241, 241, 241), Color.FromArgb(241, 241, 241), 90f);
  3956.  
  3957.             e.Graphics.SetClip(GP);
  3958.             e.Graphics.FillRectangle(LGB, ClientRectangle);
  3959.             e.Graphics.ResetClip();
  3960.  
  3961.             // Draw rectangle border
  3962.             e.Graphics.DrawPath(new Pen(Color.FromArgb(204, 204, 204)), GP);
  3963.             // Draw string
  3964.             e.Graphics.DrawString(Text, Font, new SolidBrush(Color.FromArgb(142, 142, 142)), new Rectangle(3, 0, Width - 20, Height), new StringFormat
  3965.             {
  3966.                 LineAlignment = StringAlignment.Center,
  3967.                 Alignment = StringAlignment.Near
  3968.             });
  3969.  
  3970.             // Draw the dropdown arrow
  3971.             e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160), 2), new Point(Width - 18, 10), new Point(Width - 14, 14));
  3972.             e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160), 2), new Point(Width - 14, 14), new Point(Width - 10, 10));
  3973.             e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160)), new Point(Width - 14, 15), new Point(Width - 14, 14));
  3974.  
  3975.             GP.Dispose();
  3976.             LGB.Dispose();
  3977.         }
  3978.     }
  3979.  
  3980.     #endregion
  3981.     #region Circular ProgressBar
  3982.  
  3983.     public class iTalk_ProgressBar : Control
  3984.     {
  3985.  
  3986.         #region Enums
  3987.  
  3988.         public enum _ProgressShape
  3989.         {
  3990.             Round,
  3991.             Flat
  3992.         }
  3993.  
  3994.         #endregion
  3995.         #region Variables
  3996.  
  3997.         private long _Value;
  3998.         private long _Maximum = 100;
  3999.         private Color _ProgressColor1 = Color.FromArgb(92, 92, 92);
  4000.         private Color _ProgressColor2 = Color.FromArgb(92, 92, 92);
  4001.         private _ProgressShape ProgressShapeVal;
  4002.  
  4003.         #endregion
  4004.         #region Custom Properties
  4005.  
  4006.         public long Value
  4007.         {
  4008.             get { return _Value; }
  4009.             set
  4010.             {
  4011.                 if (value > _Maximum)
  4012.                     value = _Maximum;
  4013.                 _Value = value;
  4014.                 Invalidate();
  4015.             }
  4016.         }
  4017.  
  4018.         public long Maximum
  4019.         {
  4020.             get { return _Maximum; }
  4021.             set
  4022.             {
  4023.                 if (value < 1)
  4024.                     value = 1;
  4025.                 _Maximum = value;
  4026.                 Invalidate();
  4027.             }
  4028.         }
  4029.  
  4030.         public Color ProgressColor1
  4031.         {
  4032.             get { return _ProgressColor1; }
  4033.             set
  4034.             {
  4035.                 _ProgressColor1 = value;
  4036.                 Invalidate();
  4037.             }
  4038.         }
  4039.  
  4040.         public Color ProgressColor2
  4041.         {
  4042.             get { return _ProgressColor2; }
  4043.             set
  4044.             {
  4045.                 _ProgressColor2 = value;
  4046.                 Invalidate();
  4047.             }
  4048.         }
  4049.  
  4050.         public _ProgressShape ProgressShape
  4051.         {
  4052.             get { return ProgressShapeVal; }
  4053.             set
  4054.             {
  4055.                 ProgressShapeVal = value;
  4056.                 Invalidate();
  4057.             }
  4058.         }
  4059.  
  4060.         #endregion
  4061.         #region EventArgs
  4062.  
  4063.         protected override void OnResize(EventArgs e)
  4064.         {
  4065.             base.OnResize(e);
  4066.             SetStandardSize();
  4067.         }
  4068.  
  4069.         protected override void OnSizeChanged(EventArgs e)
  4070.         {
  4071.             base.OnSizeChanged(e);
  4072.             SetStandardSize();
  4073.         }
  4074.  
  4075.         protected override void OnPaintBackground(PaintEventArgs p)
  4076.         {
  4077.             base.OnPaintBackground(p);
  4078.         }
  4079.  
  4080.         #endregion
  4081.  
  4082.         public iTalk_ProgressBar()
  4083.         {
  4084.             Size = new Size(130, 130);
  4085.             Font = new Font("Segoe UI", 15);
  4086.             MinimumSize = new Size(100, 100);
  4087.             DoubleBuffered = true;
  4088.         }
  4089.  
  4090.         private void SetStandardSize()
  4091.         {
  4092.             int _Size = Math.Max(Width, Height);
  4093.             Size = new Size(_Size, _Size);
  4094.         }
  4095.  
  4096.         public void Increment(int Val)
  4097.         {
  4098.             this._Value += Val;
  4099.             Invalidate();
  4100.         }
  4101.  
  4102.         public void Decrement(int Val)
  4103.         {
  4104.             this._Value -= Val;
  4105.             Invalidate();
  4106.         }
  4107.  
  4108.         protected override void OnPaint(PaintEventArgs e)
  4109.         {
  4110.             base.OnPaint(e);
  4111.             using (Bitmap bitmap = new Bitmap(this.Width, this.Height))
  4112.             {
  4113.                 using (Graphics graphics = Graphics.FromImage(bitmap))
  4114.                 {
  4115.                     graphics.SmoothingMode = SmoothingMode.AntiAlias;
  4116.                     graphics.Clear(this.BackColor);
  4117.                     using (LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, this._ProgressColor1, this._ProgressColor2, LinearGradientMode.ForwardDiagonal))
  4118.                     {
  4119.                         using (Pen pen = new Pen(brush, 14f))
  4120.                         {
  4121.                             switch (this.ProgressShapeVal)
  4122.                             {
  4123.                                 case _ProgressShape.Round:
  4124.                                     pen.StartCap = LineCap.Round;
  4125.                                     pen.EndCap = LineCap.Round;
  4126.                                     break;
  4127.  
  4128.                                 case _ProgressShape.Flat:
  4129.                                     pen.StartCap = LineCap.Flat;
  4130.                                     pen.EndCap = LineCap.Flat;
  4131.                                     break;
  4132.                             }
  4133.                             graphics.DrawArc(pen, 0x12, 0x12, (this.Width - 0x23) - 2, (this.Height - 0x23) - 2, -90, (int)Math.Round((double)((360.0 / ((double)this._Maximum)) * this._Value)));
  4134.                         }
  4135.                     }
  4136.                     using (LinearGradientBrush brush2 = new LinearGradientBrush(this.ClientRectangle, Color.FromArgb(0x34, 0x34, 0x34), Color.FromArgb(0x34, 0x34, 0x34), LinearGradientMode.Vertical))
  4137.                     {
  4138.                         graphics.FillEllipse(brush2, 0x18, 0x18, (this.Width - 0x30) - 1, (this.Height - 0x30) - 1);
  4139.                     }
  4140.                     SizeF MS = graphics.MeasureString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font);
  4141.                     graphics.DrawString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font, Brushes.White, Convert.ToInt32(Width / 2 - MS.Width / 2), Convert.ToInt32(Height / 2 - MS.Height / 2));
  4142.                     e.Graphics.DrawImage(bitmap, 0, 0);
  4143.                     graphics.Dispose();
  4144.                     bitmap.Dispose();
  4145.                 }
  4146.             }
  4147.         }
  4148.     }
  4149.  
  4150.     #endregion
  4151.     #region Progress Indicator
  4152.  
  4153.     class iTalk_ProgressIndicator : Control
  4154.     {
  4155.  
  4156.         #region Variables
  4157.  
  4158.         private readonly SolidBrush BaseColor = new SolidBrush(Color.DarkGray);
  4159.         private readonly SolidBrush AnimationColor = new SolidBrush(Color.DimGray);
  4160.  
  4161.         private readonly Timer AnimationSpeed = new Timer();
  4162.         private PointF[] FloatPoint;
  4163.         private BufferedGraphics BuffGraphics;
  4164.         private int IndicatorIndex;
  4165.         private readonly BufferedGraphicsContext GraphicsContext = BufferedGraphicsManager.Current;
  4166.  
  4167.         #endregion
  4168.         #region Custom Properties
  4169.  
  4170.         public Color P_BaseColor
  4171.         {
  4172.             get { return BaseColor.Color; }
  4173.             set { BaseColor.Color = value; }
  4174.         }
  4175.  
  4176.         public Color P_AnimationColor
  4177.         {
  4178.             get { return AnimationColor.Color; }
  4179.             set { AnimationColor.Color = value; }
  4180.         }
  4181.  
  4182.         public int P_AnimationSpeed
  4183.         {
  4184.             get { return AnimationSpeed.Interval; }
  4185.             set { AnimationSpeed.Interval = value; }
  4186.         }
  4187.  
  4188.         #endregion
  4189.         #region EventArgs
  4190.  
  4191.         protected override void OnSizeChanged(EventArgs e)
  4192.         {
  4193.             base.OnSizeChanged(e);
  4194.             SetStandardSize();
  4195.             UpdateGraphics();
  4196.             SetPoints();
  4197.         }
  4198.  
  4199.         protected override void OnEnabledChanged(EventArgs e)
  4200.         {
  4201.             base.OnEnabledChanged(e);
  4202.             AnimationSpeed.Enabled = this.Enabled;
  4203.         }
  4204.  
  4205.         protected override void OnHandleCreated(EventArgs e)
  4206.         {
  4207.             base.OnHandleCreated(e);
  4208.             AnimationSpeed.Tick += AnimationSpeed_Tick;
  4209.             AnimationSpeed.Start();
  4210.         }
  4211.  
  4212.         private void AnimationSpeed_Tick(object sender, EventArgs e)
  4213.         {
  4214.             if (IndicatorIndex.Equals(0))
  4215.             {
  4216.                 IndicatorIndex = FloatPoint.Length - 1;
  4217.             }
  4218.             else
  4219.             {
  4220.                 IndicatorIndex -= 1;
  4221.             }
  4222.             this.Invalidate(false);
  4223.         }
  4224.  
  4225.         #endregion
  4226.  
  4227.         public iTalk_ProgressIndicator()
  4228.         {
  4229.             this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  4230.  
  4231.             Size = new Size(80, 80);
  4232.             Text = string.Empty;
  4233.             MinimumSize = new Size(80, 80);
  4234.             SetPoints();
  4235.             AnimationSpeed.Interval = 100;
  4236.         }
  4237.  
  4238.         private void SetStandardSize()
  4239.         {
  4240.             int _Size = Math.Max(Width, Height);
  4241.             Size = new Size(_Size, _Size);
  4242.         }
  4243.  
  4244.         private void SetPoints()
  4245.         {
  4246.             Stack<PointF> stack = new Stack<PointF>();
  4247.             PointF startingFloatPoint = new PointF(((float)this.Width) / 2f, ((float)this.Height) / 2f);
  4248.             for (float i = 0f; i < 360f; i += 45f)
  4249.             {
  4250.                 this.SetValue(startingFloatPoint, (int)Math.Round((double)((((double)this.Width) / 2.0) - 15.0)), (double)i);
  4251.                 PointF endPoint = this.EndPoint;
  4252.                 endPoint = new PointF(endPoint.X - 7.5f, endPoint.Y - 7.5f);
  4253.                 stack.Push(endPoint);
  4254.             }
  4255.             this.FloatPoint = stack.ToArray();
  4256.         }
  4257.  
  4258.         private void UpdateGraphics()
  4259.         {
  4260.             if ((this.Width > 0) && (this.Height > 0))
  4261.             {
  4262.                 Size size2 = new Size(this.Width + 1, this.Height + 1);
  4263.                 this.GraphicsContext.MaximumBuffer = size2;
  4264.                 this.BuffGraphics = this.GraphicsContext.Allocate(this.CreateGraphics(), this.ClientRectangle);
  4265.                 this.BuffGraphics.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
  4266.             }
  4267.         }
  4268.  
  4269.         protected override void OnPaint(PaintEventArgs e)
  4270.         {
  4271.             base.OnPaint(e);
  4272.             this.BuffGraphics.Graphics.Clear(this.BackColor);
  4273.             int num2 = this.FloatPoint.Length - 1;
  4274.             for (int i = 0; i <= num2; i++)
  4275.             {
  4276.                 if (this.IndicatorIndex == i)
  4277.                 {
  4278.                     this.BuffGraphics.Graphics.FillEllipse(this.AnimationColor, this.FloatPoint[i].X, this.FloatPoint[i].Y, 15f, 15f);
  4279.                 }
  4280.                 else
  4281.                 {
  4282.                     this.BuffGraphics.Graphics.FillEllipse(this.BaseColor, this.FloatPoint[i].X, this.FloatPoint[i].Y, 15f, 15f);
  4283.                 }
  4284.             }
  4285.             this.BuffGraphics.Render(e.Graphics);
  4286.         }
  4287.  
  4288.  
  4289.         private double Rise;
  4290.         private double Run;
  4291.         private PointF _StartingFloatPoint;
  4292.  
  4293.         private X AssignValues<X>(ref X Run, X Length)
  4294.         {
  4295.             Run = Length;
  4296.             return Length;
  4297.         }
  4298.  
  4299.         private void SetValue(PointF StartingFloatPoint, int Length, double Angle)
  4300.         {
  4301.             double CircleRadian = Math.PI * Angle / 180.0;
  4302.  
  4303.             _StartingFloatPoint = StartingFloatPoint;
  4304.             Rise = AssignValues(ref Run, Length);
  4305.             Rise = Math.Sin(CircleRadian) * Rise;
  4306.             Run = Math.Cos(CircleRadian) * Run;
  4307.         }
  4308.  
  4309.         private PointF EndPoint
  4310.         {
  4311.             get
  4312.             {
  4313.                 float LocationX = Convert.ToSingle(_StartingFloatPoint.Y + Rise);
  4314.                 float LocationY = Convert.ToSingle(_StartingFloatPoint.X + Run);
  4315.  
  4316.                 return new PointF(LocationY, LocationX);
  4317.             }
  4318.         }
  4319.     }
  4320.  
  4321.     #endregion
  4322.     #region TabControl
  4323.  
  4324.     class iTalk_TabControl : TabControl
  4325.     {
  4326.  
  4327.         // NOTE: For best quality icons/images on the TabControl; from the associated ImageList, set
  4328.         // the image size (24,24) so it can fit in the tab rectangle. However, to ensure a
  4329.         // high-quality image drawing, make sure you only add (32,32) images and not (24,24) as
  4330.         // determined in the ImageList
  4331.  
  4332.         // INFO: A free, non-commercial icon list that would fit in perfectly with the TabControl is
  4333.         // Wireframe Toolbar Icons by Gentleface. Licensed under Creative Commons Attribution.
  4334.         // Check it out from here: http://www.gentleface.com/free_icon_set.html
  4335.  
  4336.         public iTalk_TabControl()
  4337.         {
  4338.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true);
  4339.  
  4340.             DoubleBuffered = true;
  4341.             SizeMode = TabSizeMode.Fixed;
  4342.             ItemSize = new Size(44, 135);
  4343.             DrawMode = TabDrawMode.OwnerDrawFixed;
  4344.  
  4345.             foreach (TabPage Page in this.TabPages)
  4346.             {
  4347.                 Page.BackColor = Color.FromArgb(246, 246, 246);
  4348.             }
  4349.         }
  4350.  
  4351.         protected override void CreateHandle()
  4352.         {
  4353.             base.CreateHandle();
  4354.  
  4355.             base.DoubleBuffered = true;
  4356.             SizeMode = TabSizeMode.Fixed;
  4357.             Appearance = TabAppearance.Normal;
  4358.             Alignment = TabAlignment.Left;
  4359.         }
  4360.  
  4361.  
  4362.         protected override void OnControlAdded(ControlEventArgs e)
  4363.         {
  4364.             base.OnControlAdded(e);
  4365.             if (e.Control is TabPage)
  4366.             {
  4367.                 IEnumerator enumerator;
  4368.                 try
  4369.                 {
  4370.                     enumerator = this.Controls.GetEnumerator();
  4371.                     while (enumerator.MoveNext())
  4372.                     {
  4373.                         TabPage current = (TabPage)enumerator.Current;
  4374.                         current = new TabPage();
  4375.                     }
  4376.                 }
  4377.                 finally
  4378.                 {
  4379.                     e.Control.BackColor = Color.FromArgb(246, 246, 246);
  4380.                 }
  4381.             }
  4382.         }
  4383.  
  4384.         protected override void OnPaint(PaintEventArgs e)
  4385.         {
  4386.             base.OnPaint(e);
  4387.             Bitmap B = new Bitmap(Width, Height);
  4388.             Graphics G = Graphics.FromImage(B);
  4389.  
  4390.             var _Graphics = G;
  4391.  
  4392.             _Graphics.Clear(Color.FromArgb(246, 246, 246));
  4393.             _Graphics.SmoothingMode = SmoothingMode.HighSpeed;
  4394.             _Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
  4395.             _Graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
  4396.  
  4397.             // Draw tab selector background
  4398.             _Graphics.FillRectangle(new SolidBrush(Color.FromArgb(54, 57, 64)), new Rectangle(-5, 0, ItemSize.Height + 4, Height));
  4399.             // Draw vertical line at the end of the tab selector rectangle
  4400.             _Graphics.DrawLine(new Pen(Color.FromArgb(25, 26, 28)), ItemSize.Height - 1, 0, ItemSize.Height - 1, Height);
  4401.  
  4402.             for (int TabIndex = 0; TabIndex <= TabCount - 1; TabIndex++)
  4403.             {
  4404.                 if (TabIndex == SelectedIndex)
  4405.                 {
  4406.                     Rectangle TabRect = new Rectangle(new Point(GetTabRect(TabIndex).Location.X - 2, GetTabRect(TabIndex).Location.Y - 2), new Size(GetTabRect(TabIndex).Width + 3, GetTabRect(TabIndex).Height - 8));
  4407.  
  4408.                     // Draw background of the selected tab
  4409.                     _Graphics.FillRectangle(new SolidBrush(Color.FromArgb(35, 36, 38)), TabRect.X, TabRect.Y, TabRect.Width - 4, TabRect.Height + 3);
  4410.                     // Draw a tab highlighter on the background of the selected tab
  4411.                     Rectangle TabHighlighter = new Rectangle(new Point(GetTabRect(TabIndex).X - 2, GetTabRect(TabIndex).Location.Y - (TabIndex == 0 ? 1 : 1)), new Size(4, GetTabRect(TabIndex).Height - 7));
  4412.                     _Graphics.FillRectangle(new SolidBrush(Color.FromArgb(89, 169, 222)), TabHighlighter);
  4413.                     // Draw tab text
  4414.                     _Graphics.DrawString(TabPages[TabIndex].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold), new SolidBrush(Color.FromArgb(254, 255, 255)), new Rectangle(TabRect.Left + 40, TabRect.Top + 12, TabRect.Width - 40, TabRect.Height), new StringFormat { Alignment = StringAlignment.Near });
  4415.  
  4416.                     if (this.ImageList != null)
  4417.                     {
  4418.                         int Index = TabPages[TabIndex].ImageIndex;
  4419.                         if (!(Index == -1))
  4420.                         {
  4421.                             _Graphics.DrawImage(ImageList.Images[TabPages[TabIndex].ImageIndex], TabRect.X + 9, TabRect.Y + 6, 24, 24);
  4422.                         }
  4423.                     }
  4424.                 }
  4425.                 else
  4426.                 {
  4427.                     Rectangle TabRect = new Rectangle(new Point(GetTabRect(TabIndex).Location.X - 2, GetTabRect(TabIndex).Location.Y - 2), new Size(GetTabRect(TabIndex).Width + 3, GetTabRect(TabIndex).Height - 8));
  4428.                     _Graphics.DrawString(TabPages[TabIndex].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold), new SolidBrush(Color.FromArgb(159, 162, 167)), new Rectangle(TabRect.Left + 40, TabRect.Top + 12, TabRect.Width - 40, TabRect.Height), new StringFormat { Alignment = StringAlignment.Near });
  4429.  
  4430.                     if (this.ImageList != null)
  4431.                     {
  4432.                         int Index = TabPages[TabIndex].ImageIndex;
  4433.                         if (!(Index == -1))
  4434.                         {
  4435.                             _Graphics.DrawImage(ImageList.Images[TabPages[TabIndex].ImageIndex], TabRect.X + 9, TabRect.Y + 6, 24, 24);
  4436.                         }
  4437.                     }
  4438.  
  4439.                 }
  4440.             }
  4441.             e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
  4442.             e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
  4443.             e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
  4444.             e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  4445.             G.Dispose();
  4446.             B.Dispose();
  4447.         }
  4448.     }
  4449.  
  4450.     #endregion
  4451.     #region TrackBar
  4452.  
  4453.     [DefaultEvent("ValueChanged")]
  4454.     class iTalk_TrackBar : Control
  4455.     {
  4456.  
  4457.         #region Enums
  4458.  
  4459.         public enum ValueDivisor
  4460.         {
  4461.             By1 = 1,
  4462.             By10 = 10,
  4463.             By100 = 100,
  4464.             By1000 = 1000
  4465.         }
  4466.  
  4467.         #endregion
  4468.         #region Variables
  4469.  
  4470.         private GraphicsPath PipeBorder;
  4471.         private GraphicsPath TrackBarHandle;
  4472.         private Rectangle TrackBarHandleRect;
  4473.         private Rectangle ValueRect;
  4474.         private LinearGradientBrush VlaueLGB;
  4475.         private LinearGradientBrush TrackBarHandleLGB;
  4476.         private bool Cap;
  4477.  
  4478.         private int ValueDrawer;
  4479.         private int _Minimum = 0;
  4480.         private int _Maximum = 10;
  4481.         private int _Value = 0;
  4482.         private Color _ValueColour = Color.FromArgb(224, 224, 224);
  4483.         private bool _DrawHatch = true;
  4484.         private bool _DrawValueString = false;
  4485.         private bool _JumpToMouse = false;
  4486.         private ValueDivisor DividedValue = ValueDivisor.By1;
  4487.  
  4488.         #endregion
  4489.         #region Custom Properties
  4490.  
  4491.         public int Minimum
  4492.         {
  4493.             get { return _Minimum; }
  4494.  
  4495.             set
  4496.             {
  4497.                 if (value >= _Maximum)
  4498.                     value = _Maximum - 10;
  4499.                 if (_Value < value)
  4500.                     _Value = value;
  4501.  
  4502.                 _Minimum = value;
  4503.                 Invalidate();
  4504.             }
  4505.         }
  4506.  
  4507.         public int Maximum
  4508.         {
  4509.             get { return _Maximum; }
  4510.  
  4511.             set
  4512.             {
  4513.                 if (value <= _Minimum)
  4514.                     value = _Minimum + 10;
  4515.                 if (_Value > value)
  4516.                     _Value = value;
  4517.  
  4518.                 _Maximum = value;
  4519.                 Invalidate();
  4520.             }
  4521.         }
  4522.  
  4523.         public event ValueChangedEventHandler ValueChanged;
  4524.         public delegate void ValueChangedEventHandler();
  4525.         public int Value
  4526.         {
  4527.             get { return _Value; }
  4528.             set
  4529.             {
  4530.                 if (_Value != value)
  4531.                 {
  4532.                     if (value < _Minimum)
  4533.                     {
  4534.                         _Value = _Minimum;
  4535.                     }
  4536.                     else
  4537.                     {
  4538.                         if (value > _Maximum)
  4539.                         {
  4540.                             _Value = _Maximum;
  4541.                         }
  4542.                         else
  4543.                         {
  4544.                             _Value = value;
  4545.                         }
  4546.                     }
  4547.                     Invalidate();
  4548.                     if (ValueChanged != null)
  4549.                     {
  4550.                         ValueChanged();
  4551.                     }
  4552.                 }
  4553.             }
  4554.         }
  4555.  
  4556.         public ValueDivisor ValueDivison
  4557.         {
  4558.             get
  4559.             {
  4560.                 return this.DividedValue;
  4561.             }
  4562.             set
  4563.             {
  4564.                 this.DividedValue = value;
  4565.                 this.Invalidate();
  4566.             }
  4567.         }
  4568.  
  4569.         [Browsable(false)]
  4570.         public float ValueToSet
  4571.         {
  4572.             get
  4573.             {
  4574.                 return (float)(((double)this._Value) / ((double)this.DividedValue));
  4575.             }
  4576.             set
  4577.             {
  4578.                 this.Value = (int)Math.Round((double)(value * ((float)this.DividedValue)));
  4579.             }
  4580.         }
  4581.  
  4582.         public Color ValueColour
  4583.         {
  4584.             get { return _ValueColour; }
  4585.             set
  4586.             {
  4587.                 _ValueColour = value;
  4588.                 Invalidate();
  4589.             }
  4590.         }
  4591.  
  4592.         public bool DrawHatch
  4593.         {
  4594.             get { return _DrawHatch; }
  4595.             set
  4596.             {
  4597.                 _DrawHatch = value;
  4598.                 Invalidate();
  4599.             }
  4600.         }
  4601.  
  4602.         public bool DrawValueString
  4603.         {
  4604.             get { return _DrawValueString; }
  4605.             set
  4606.             {
  4607.                 _DrawValueString = value;
  4608.                 if (_DrawValueString == true)
  4609.                 {
  4610.                     Height = 40;
  4611.                 }
  4612.                 else
  4613.                 {
  4614.                     Height = 22;
  4615.                 }
  4616.                 Invalidate();
  4617.             }
  4618.         }
  4619.  
  4620.         public bool JumpToMouse
  4621.         {
  4622.             get
  4623.             {
  4624.                 return this._JumpToMouse;
  4625.             }
  4626.             set
  4627.             {
  4628.                 this._JumpToMouse = value;
  4629.             }
  4630.         }
  4631.  
  4632.         #endregion
  4633.         #region EventArgs
  4634.  
  4635.         protected override void OnMouseMove(MouseEventArgs e)
  4636.         {
  4637.             base.OnMouseMove(e);
  4638.             if ((this.Cap && (e.X > -1)) && (e.X < (this.Width + 1)))
  4639.             {
  4640.                 this.Value = this._Minimum + ((int)Math.Round((double)((this._Maximum - this._Minimum) * (((double)e.X) / ((double)this.Width)))));
  4641.             }
  4642.         }
  4643.  
  4644.         protected override void OnMouseDown(MouseEventArgs e)
  4645.         {
  4646.             base.OnMouseDown(e);
  4647.             if (e.Button == MouseButtons.Left)
  4648.             {
  4649.                 this.ValueDrawer = (int)Math.Round((double)((((double)(this._Value - this._Minimum)) / ((double)(this._Maximum - this._Minimum))) * (this.Width - 11)));
  4650.                 this.TrackBarHandleRect = new Rectangle(this.ValueDrawer, 0, 10, 20);
  4651.                 this.Cap = this.TrackBarHandleRect.Contains(e.Location);
  4652.                 if (this._JumpToMouse)
  4653.                 {
  4654.                     this.Value = this._Minimum + ((int)Math.Round((double)((this._Maximum - this._Minimum) * (((double)e.X) / ((double)this.Width)))));
  4655.                 }
  4656.             }
  4657.         }
  4658.  
  4659.         protected override void OnMouseUp(MouseEventArgs e)
  4660.         {
  4661.             base.OnMouseUp(e);
  4662.             this.Cap = false;
  4663.         }
  4664.  
  4665.  
  4666.         #endregion
  4667.  
  4668.         public iTalk_TrackBar()
  4669.         {
  4670.             SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true);
  4671.  
  4672.             _DrawHatch = true;
  4673.             Size = new Size(80, 22);
  4674.             MinimumSize = new Size(37, 22);
  4675.         }
  4676.  
  4677.         protected override void OnResize(EventArgs e)
  4678.         {
  4679.             base.OnResize(e);
  4680.             if (_DrawValueString == true)
  4681.             {
  4682.                 Height = 40;
  4683.             }
  4684.             else
  4685.             {
  4686.                 Height = 22;
  4687.             }
  4688.         }
  4689.  
  4690.         protected override void OnPaint(PaintEventArgs e)
  4691.         {
  4692.             base.OnPaint(e);
  4693.             Graphics G = e.Graphics;
  4694.             HatchBrush Hatch = new HatchBrush(HatchStyle.WideDownwardDiagonal, Color.FromArgb(20, Color.Black), Color.Transparent);
  4695.             G.Clear(Parent.BackColor);
  4696.             G.SmoothingMode = SmoothingMode.AntiAlias;
  4697.             checked
  4698.             {
  4699.                 this.PipeBorder = RoundRectangle.RoundRect(1, 6, this.Width - 3, 8, 3);
  4700.                 try
  4701.                 {
  4702.                     this.ValueDrawer = (int)Math.Round(unchecked(checked((double)(this._Value - this._Minimum) / (double)(this._Maximum - this._Minimum)) * (double)checked(this.Width - 11)));
  4703.                 }
  4704.                 catch (Exception)
  4705.                 {
  4706.                 }
  4707.                 this.TrackBarHandleRect = new Rectangle(this.ValueDrawer, 0, 10, 20);
  4708.                 G.SetClip(this.PipeBorder);
  4709.                 this.ValueRect = new Rectangle(1, 7, this.TrackBarHandleRect.X + this.TrackBarHandleRect.Width - 2, 7);
  4710.                 this.VlaueLGB = new LinearGradientBrush(this.ValueRect, this._ValueColour, this._ValueColour, 90f);
  4711.                 G.FillRectangle(this.VlaueLGB, this.ValueRect);
  4712.  
  4713.                 if (_DrawHatch == true)
  4714.                 {
  4715.                     G.FillRectangle(Hatch, this.ValueRect);
  4716.                 }
  4717.  
  4718.                 G.ResetClip();
  4719.                 G.SmoothingMode = SmoothingMode.AntiAlias;
  4720.                 G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), this.PipeBorder);
  4721.                 this.TrackBarHandle = RoundRectangle.RoundRect(this.TrackBarHandleRect, 3);
  4722.                 this.TrackBarHandleLGB = new LinearGradientBrush(this.ClientRectangle, SystemColors.Control, SystemColors.Control, 90f);
  4723.                 G.FillPath(this.TrackBarHandleLGB, this.TrackBarHandle);
  4724.                 G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), this.TrackBarHandle);
  4725.  
  4726.                 if (_DrawValueString == true)
  4727.                 {
  4728.                     G.DrawString(System.Convert.ToString(ValueToSet), Font, Brushes.Gray, 0, 25);
  4729.                 }
  4730.             }
  4731.         }
  4732.     }
  4733.  
  4734.     #endregion
  4735.     #region MenuStrip
  4736.  
  4737.     public class iTalk_MenuStrip : MenuStrip
  4738.     {
  4739.  
  4740.         public iTalk_MenuStrip()
  4741.         {
  4742.             this.Renderer = new ControlRenderer();
  4743.         }
  4744.  
  4745.         public new ControlRenderer Renderer
  4746.         {
  4747.             get { return (ControlRenderer)base.Renderer; }
  4748.             set { base.Renderer = value; }
  4749.         }
  4750.  
  4751.     }
  4752.  
  4753.     #endregion
  4754.     #region ContextMenuStrip
  4755.  
  4756.     public class iTalk_ContextMenuStrip : ContextMenuStrip
  4757.     {
  4758.  
  4759.         public iTalk_ContextMenuStrip()
  4760.         {
  4761.             this.Renderer = new ControlRenderer();
  4762.         }
  4763.  
  4764.         public new ControlRenderer Renderer
  4765.         {
  4766.             get { return (ControlRenderer)base.Renderer; }
  4767.             set { base.Renderer = value; }
  4768.         }
  4769.     }
  4770.  
  4771.     #endregion
  4772.     #region StatusStrip
  4773.  
  4774.     public class iTalk_StatusStrip : StatusStrip
  4775.     {
  4776.  
  4777.         public iTalk_StatusStrip()
  4778.         {
  4779.             this.Renderer = new ControlRenderer();
  4780.             SizingGrip = false;
  4781.         }
  4782.  
  4783.         public new ControlRenderer Renderer
  4784.         {
  4785.             get { return (ControlRenderer)base.Renderer; }
  4786.             set { base.Renderer = value; }
  4787.         }
  4788.     }
  4789.  
  4790.     #endregion
  4791.     #region Info Icon
  4792.  
  4793.     class iTalk_Icon_Info : Control
  4794.     {
  4795.         public iTalk_Icon_Info()
  4796.         {
  4797.             this.ForeColor = Color.DimGray;
  4798.             this.BackColor = Color.FromArgb(246, 246, 246);
  4799.             this.Size = new Size(33, 33);
  4800.             DoubleBuffered = true;
  4801.         }
  4802.         protected override void OnPaint(PaintEventArgs e)
  4803.         {
  4804.             e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
  4805.             e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  4806.  
  4807.             e.Graphics.FillEllipse(new SolidBrush(Color.Gray), new Rectangle(1, 1, 29, 29));
  4808.             e.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(246, 246, 246)), new Rectangle(3, 3, 25, 25));
  4809.  
  4810.             e.Graphics.DrawString("Β‘", new Font("Segoe UI", 25, FontStyle.Bold), new SolidBrush(Color.Gray), new Rectangle(4, -14, Width, 43), new StringFormat
  4811.             {
  4812.                 Alignment = StringAlignment.Near,
  4813.                 LineAlignment = StringAlignment.Near
  4814.             });
  4815.         }
  4816.     }
  4817.  
  4818.     #endregion
  4819.     #region  Tick Icon
  4820.  
  4821.     class iTalk_Icon_Tick : Control
  4822.     {
  4823.  
  4824.         public iTalk_Icon_Tick()
  4825.         {
  4826.             this.ForeColor = Color.DimGray;
  4827.             this.BackColor = Color.FromArgb(246, 246, 246);
  4828.             this.Size = new Size(33, 33);
  4829.             DoubleBuffered = true;
  4830.         }
  4831.  
  4832.         protected override void OnPaint(PaintEventArgs e)
  4833.         {
  4834.             e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
  4835.             e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  4836.  
  4837.             e.Graphics.FillEllipse(new SolidBrush(Color.Gray), new Rectangle(1, 1, 29, 29));
  4838.             e.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(246, 246, 246)), new Rectangle(3, 3, 25, 25));
  4839.  
  4840.             e.Graphics.DrawString("ΓΌ", new Font("Wingdings", 25, FontStyle.Bold), new SolidBrush(Color.Gray), new Rectangle(0, -3, Width, 43), new StringFormat
  4841.             {
  4842.                 Alignment = StringAlignment.Near,
  4843.                 LineAlignment = StringAlignment.Near
  4844.             });
  4845.         }
  4846.     }
  4847.  
  4848.     #endregion
  4849.  
  4850. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement