Advertisement
Fillestar4

c# Elite Dark Theme

Sep 11th, 2012
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 130.25 KB | None | 0 0
  1. // Create a  c# project (winforms), add a new blank class, remove preset, use this code, then build the winform project. The custom controls will be added to the toolbox. Lots of options in the properties menu. Have fun!
  2.  
  3. // by The Elite Noob
  4.  
  5. /*
  6. Add a Reference to the Visual Basic .NET Run-Time Library
  7.  
  8. In a Visual C# application, click the Project menu, and then click Add Reference.
  9. In the Component Name list, click Microsoft Visual Basic .NET Runtime to add Microsoft.VisualBasic.dll.
  10. This should remove the strings error.
  11. */
  12.  
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Drawing;
  16. using System.Drawing.Drawing2D;
  17. using System.ComponentModel;
  18. using System.Windows.Forms;
  19. using Microsoft.VisualBasic;
  20. using System.Runtime.InteropServices;
  21. using System.Collections;
  22. using System.Data;
  23. using System.Text;
  24. using System.IO;
  25. using System.Drawing.Imaging;
  26. using System.Diagnostics;
  27.  
  28. #region Themebase
  29. //------------------
  30. //Creator: aeonhack
  31. //Site: elitevs.net
  32. //Created: 08/02/2011
  33. //Changed: 12/06/2011
  34. //Version: 1.5.4
  35. //------------------
  36.  
  37. abstract class ThemeContainer154 : ContainerControl
  38. {
  39.  
  40.     #region " Initialization "
  41.  
  42.     protected Graphics G;
  43.  
  44.     protected Bitmap B;
  45.     public ThemeContainer154()
  46.     {
  47.         SetStyle((ControlStyles)139270, true);
  48.  
  49.         _ImageSize = Size.Empty;
  50.         Font = new Font("Verdana", 8);
  51.  
  52.         MeasureBitmap = new Bitmap(1, 1);
  53.         MeasureGraphics = Graphics.FromImage(MeasureBitmap);
  54.  
  55.         DrawRadialPath = new GraphicsPath();
  56.  
  57.         InvalidateCustimization();
  58.     }
  59.  
  60.     protected override void OnHandleCreated(EventArgs e)
  61.     {
  62.         if (DoneCreation)
  63.             InitializeMessages();
  64.  
  65.         InvalidateCustimization();
  66.         ColorHook();
  67.  
  68.         if (!(_LockWidth == 0))
  69.             Width = _LockWidth;
  70.         if (!(_LockHeight == 0))
  71.             Height = _LockHeight;
  72.         if (!_ControlMode)
  73.             base.Dock = DockStyle.Fill;
  74.  
  75.         Transparent = _Transparent;
  76.         if (_Transparent && _BackColor)
  77.             BackColor = Color.Transparent;
  78.  
  79.         base.OnHandleCreated(e);
  80.     }
  81.  
  82.     private bool DoneCreation;
  83.     protected override sealed void OnParentChanged(EventArgs e)
  84.     {
  85.         base.OnParentChanged(e);
  86.  
  87.         if (Parent == null)
  88.             return;
  89.         _IsParentForm = Parent is Form;
  90.  
  91.         if (!_ControlMode)
  92.         {
  93.             InitializeMessages();
  94.  
  95.             if (_IsParentForm)
  96.             {
  97.                 ParentForm.FormBorderStyle = _BorderStyle;
  98.                 ParentForm.TransparencyKey = _TransparencyKey;
  99.  
  100.                 if (!DesignMode)
  101.                 {
  102.                     ParentForm.Shown += FormShown;
  103.                 }
  104.             }
  105.  
  106.             Parent.BackColor = BackColor;
  107.         }
  108.  
  109.         OnCreation();
  110.         DoneCreation = true;
  111.         InvalidateTimer();
  112.     }
  113.  
  114.     #endregion
  115.  
  116.     private void DoAnimation(bool i)
  117.     {
  118.         OnAnimation();
  119.         if (i)
  120.             Invalidate();
  121.     }
  122.  
  123.     protected override sealed void OnPaint(PaintEventArgs e)
  124.     {
  125.         if (Width == 0 || Height == 0)
  126.             return;
  127.  
  128.         if (_Transparent && _ControlMode)
  129.         {
  130.             PaintHook();
  131.             e.Graphics.DrawImage(B, 0, 0);
  132.         }
  133.         else
  134.         {
  135.             G = e.Graphics;
  136.             PaintHook();
  137.         }
  138.     }
  139.  
  140.     protected override void OnHandleDestroyed(EventArgs e)
  141.     {
  142.         ThemeShare.RemoveAnimationCallback(DoAnimation);
  143.         base.OnHandleDestroyed(e);
  144.     }
  145.  
  146.     private bool HasShown;
  147.     private void FormShown(object sender, EventArgs e)
  148.     {
  149.         if (_ControlMode || HasShown)
  150.             return;
  151.  
  152.         if (_StartPosition == FormStartPosition.CenterParent || _StartPosition == FormStartPosition.CenterScreen)
  153.         {
  154.             Rectangle SB = Screen.PrimaryScreen.Bounds;
  155.             Rectangle CB = ParentForm.Bounds;
  156.             ParentForm.Location = new Point(SB.Width / 2 - CB.Width / 2, SB.Height / 2 - CB.Width / 2);
  157.         }
  158.  
  159.         HasShown = true;
  160.     }
  161.  
  162.  
  163.     #region " Size Handling "
  164.  
  165.     private Rectangle Frame;
  166.     protected override sealed void OnSizeChanged(EventArgs e)
  167.     {
  168.         if (_Movable && !_ControlMode)
  169.         {
  170.             Frame = new Rectangle(7, 7, Width - 14, _Header - 7);
  171.         }
  172.  
  173.         InvalidateBitmap();
  174.         Invalidate();
  175.  
  176.         base.OnSizeChanged(e);
  177.     }
  178.  
  179.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  180.     {
  181.         if (!(_LockWidth == 0))
  182.             width = _LockWidth;
  183.         if (!(_LockHeight == 0))
  184.             height = _LockHeight;
  185.         base.SetBoundsCore(x, y, width, height, specified);
  186.     }
  187.  
  188.     #endregion
  189.  
  190.     #region " State Handling "
  191.  
  192.     protected MouseState State;
  193.     private void SetState(MouseState current)
  194.     {
  195.         State = current;
  196.         Invalidate();
  197.     }
  198.  
  199.     protected override void OnMouseMove(MouseEventArgs e)
  200.     {
  201.         if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized))
  202.         {
  203.             if (_Sizable && !_ControlMode)
  204.                 InvalidateMouse();
  205.         }
  206.  
  207.         base.OnMouseMove(e);
  208.     }
  209.  
  210.     protected override void OnEnabledChanged(EventArgs e)
  211.     {
  212.         if (Enabled)
  213.             SetState(MouseState.None);
  214.         else
  215.             SetState(MouseState.Block);
  216.         base.OnEnabledChanged(e);
  217.     }
  218.  
  219.     protected override void OnMouseEnter(EventArgs e)
  220.     {
  221.         SetState(MouseState.Over);
  222.         base.OnMouseEnter(e);
  223.     }
  224.  
  225.     protected override void OnMouseUp(MouseEventArgs e)
  226.     {
  227.         SetState(MouseState.Over);
  228.         base.OnMouseUp(e);
  229.     }
  230.  
  231.     protected override void OnMouseLeave(EventArgs e)
  232.     {
  233.         SetState(MouseState.None);
  234.  
  235.         if (GetChildAtPoint(PointToClient(MousePosition)) != null)
  236.         {
  237.             if (_Sizable && !_ControlMode)
  238.             {
  239.                 Cursor = Cursors.Default;
  240.                 Previous = 0;
  241.             }
  242.         }
  243.  
  244.         base.OnMouseLeave(e);
  245.     }
  246.  
  247.     protected override void OnMouseDown(MouseEventArgs e)
  248.     {
  249.         if (e.Button == System.Windows.Forms.MouseButtons.Left)
  250.             SetState(MouseState.Down);
  251.  
  252.         if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized || _ControlMode))
  253.         {
  254.             if (_Movable && Frame.Contains(e.Location))
  255.             {
  256.                 Capture = false;
  257.                 WM_LMBUTTONDOWN = true;
  258.                 DefWndProc(ref Messages[0]);
  259.             }
  260.             else if (_Sizable && !(Previous == 0))
  261.             {
  262.                 Capture = false;
  263.                 WM_LMBUTTONDOWN = true;
  264.                 DefWndProc(ref Messages[Previous]);
  265.             }
  266.         }
  267.  
  268.         base.OnMouseDown(e);
  269.     }
  270.  
  271.     private bool WM_LMBUTTONDOWN;
  272.     protected override void WndProc(ref Message m)
  273.     {
  274.         base.WndProc(ref m);
  275.  
  276.         if (WM_LMBUTTONDOWN && m.Msg == 513)
  277.         {
  278.             WM_LMBUTTONDOWN = false;
  279.  
  280.             SetState(MouseState.Over);
  281.             if (!_SmartBounds)
  282.                 return;
  283.  
  284.             if (IsParentMdi)
  285.             {
  286.                 CorrectBounds(new Rectangle(Point.Empty, Parent.Parent.Size));
  287.             }
  288.             else
  289.             {
  290.                 CorrectBounds(Screen.FromControl(Parent).WorkingArea);
  291.             }
  292.         }
  293.     }
  294.  
  295.     private Point GetIndexPoint;
  296.     private bool B1;
  297.     private bool B2;
  298.     private bool B3;
  299.     private bool B4;
  300.     private int GetIndex()
  301.     {
  302.         GetIndexPoint = PointToClient(MousePosition);
  303.         B1 = GetIndexPoint.X < 7;
  304.         B2 = GetIndexPoint.X > Width - 7;
  305.         B3 = GetIndexPoint.Y < 7;
  306.         B4 = GetIndexPoint.Y > Height - 7;
  307.  
  308.         if (B1 && B3)
  309.             return 4;
  310.         if (B1 && B4)
  311.             return 7;
  312.         if (B2 && B3)
  313.             return 5;
  314.         if (B2 && B4)
  315.             return 8;
  316.         if (B1)
  317.             return 1;
  318.         if (B2)
  319.             return 2;
  320.         if (B3)
  321.             return 3;
  322.         if (B4)
  323.             return 6;
  324.         return 0;
  325.     }
  326.  
  327.     private int Current;
  328.     private int Previous;
  329.     private void InvalidateMouse()
  330.     {
  331.         Current = GetIndex();
  332.         if (Current == Previous)
  333.             return;
  334.  
  335.         Previous = Current;
  336.         switch (Previous)
  337.         {
  338.             case 0:
  339.                 Cursor = Cursors.Default;
  340.                 break;
  341.             case 1:
  342.             case 2:
  343.                 Cursor = Cursors.SizeWE;
  344.                 break;
  345.             case 3:
  346.             case 6:
  347.                 Cursor = Cursors.SizeNS;
  348.                 break;
  349.             case 4:
  350.             case 8:
  351.                 Cursor = Cursors.SizeNWSE;
  352.                 break;
  353.             case 5:
  354.             case 7:
  355.                 Cursor = Cursors.SizeNESW;
  356.                 break;
  357.         }
  358.     }
  359.  
  360.     private Message[] Messages = new Message[9];
  361.     private void InitializeMessages()
  362.     {
  363.         Messages[0] = Message.Create(Parent.Handle, 161, new IntPtr(2), IntPtr.Zero);
  364.         for (int I = 1; I <= 8; I++)
  365.         {
  366.             Messages[I] = Message.Create(Parent.Handle, 161, new IntPtr(I + 9), IntPtr.Zero);
  367.         }
  368.     }
  369.  
  370.     private void CorrectBounds(Rectangle bounds)
  371.     {
  372.         if (Parent.Width > bounds.Width)
  373.             Parent.Width = bounds.Width;
  374.         if (Parent.Height > bounds.Height)
  375.             Parent.Height = bounds.Height;
  376.  
  377.         int X = Parent.Location.X;
  378.         int Y = Parent.Location.Y;
  379.  
  380.         if (X < bounds.X)
  381.             X = bounds.X;
  382.         if (Y < bounds.Y)
  383.             Y = bounds.Y;
  384.  
  385.         int Width = bounds.X + bounds.Width;
  386.         int Height = bounds.Y + bounds.Height;
  387.  
  388.         if (X + Parent.Width > Width)
  389.             X = Width - Parent.Width;
  390.         if (Y + Parent.Height > Height)
  391.             Y = Height - Parent.Height;
  392.  
  393.         Parent.Location = new Point(X, Y);
  394.     }
  395.  
  396.     #endregion
  397.  
  398.  
  399.     #region " Base Properties "
  400.  
  401.     public override DockStyle Dock
  402.     {
  403.         get { return base.Dock; }
  404.         set
  405.         {
  406.             if (!_ControlMode)
  407.                 return;
  408.             base.Dock = value;
  409.         }
  410.     }
  411.  
  412.     private bool _BackColor;
  413.     [Category("Misc")]
  414.     public override Color BackColor
  415.     {
  416.         get { return base.BackColor; }
  417.         set
  418.         {
  419.             if (value == base.BackColor)
  420.                 return;
  421.  
  422.             if (!IsHandleCreated && _ControlMode && value == Color.Transparent)
  423.             {
  424.                 _BackColor = true;
  425.                 return;
  426.             }
  427.  
  428.             base.BackColor = value;
  429.             if (Parent != null)
  430.             {
  431.                 if (!_ControlMode)
  432.                     Parent.BackColor = value;
  433.                 ColorHook();
  434.             }
  435.         }
  436.     }
  437.  
  438.     public override Size MinimumSize
  439.     {
  440.         get { return base.MinimumSize; }
  441.         set
  442.         {
  443.             base.MinimumSize = value;
  444.             if (Parent != null)
  445.                 Parent.MinimumSize = value;
  446.         }
  447.     }
  448.  
  449.     public override Size MaximumSize
  450.     {
  451.         get { return base.MaximumSize; }
  452.         set
  453.         {
  454.             base.MaximumSize = value;
  455.             if (Parent != null)
  456.                 Parent.MaximumSize = value;
  457.         }
  458.     }
  459.  
  460.     public override string Text
  461.     {
  462.         get { return base.Text; }
  463.         set
  464.         {
  465.             base.Text = value;
  466.             Invalidate();
  467.         }
  468.     }
  469.  
  470.     public override Font Font
  471.     {
  472.         get { return base.Font; }
  473.         set
  474.         {
  475.             base.Font = value;
  476.             Invalidate();
  477.         }
  478.     }
  479.  
  480.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  481.     public override Color ForeColor
  482.     {
  483.         get { return Color.Empty; }
  484.         set { }
  485.     }
  486.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  487.     public override Image BackgroundImage
  488.     {
  489.         get { return null; }
  490.         set { }
  491.     }
  492.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  493.     public override ImageLayout BackgroundImageLayout
  494.     {
  495.         get { return ImageLayout.None; }
  496.         set { }
  497.     }
  498.  
  499.     #endregion
  500.  
  501.     #region " Public Properties "
  502.  
  503.     private bool _SmartBounds = true;
  504.     public bool SmartBounds
  505.     {
  506.         get { return _SmartBounds; }
  507.         set { _SmartBounds = value; }
  508.     }
  509.  
  510.     private bool _Movable = true;
  511.     public bool Movable
  512.     {
  513.         get { return _Movable; }
  514.         set { _Movable = value; }
  515.     }
  516.  
  517.     private bool _Sizable = true;
  518.     public bool Sizable
  519.     {
  520.         get { return _Sizable; }
  521.         set { _Sizable = value; }
  522.     }
  523.  
  524.     private Color _TransparencyKey;
  525.     public Color TransparencyKey
  526.     {
  527.         get
  528.         {
  529.             if (_IsParentForm && !_ControlMode)
  530.                 return ParentForm.TransparencyKey;
  531.             else
  532.                 return _TransparencyKey;
  533.         }
  534.         set
  535.         {
  536.             if (value == _TransparencyKey)
  537.                 return;
  538.             _TransparencyKey = value;
  539.  
  540.             if (_IsParentForm && !_ControlMode)
  541.             {
  542.                 ParentForm.TransparencyKey = value;
  543.                 ColorHook();
  544.             }
  545.         }
  546.     }
  547.  
  548.     private FormBorderStyle _BorderStyle;
  549.     public FormBorderStyle BorderStyle
  550.     {
  551.         get
  552.         {
  553.             if (_IsParentForm && !_ControlMode)
  554.                 return ParentForm.FormBorderStyle;
  555.             else
  556.                 return _BorderStyle;
  557.         }
  558.         set
  559.         {
  560.             _BorderStyle = value;
  561.  
  562.             if (_IsParentForm && !_ControlMode)
  563.             {
  564.                 ParentForm.FormBorderStyle = value;
  565.  
  566.                 if (!(value == FormBorderStyle.None))
  567.                 {
  568.                     Movable = false;
  569.                     Sizable = false;
  570.                 }
  571.             }
  572.         }
  573.     }
  574.  
  575.     private FormStartPosition _StartPosition;
  576.     public FormStartPosition StartPosition
  577.     {
  578.         get
  579.         {
  580.             if (_IsParentForm && !_ControlMode)
  581.                 return ParentForm.StartPosition;
  582.             else
  583.                 return _StartPosition;
  584.         }
  585.         set
  586.         {
  587.             _StartPosition = value;
  588.  
  589.             if (_IsParentForm && !_ControlMode)
  590.             {
  591.                 ParentForm.StartPosition = value;
  592.             }
  593.         }
  594.     }
  595.  
  596.     private bool _NoRounding;
  597.     public bool NoRounding
  598.     {
  599.         get { return _NoRounding; }
  600.         set
  601.         {
  602.             _NoRounding = value;
  603.             Invalidate();
  604.         }
  605.     }
  606.  
  607.     private Image _Image;
  608.     public Image Image
  609.     {
  610.         get { return _Image; }
  611.         set
  612.         {
  613.             if (value == null)
  614.                 _ImageSize = Size.Empty;
  615.             else
  616.                 _ImageSize = value.Size;
  617.  
  618.             _Image = value;
  619.             Invalidate();
  620.         }
  621.     }
  622.  
  623.     private Dictionary<string, Color> Items = new Dictionary<string, Color>();
  624.     public Bloom[] Colors
  625.     {
  626.         get
  627.         {
  628.             List<Bloom> T = new List<Bloom>();
  629.             Dictionary<string, Color>.Enumerator E = Items.GetEnumerator();
  630.  
  631.             while (E.MoveNext())
  632.             {
  633.                 T.Add(new Bloom(E.Current.Key, E.Current.Value));
  634.             }
  635.  
  636.             return T.ToArray();
  637.         }
  638.         set
  639.         {
  640.             foreach (Bloom B in value)
  641.             {
  642.                 if (Items.ContainsKey(B.Name))
  643.                     Items[B.Name] = B.Value;
  644.             }
  645.  
  646.             InvalidateCustimization();
  647.             ColorHook();
  648.             Invalidate();
  649.         }
  650.     }
  651.  
  652.     private string _Customization;
  653.     public string Customization
  654.     {
  655.         get { return _Customization; }
  656.         set
  657.         {
  658.             if (value == _Customization)
  659.                 return;
  660.  
  661.             byte[] Data = null;
  662.             Bloom[] Items = Colors;
  663.  
  664.             try
  665.             {
  666.                 Data = Convert.FromBase64String(value);
  667.                 for (int I = 0; I <= Items.Length - 1; I++)
  668.                 {
  669.                     Items[I].Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4));
  670.                 }
  671.             }
  672.             catch
  673.             {
  674.                 return;
  675.             }
  676.  
  677.             _Customization = value;
  678.  
  679.             Colors = Items;
  680.             ColorHook();
  681.             Invalidate();
  682.         }
  683.     }
  684.  
  685.     private bool _Transparent;
  686.     public bool Transparent
  687.     {
  688.         get { return _Transparent; }
  689.         set
  690.         {
  691.             _Transparent = value;
  692.             if (!(IsHandleCreated || _ControlMode))
  693.                 return;
  694.  
  695.             if (!value && !(BackColor.A == 255))
  696.             {
  697.                 throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
  698.             }
  699.  
  700.             SetStyle(ControlStyles.Opaque, !value);
  701.             SetStyle(ControlStyles.SupportsTransparentBackColor, value);
  702.  
  703.             InvalidateBitmap();
  704.             Invalidate();
  705.         }
  706.     }
  707.  
  708.     #endregion
  709.  
  710.     #region " Private Properties "
  711.  
  712.     private Size _ImageSize;
  713.     protected Size ImageSize
  714.     {
  715.         get { return _ImageSize; }
  716.     }
  717.  
  718.     private bool _IsParentForm;
  719.     protected bool IsParentForm
  720.     {
  721.         get { return _IsParentForm; }
  722.     }
  723.  
  724.     protected bool IsParentMdi
  725.     {
  726.         get
  727.         {
  728.             if (Parent == null)
  729.                 return false;
  730.             return Parent.Parent != null;
  731.         }
  732.     }
  733.  
  734.     private int _LockWidth;
  735.     protected int LockWidth
  736.     {
  737.         get { return _LockWidth; }
  738.         set
  739.         {
  740.             _LockWidth = value;
  741.             if (!(LockWidth == 0) && IsHandleCreated)
  742.                 Width = LockWidth;
  743.         }
  744.     }
  745.  
  746.     private int _LockHeight;
  747.     protected int LockHeight
  748.     {
  749.         get { return _LockHeight; }
  750.         set
  751.         {
  752.             _LockHeight = value;
  753.             if (!(LockHeight == 0) && IsHandleCreated)
  754.                 Height = LockHeight;
  755.         }
  756.     }
  757.  
  758.     private int _Header = 24;
  759.     protected int Header
  760.     {
  761.         get { return _Header; }
  762.         set
  763.         {
  764.             _Header = value;
  765.  
  766.             if (!_ControlMode)
  767.             {
  768.                 Frame = new Rectangle(7, 7, Width - 14, value - 7);
  769.                 Invalidate();
  770.             }
  771.         }
  772.     }
  773.  
  774.     private bool _ControlMode;
  775.     protected bool ControlMode
  776.     {
  777.         get { return _ControlMode; }
  778.         set
  779.         {
  780.             _ControlMode = value;
  781.  
  782.             Transparent = _Transparent;
  783.             if (_Transparent && _BackColor)
  784.                 BackColor = Color.Transparent;
  785.  
  786.             InvalidateBitmap();
  787.             Invalidate();
  788.         }
  789.     }
  790.  
  791.     private bool _IsAnimated;
  792.     protected bool IsAnimated
  793.     {
  794.         get { return _IsAnimated; }
  795.         set
  796.         {
  797.             _IsAnimated = value;
  798.             InvalidateTimer();
  799.         }
  800.     }
  801.  
  802.     #endregion
  803.  
  804.  
  805.     #region " Property Helpers "
  806.  
  807.     protected Pen GetPen(string name)
  808.     {
  809.         return new Pen(Items[name]);
  810.     }
  811.     protected Pen GetPen(string name, float width)
  812.     {
  813.         return new Pen(Items[name], width);
  814.     }
  815.  
  816.     protected SolidBrush GetBrush(string name)
  817.     {
  818.         return new SolidBrush(Items[name]);
  819.     }
  820.  
  821.     protected Color GetColor(string name)
  822.     {
  823.         return Items[name];
  824.     }
  825.  
  826.     protected void SetColor(string name, Color value)
  827.     {
  828.         if (Items.ContainsKey(name))
  829.             Items[name] = value;
  830.         else
  831.             Items.Add(name, value);
  832.     }
  833.     protected void SetColor(string name, byte r, byte g, byte b)
  834.     {
  835.         SetColor(name, Color.FromArgb(r, g, b));
  836.     }
  837.     protected void SetColor(string name, byte a, byte r, byte g, byte b)
  838.     {
  839.         SetColor(name, Color.FromArgb(a, r, g, b));
  840.     }
  841.     protected void SetColor(string name, byte a, Color value)
  842.     {
  843.         SetColor(name, Color.FromArgb(a, value));
  844.     }
  845.  
  846.     private void InvalidateBitmap()
  847.     {
  848.         if (_Transparent && _ControlMode)
  849.         {
  850.             if (Width == 0 || Height == 0)
  851.                 return;
  852.             B = new Bitmap(Width, Height, PixelFormat.Format32bppPArgb);
  853.             G = Graphics.FromImage(B);
  854.         }
  855.         else
  856.         {
  857.             G = null;
  858.             B = null;
  859.         }
  860.     }
  861.  
  862.     private void InvalidateCustimization()
  863.     {
  864.         MemoryStream M = new MemoryStream(Items.Count * 4);
  865.  
  866.         foreach (Bloom B in Colors)
  867.         {
  868.             M.Write(BitConverter.GetBytes(B.Value.ToArgb()), 0, 4);
  869.         }
  870.  
  871.         M.Close();
  872.         _Customization = Convert.ToBase64String(M.ToArray());
  873.     }
  874.  
  875.     private void InvalidateTimer()
  876.     {
  877.         if (DesignMode || !DoneCreation)
  878.             return;
  879.  
  880.         if (_IsAnimated)
  881.         {
  882.             ThemeShare.AddAnimationCallback(DoAnimation);
  883.         }
  884.         else
  885.         {
  886.             ThemeShare.RemoveAnimationCallback(DoAnimation);
  887.         }
  888.     }
  889.  
  890.     #endregion
  891.  
  892.  
  893.     #region " User Hooks "
  894.  
  895.     protected abstract void ColorHook();
  896.     protected abstract void PaintHook();
  897.  
  898.     protected virtual void OnCreation()
  899.     {
  900.     }
  901.  
  902.     protected virtual void OnAnimation()
  903.     {
  904.     }
  905.  
  906.     #endregion
  907.  
  908.  
  909.     #region " Offset "
  910.  
  911.     private Rectangle OffsetReturnRectangle;
  912.     protected Rectangle Offset(Rectangle r, int amount)
  913.     {
  914.         OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
  915.         return OffsetReturnRectangle;
  916.     }
  917.  
  918.     private Size OffsetReturnSize;
  919.     protected Size Offset(Size s, int amount)
  920.     {
  921.         OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
  922.         return OffsetReturnSize;
  923.     }
  924.  
  925.     private Point OffsetReturnPoint;
  926.     protected Point Offset(Point p, int amount)
  927.     {
  928.         OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
  929.         return OffsetReturnPoint;
  930.     }
  931.  
  932.     #endregion
  933.  
  934.     #region " Center "
  935.  
  936.  
  937.     private Point CenterReturn;
  938.     protected Point Center(Rectangle p, Rectangle c)
  939.     {
  940.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X + c.X, (p.Height / 2 - c.Height / 2) + p.Y + c.Y);
  941.         return CenterReturn;
  942.     }
  943.     protected Point Center(Rectangle p, Size c)
  944.     {
  945.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X, (p.Height / 2 - c.Height / 2) + p.Y);
  946.         return CenterReturn;
  947.     }
  948.  
  949.     protected Point Center(Rectangle child)
  950.     {
  951.         return Center(Width, Height, child.Width, child.Height);
  952.     }
  953.     protected Point Center(Size child)
  954.     {
  955.         return Center(Width, Height, child.Width, child.Height);
  956.     }
  957.     protected Point Center(int childWidth, int childHeight)
  958.     {
  959.         return Center(Width, Height, childWidth, childHeight);
  960.     }
  961.  
  962.     protected Point Center(Size p, Size c)
  963.     {
  964.         return Center(p.Width, p.Height, c.Width, c.Height);
  965.     }
  966.  
  967.     protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
  968.     {
  969.         CenterReturn = new Point(pWidth / 2 - cWidth / 2, pHeight / 2 - cHeight / 2);
  970.         return CenterReturn;
  971.     }
  972.  
  973.     #endregion
  974.  
  975.     #region " Measure "
  976.  
  977.     private Bitmap MeasureBitmap;
  978.  
  979.     private Graphics MeasureGraphics;
  980.     protected Size Measure()
  981.     {
  982.         lock (MeasureGraphics)
  983.         {
  984.             return MeasureGraphics.MeasureString(Text, Font, Width).ToSize();
  985.         }
  986.     }
  987.     protected Size Measure(string text)
  988.     {
  989.         lock (MeasureGraphics)
  990.         {
  991.             return MeasureGraphics.MeasureString(text, Font, Width).ToSize();
  992.         }
  993.     }
  994.  
  995.     #endregion
  996.  
  997.  
  998.     #region " DrawPixel "
  999.  
  1000.  
  1001.     private SolidBrush DrawPixelBrush;
  1002.     protected void DrawPixel(Color c1, int x, int y)
  1003.     {
  1004.         if (_Transparent)
  1005.         {
  1006.             B.SetPixel(x, y, c1);
  1007.         }
  1008.         else
  1009.         {
  1010.             DrawPixelBrush = new SolidBrush(c1);
  1011.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1);
  1012.         }
  1013.     }
  1014.  
  1015.     #endregion
  1016.  
  1017.     #region " DrawCorners "
  1018.  
  1019.  
  1020.     private SolidBrush DrawCornersBrush;
  1021.     protected void DrawCorners(Color c1, int offset)
  1022.     {
  1023.         DrawCorners(c1, 0, 0, Width, Height, offset);
  1024.     }
  1025.     protected void DrawCorners(Color c1, Rectangle r1, int offset)
  1026.     {
  1027.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
  1028.     }
  1029.     protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
  1030.     {
  1031.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1032.     }
  1033.  
  1034.     protected void DrawCorners(Color c1)
  1035.     {
  1036.         DrawCorners(c1, 0, 0, Width, Height);
  1037.     }
  1038.     protected void DrawCorners(Color c1, Rectangle r1)
  1039.     {
  1040.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
  1041.     }
  1042.     protected void DrawCorners(Color c1, int x, int y, int width, int height)
  1043.     {
  1044.         if (_NoRounding)
  1045.             return;
  1046.  
  1047.         if (_Transparent)
  1048.         {
  1049.             B.SetPixel(x, y, c1);
  1050.             B.SetPixel(x + (width - 1), y, c1);
  1051.             B.SetPixel(x, y + (height - 1), c1);
  1052.             B.SetPixel(x + (width - 1), y + (height - 1), c1);
  1053.         }
  1054.         else
  1055.         {
  1056.             DrawCornersBrush = new SolidBrush(c1);
  1057.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1);
  1058.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1);
  1059.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1);
  1060.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
  1061.         }
  1062.     }
  1063.  
  1064.     #endregion
  1065.  
  1066.     #region " DrawBorders "
  1067.  
  1068.     protected void DrawBorders(Pen p1, int offset)
  1069.     {
  1070.         DrawBorders(p1, 0, 0, Width, Height, offset);
  1071.     }
  1072.     protected void DrawBorders(Pen p1, Rectangle r, int offset)
  1073.     {
  1074.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
  1075.     }
  1076.     protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
  1077.     {
  1078.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1079.     }
  1080.  
  1081.     protected void DrawBorders(Pen p1)
  1082.     {
  1083.         DrawBorders(p1, 0, 0, Width, Height);
  1084.     }
  1085.     protected void DrawBorders(Pen p1, Rectangle r)
  1086.     {
  1087.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
  1088.     }
  1089.     protected void DrawBorders(Pen p1, int x, int y, int width, int height)
  1090.     {
  1091.         G.DrawRectangle(p1, x, y, width - 1, height - 1);
  1092.     }
  1093.  
  1094.     #endregion
  1095.  
  1096.     #region " DrawText "
  1097.  
  1098.     private Point DrawTextPoint;
  1099.  
  1100.     private Size DrawTextSize;
  1101.     protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
  1102.     {
  1103.         DrawText(b1, Text, a, x, y);
  1104.     }
  1105.     protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
  1106.     {
  1107.         if (text.Length == 0)
  1108.             return;
  1109.  
  1110.         DrawTextSize = Measure(text);
  1111.         DrawTextPoint = new Point(Width / 2 - DrawTextSize.Width / 2, Header / 2 - DrawTextSize.Height / 2);
  1112.  
  1113.         switch (a)
  1114.         {
  1115.             case HorizontalAlignment.Left:
  1116.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y);
  1117.                 break;
  1118.             case HorizontalAlignment.Center:
  1119.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y);
  1120.                 break;
  1121.             case HorizontalAlignment.Right:
  1122.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y);
  1123.                 break;
  1124.         }
  1125.     }
  1126.  
  1127.     protected void DrawText(Brush b1, Point p1)
  1128.     {
  1129.         if (Text.Length == 0)
  1130.             return;
  1131.         G.DrawString(Text, Font, b1, p1);
  1132.     }
  1133.     protected void DrawText(Brush b1, int x, int y)
  1134.     {
  1135.         if (Text.Length == 0)
  1136.             return;
  1137.         G.DrawString(Text, Font, b1, x, y);
  1138.     }
  1139.  
  1140.     #endregion
  1141.  
  1142.     #region " DrawImage "
  1143.  
  1144.  
  1145.     private Point DrawImagePoint;
  1146.     protected void DrawImage(HorizontalAlignment a, int x, int y)
  1147.     {
  1148.         DrawImage(_Image, a, x, y);
  1149.     }
  1150.     protected void DrawImage(Image image, HorizontalAlignment a, int x, int y)
  1151.     {
  1152.         if (image == null)
  1153.             return;
  1154.         DrawImagePoint = new Point(Width / 2 - image.Width / 2, Header / 2 - image.Height / 2);
  1155.  
  1156.         switch (a)
  1157.         {
  1158.             case HorizontalAlignment.Left:
  1159.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height);
  1160.                 break;
  1161.             case HorizontalAlignment.Center:
  1162.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height);
  1163.                 break;
  1164.             case HorizontalAlignment.Right:
  1165.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height);
  1166.                 break;
  1167.         }
  1168.     }
  1169.  
  1170.     protected void DrawImage(Point p1)
  1171.     {
  1172.         DrawImage(_Image, p1.X, p1.Y);
  1173.     }
  1174.     protected void DrawImage(int x, int y)
  1175.     {
  1176.         DrawImage(_Image, x, y);
  1177.     }
  1178.  
  1179.     protected void DrawImage(Image image, Point p1)
  1180.     {
  1181.         DrawImage(image, p1.X, p1.Y);
  1182.     }
  1183.     protected void DrawImage(Image image, int x, int y)
  1184.     {
  1185.         if (image == null)
  1186.             return;
  1187.         G.DrawImage(image, x, y, image.Width, image.Height);
  1188.     }
  1189.  
  1190.     #endregion
  1191.  
  1192.     #region " DrawGradient "
  1193.  
  1194.     private LinearGradientBrush DrawGradientBrush;
  1195.  
  1196.     private Rectangle DrawGradientRectangle;
  1197.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
  1198.     {
  1199.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1200.         DrawGradient(blend, DrawGradientRectangle);
  1201.     }
  1202.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
  1203.     {
  1204.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1205.         DrawGradient(blend, DrawGradientRectangle, angle);
  1206.     }
  1207.  
  1208.     protected void DrawGradient(ColorBlend blend, Rectangle r)
  1209.     {
  1210.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
  1211.         DrawGradientBrush.InterpolationColors = blend;
  1212.         G.FillRectangle(DrawGradientBrush, r);
  1213.     }
  1214.     protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
  1215.     {
  1216.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
  1217.         DrawGradientBrush.InterpolationColors = blend;
  1218.         G.FillRectangle(DrawGradientBrush, r);
  1219.     }
  1220.  
  1221.  
  1222.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
  1223.     {
  1224.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1225.         DrawGradient(c1, c2, DrawGradientRectangle);
  1226.     }
  1227.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
  1228.     {
  1229.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1230.         DrawGradient(c1, c2, DrawGradientRectangle, angle);
  1231.     }
  1232.  
  1233.     protected void DrawGradient(Color c1, Color c2, Rectangle r)
  1234.     {
  1235.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
  1236.         G.FillRectangle(DrawGradientBrush, r);
  1237.     }
  1238.     protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
  1239.     {
  1240.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
  1241.         G.FillRectangle(DrawGradientBrush, r);
  1242.     }
  1243.  
  1244.     #endregion
  1245.  
  1246.     #region " DrawRadial "
  1247.  
  1248.     private GraphicsPath DrawRadialPath;
  1249.     private PathGradientBrush DrawRadialBrush1;
  1250.     private LinearGradientBrush DrawRadialBrush2;
  1251.  
  1252.     private Rectangle DrawRadialRectangle;
  1253.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
  1254.     {
  1255.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1256.         DrawRadial(blend, DrawRadialRectangle, width / 2, height / 2);
  1257.     }
  1258.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
  1259.     {
  1260.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1261.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y);
  1262.     }
  1263.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
  1264.     {
  1265.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1266.         DrawRadial(blend, DrawRadialRectangle, cx, cy);
  1267.     }
  1268.  
  1269.     public void DrawRadial(ColorBlend blend, Rectangle r)
  1270.     {
  1271.         DrawRadial(blend, r, r.Width / 2, r.Height / 2);
  1272.     }
  1273.     public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
  1274.     {
  1275.         DrawRadial(blend, r, center.X, center.Y);
  1276.     }
  1277.     public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
  1278.     {
  1279.         DrawRadialPath.Reset();
  1280.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
  1281.  
  1282.         DrawRadialBrush1 = new PathGradientBrush(DrawRadialPath);
  1283.         DrawRadialBrush1.CenterPoint = new Point(r.X + cx, r.Y + cy);
  1284.         DrawRadialBrush1.InterpolationColors = blend;
  1285.  
  1286.         if (G.SmoothingMode == SmoothingMode.AntiAlias)
  1287.         {
  1288.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3);
  1289.         }
  1290.         else
  1291.         {
  1292.             G.FillEllipse(DrawRadialBrush1, r);
  1293.         }
  1294.     }
  1295.  
  1296.  
  1297.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
  1298.     {
  1299.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1300.         DrawRadial(c1, c2, DrawGradientRectangle);
  1301.     }
  1302.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
  1303.     {
  1304.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1305.         DrawRadial(c1, c2, DrawGradientRectangle, angle);
  1306.     }
  1307.  
  1308.     protected void DrawRadial(Color c1, Color c2, Rectangle r)
  1309.     {
  1310.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
  1311.         G.FillRectangle(DrawGradientBrush, r);
  1312.     }
  1313.     protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
  1314.     {
  1315.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
  1316.         G.FillEllipse(DrawGradientBrush, r);
  1317.     }
  1318.  
  1319.     #endregion
  1320.  
  1321.     #region " CreateRound "
  1322.  
  1323.     private GraphicsPath CreateRoundPath;
  1324.  
  1325.     private Rectangle CreateRoundRectangle;
  1326.     public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
  1327.     {
  1328.         CreateRoundRectangle = new Rectangle(x, y, width, height);
  1329.         return CreateRound(CreateRoundRectangle, slope);
  1330.     }
  1331.  
  1332.     public GraphicsPath CreateRound(Rectangle r, int slope)
  1333.     {
  1334.         CreateRoundPath = new GraphicsPath(FillMode.Winding);
  1335.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
  1336.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
  1337.         CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
  1338.         CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
  1339.         CreateRoundPath.CloseFigure();
  1340.         return CreateRoundPath;
  1341.     }
  1342.  
  1343.     #endregion
  1344.  
  1345. }
  1346.  
  1347. abstract class ThemeControl154 : Control
  1348. {
  1349.  
  1350.  
  1351.     #region " Initialization "
  1352.  
  1353.     protected Graphics G;
  1354.  
  1355.     protected Bitmap B;
  1356.     public ThemeControl154()
  1357.     {
  1358.         SetStyle((ControlStyles)139270, true);
  1359.  
  1360.         _ImageSize = Size.Empty;
  1361.         Font = new Font("Verdana", 8);
  1362.  
  1363.         MeasureBitmap = new Bitmap(1, 1);
  1364.         MeasureGraphics = Graphics.FromImage(MeasureBitmap);
  1365.  
  1366.         DrawRadialPath = new GraphicsPath();
  1367.  
  1368.         InvalidateCustimization();
  1369.         //Remove?
  1370.     }
  1371.  
  1372.     protected override void OnHandleCreated(EventArgs e)
  1373.     {
  1374.         InvalidateCustimization();
  1375.         ColorHook();
  1376.  
  1377.         if (!(_LockWidth == 0))
  1378.             Width = _LockWidth;
  1379.         if (!(_LockHeight == 0))
  1380.             Height = _LockHeight;
  1381.  
  1382.         Transparent = _Transparent;
  1383.         if (_Transparent && _BackColor)
  1384.             BackColor = Color.Transparent;
  1385.  
  1386.         base.OnHandleCreated(e);
  1387.     }
  1388.  
  1389.     private bool DoneCreation;
  1390.     protected override sealed void OnParentChanged(EventArgs e)
  1391.     {
  1392.         if (Parent != null)
  1393.         {
  1394.             OnCreation();
  1395.             DoneCreation = true;
  1396.             InvalidateTimer();
  1397.         }
  1398.  
  1399.         base.OnParentChanged(e);
  1400.     }
  1401.  
  1402.     #endregion
  1403.  
  1404.     private void DoAnimation(bool i)
  1405.     {
  1406.         OnAnimation();
  1407.         if (i)
  1408.             Invalidate();
  1409.     }
  1410.  
  1411.     protected override sealed void OnPaint(PaintEventArgs e)
  1412.     {
  1413.         if (Width == 0 || Height == 0)
  1414.             return;
  1415.  
  1416.         if (_Transparent)
  1417.         {
  1418.             PaintHook();
  1419.             e.Graphics.DrawImage(B, 0, 0);
  1420.         }
  1421.         else
  1422.         {
  1423.             G = e.Graphics;
  1424.             PaintHook();
  1425.         }
  1426.     }
  1427.  
  1428.     protected override void OnHandleDestroyed(EventArgs e)
  1429.     {
  1430.         ThemeShare.RemoveAnimationCallback(DoAnimation);
  1431.         base.OnHandleDestroyed(e);
  1432.     }
  1433.  
  1434.     #region " Size Handling "
  1435.  
  1436.     protected override sealed void OnSizeChanged(EventArgs e)
  1437.     {
  1438.         if (_Transparent)
  1439.         {
  1440.             InvalidateBitmap();
  1441.         }
  1442.  
  1443.         Invalidate();
  1444.         base.OnSizeChanged(e);
  1445.     }
  1446.  
  1447.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  1448.     {
  1449.         if (!(_LockWidth == 0))
  1450.             width = _LockWidth;
  1451.         if (!(_LockHeight == 0))
  1452.             height = _LockHeight;
  1453.         base.SetBoundsCore(x, y, width, height, specified);
  1454.     }
  1455.  
  1456.     #endregion
  1457.  
  1458.     #region " State Handling "
  1459.  
  1460.     private bool InPosition;
  1461.     protected override void OnMouseEnter(EventArgs e)
  1462.     {
  1463.         InPosition = true;
  1464.         SetState(MouseState.Over);
  1465.         base.OnMouseEnter(e);
  1466.     }
  1467.  
  1468.     protected override void OnMouseUp(MouseEventArgs e)
  1469.     {
  1470.         if (InPosition)
  1471.             SetState(MouseState.Over);
  1472.         base.OnMouseUp(e);
  1473.     }
  1474.  
  1475.     protected override void OnMouseDown(MouseEventArgs e)
  1476.     {
  1477.         if (e.Button == System.Windows.Forms.MouseButtons.Left)
  1478.             SetState(MouseState.Down);
  1479.         base.OnMouseDown(e);
  1480.     }
  1481.  
  1482.     protected override void OnMouseLeave(EventArgs e)
  1483.     {
  1484.         InPosition = false;
  1485.         SetState(MouseState.None);
  1486.         base.OnMouseLeave(e);
  1487.     }
  1488.  
  1489.     protected override void OnEnabledChanged(EventArgs e)
  1490.     {
  1491.         if (Enabled)
  1492.             SetState(MouseState.None);
  1493.         else
  1494.             SetState(MouseState.Block);
  1495.         base.OnEnabledChanged(e);
  1496.     }
  1497.  
  1498.     protected MouseState State;
  1499.     private void SetState(MouseState current)
  1500.     {
  1501.         State = current;
  1502.         Invalidate();
  1503.     }
  1504.  
  1505.     #endregion
  1506.  
  1507.  
  1508.     #region " Base Properties "
  1509.  
  1510.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1511.     public override Color ForeColor
  1512.     {
  1513.         get { return Color.Empty; }
  1514.         set { }
  1515.     }
  1516.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1517.     public override Image BackgroundImage
  1518.     {
  1519.         get { return null; }
  1520.         set { }
  1521.     }
  1522.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1523.     public override ImageLayout BackgroundImageLayout
  1524.     {
  1525.         get { return ImageLayout.None; }
  1526.         set { }
  1527.     }
  1528.  
  1529.     public override string Text
  1530.     {
  1531.         get { return base.Text; }
  1532.         set
  1533.         {
  1534.             base.Text = value;
  1535.             Invalidate();
  1536.         }
  1537.     }
  1538.     public override Font Font
  1539.     {
  1540.         get { return base.Font; }
  1541.         set
  1542.         {
  1543.             base.Font = value;
  1544.             Invalidate();
  1545.         }
  1546.     }
  1547.  
  1548.     private bool _BackColor;
  1549.     [Category("Misc")]
  1550.     public override Color BackColor
  1551.     {
  1552.         get { return base.BackColor; }
  1553.         set
  1554.         {
  1555.             if (!IsHandleCreated && value == Color.Transparent)
  1556.             {
  1557.                 _BackColor = true;
  1558.                 return;
  1559.             }
  1560.  
  1561.             base.BackColor = value;
  1562.             if (Parent != null)
  1563.                 ColorHook();
  1564.         }
  1565.     }
  1566.  
  1567.     #endregion
  1568.  
  1569.     #region " Public Properties "
  1570.  
  1571.     private bool _NoRounding;
  1572.     public bool NoRounding
  1573.     {
  1574.         get { return _NoRounding; }
  1575.         set
  1576.         {
  1577.             _NoRounding = value;
  1578.             Invalidate();
  1579.         }
  1580.     }
  1581.  
  1582.     private Image _Image;
  1583.     public Image Image
  1584.     {
  1585.         get { return _Image; }
  1586.         set
  1587.         {
  1588.             if (value == null)
  1589.             {
  1590.                 _ImageSize = Size.Empty;
  1591.             }
  1592.             else
  1593.             {
  1594.                 _ImageSize = value.Size;
  1595.             }
  1596.  
  1597.             _Image = value;
  1598.             Invalidate();
  1599.         }
  1600.     }
  1601.  
  1602.     private bool _Transparent;
  1603.     public bool Transparent
  1604.     {
  1605.         get { return _Transparent; }
  1606.         set
  1607.         {
  1608.             _Transparent = value;
  1609.             if (!IsHandleCreated)
  1610.                 return;
  1611.  
  1612.             if (!value && !(BackColor.A == 255))
  1613.             {
  1614.                 throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
  1615.             }
  1616.  
  1617.             SetStyle(ControlStyles.Opaque, !value);
  1618.             SetStyle(ControlStyles.SupportsTransparentBackColor, value);
  1619.  
  1620.             if (value)
  1621.                 InvalidateBitmap();
  1622.             else
  1623.                 B = null;
  1624.             Invalidate();
  1625.         }
  1626.     }
  1627.  
  1628.     private Dictionary<string, Color> Items = new Dictionary<string, Color>();
  1629.     public Bloom[] Colors
  1630.     {
  1631.         get
  1632.         {
  1633.             List<Bloom> T = new List<Bloom>();
  1634.             Dictionary<string, Color>.Enumerator E = Items.GetEnumerator();
  1635.  
  1636.             while (E.MoveNext())
  1637.             {
  1638.                 T.Add(new Bloom(E.Current.Key, E.Current.Value));
  1639.             }
  1640.  
  1641.             return T.ToArray();
  1642.         }
  1643.         set
  1644.         {
  1645.             foreach (Bloom B in value)
  1646.             {
  1647.                 if (Items.ContainsKey(B.Name))
  1648.                     Items[B.Name] = B.Value;
  1649.             }
  1650.  
  1651.             InvalidateCustimization();
  1652.             ColorHook();
  1653.             Invalidate();
  1654.         }
  1655.     }
  1656.  
  1657.     private string _Customization;
  1658.     public string Customization
  1659.     {
  1660.         get { return _Customization; }
  1661.         set
  1662.         {
  1663.             if (value == _Customization)
  1664.                 return;
  1665.  
  1666.             byte[] Data = null;
  1667.             Bloom[] Items = Colors;
  1668.  
  1669.             try
  1670.             {
  1671.                 Data = Convert.FromBase64String(value);
  1672.                 for (int I = 0; I <= Items.Length - 1; I++)
  1673.                 {
  1674.                     Items[I].Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4));
  1675.                 }
  1676.             }
  1677.             catch
  1678.             {
  1679.                 return;
  1680.             }
  1681.  
  1682.             _Customization = value;
  1683.  
  1684.             Colors = Items;
  1685.             ColorHook();
  1686.             Invalidate();
  1687.         }
  1688.     }
  1689.  
  1690.     #endregion
  1691.  
  1692.     #region " Private Properties "
  1693.  
  1694.     private Size _ImageSize;
  1695.     protected Size ImageSize
  1696.     {
  1697.         get { return _ImageSize; }
  1698.     }
  1699.  
  1700.     private int _LockWidth;
  1701.     protected int LockWidth
  1702.     {
  1703.         get { return _LockWidth; }
  1704.         set
  1705.         {
  1706.             _LockWidth = value;
  1707.             if (!(LockWidth == 0) && IsHandleCreated)
  1708.                 Width = LockWidth;
  1709.         }
  1710.     }
  1711.  
  1712.     private int _LockHeight;
  1713.     protected int LockHeight
  1714.     {
  1715.         get { return _LockHeight; }
  1716.         set
  1717.         {
  1718.             _LockHeight = value;
  1719.             if (!(LockHeight == 0) && IsHandleCreated)
  1720.                 Height = LockHeight;
  1721.         }
  1722.     }
  1723.  
  1724.     private bool _IsAnimated;
  1725.     protected bool IsAnimated
  1726.     {
  1727.         get { return _IsAnimated; }
  1728.         set
  1729.         {
  1730.             _IsAnimated = value;
  1731.             InvalidateTimer();
  1732.         }
  1733.     }
  1734.  
  1735.     #endregion
  1736.  
  1737.  
  1738.     #region " Property Helpers "
  1739.  
  1740.     protected Pen GetPen(string name)
  1741.     {
  1742.         return new Pen(Items[name]);
  1743.     }
  1744.     protected Pen GetPen(string name, float width)
  1745.     {
  1746.         return new Pen(Items[name], width);
  1747.     }
  1748.  
  1749.     protected SolidBrush GetBrush(string name)
  1750.     {
  1751.         return new SolidBrush(Items[name]);
  1752.     }
  1753.  
  1754.     protected Color GetColor(string name)
  1755.     {
  1756.         return Items[name];
  1757.     }
  1758.  
  1759.     protected void SetColor(string name, Color value)
  1760.     {
  1761.         if (Items.ContainsKey(name))
  1762.             Items[name] = value;
  1763.         else
  1764.             Items.Add(name, value);
  1765.     }
  1766.     protected void SetColor(string name, byte r, byte g, byte b)
  1767.     {
  1768.         SetColor(name, Color.FromArgb(r, g, b));
  1769.     }
  1770.     protected void SetColor(string name, byte a, byte r, byte g, byte b)
  1771.     {
  1772.         SetColor(name, Color.FromArgb(a, r, g, b));
  1773.     }
  1774.     protected void SetColor(string name, byte a, Color value)
  1775.     {
  1776.         SetColor(name, Color.FromArgb(a, value));
  1777.     }
  1778.  
  1779.     private void InvalidateBitmap()
  1780.     {
  1781.         if (Width == 0 || Height == 0)
  1782.             return;
  1783.         B = new Bitmap(Width, Height, PixelFormat.Format32bppPArgb);
  1784.         G = Graphics.FromImage(B);
  1785.     }
  1786.  
  1787.     private void InvalidateCustimization()
  1788.     {
  1789.         MemoryStream M = new MemoryStream(Items.Count * 4);
  1790.  
  1791.         foreach (Bloom B in Colors)
  1792.         {
  1793.             M.Write(BitConverter.GetBytes(B.Value.ToArgb()), 0, 4);
  1794.         }
  1795.  
  1796.         M.Close();
  1797.         _Customization = Convert.ToBase64String(M.ToArray());
  1798.     }
  1799.  
  1800.     private void InvalidateTimer()
  1801.     {
  1802.         if (DesignMode || !DoneCreation)
  1803.             return;
  1804.  
  1805.         if (_IsAnimated)
  1806.         {
  1807.             ThemeShare.AddAnimationCallback(DoAnimation);
  1808.         }
  1809.         else
  1810.         {
  1811.             ThemeShare.RemoveAnimationCallback(DoAnimation);
  1812.         }
  1813.     }
  1814.     #endregion
  1815.  
  1816.  
  1817.     #region " User Hooks "
  1818.  
  1819.     protected abstract void ColorHook();
  1820.     protected abstract void PaintHook();
  1821.  
  1822.     protected virtual void OnCreation()
  1823.     {
  1824.     }
  1825.  
  1826.     protected virtual void OnAnimation()
  1827.     {
  1828.     }
  1829.  
  1830.     #endregion
  1831.  
  1832.  
  1833.     #region " Offset "
  1834.  
  1835.     private Rectangle OffsetReturnRectangle;
  1836.     protected Rectangle Offset(Rectangle r, int amount)
  1837.     {
  1838.         OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
  1839.         return OffsetReturnRectangle;
  1840.     }
  1841.  
  1842.     private Size OffsetReturnSize;
  1843.     protected Size Offset(Size s, int amount)
  1844.     {
  1845.         OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
  1846.         return OffsetReturnSize;
  1847.     }
  1848.  
  1849.     private Point OffsetReturnPoint;
  1850.     protected Point Offset(Point p, int amount)
  1851.     {
  1852.         OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
  1853.         return OffsetReturnPoint;
  1854.     }
  1855.  
  1856.     #endregion
  1857.  
  1858.     #region " Center "
  1859.  
  1860.  
  1861.     private Point CenterReturn;
  1862.     protected Point Center(Rectangle p, Rectangle c)
  1863.     {
  1864.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X + c.X, (p.Height / 2 - c.Height / 2) + p.Y + c.Y);
  1865.         return CenterReturn;
  1866.     }
  1867.     protected Point Center(Rectangle p, Size c)
  1868.     {
  1869.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X, (p.Height / 2 - c.Height / 2) + p.Y);
  1870.         return CenterReturn;
  1871.     }
  1872.  
  1873.     protected Point Center(Rectangle child)
  1874.     {
  1875.         return Center(Width, Height, child.Width, child.Height);
  1876.     }
  1877.     protected Point Center(Size child)
  1878.     {
  1879.         return Center(Width, Height, child.Width, child.Height);
  1880.     }
  1881.     protected Point Center(int childWidth, int childHeight)
  1882.     {
  1883.         return Center(Width, Height, childWidth, childHeight);
  1884.     }
  1885.  
  1886.     protected Point Center(Size p, Size c)
  1887.     {
  1888.         return Center(p.Width, p.Height, c.Width, c.Height);
  1889.     }
  1890.  
  1891.     protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
  1892.     {
  1893.         CenterReturn = new Point(pWidth / 2 - cWidth / 2, pHeight / 2 - cHeight / 2);
  1894.         return CenterReturn;
  1895.     }
  1896.  
  1897.     #endregion
  1898.  
  1899.     #region " Measure "
  1900.  
  1901.     private Bitmap MeasureBitmap;
  1902.     //TODO: Potential issues during multi-threading.
  1903.     private Graphics MeasureGraphics;
  1904.  
  1905.     protected Size Measure()
  1906.     {
  1907.         return MeasureGraphics.MeasureString(Text, Font, Width).ToSize();
  1908.     }
  1909.     protected Size Measure(string text)
  1910.     {
  1911.         return MeasureGraphics.MeasureString(text, Font, Width).ToSize();
  1912.     }
  1913.  
  1914.     #endregion
  1915.  
  1916.  
  1917.     #region " DrawPixel "
  1918.  
  1919.  
  1920.     private SolidBrush DrawPixelBrush;
  1921.     protected void DrawPixel(Color c1, int x, int y)
  1922.     {
  1923.         if (_Transparent)
  1924.         {
  1925.             B.SetPixel(x, y, c1);
  1926.         }
  1927.         else
  1928.         {
  1929.             DrawPixelBrush = new SolidBrush(c1);
  1930.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1);
  1931.         }
  1932.     }
  1933.  
  1934.     #endregion
  1935.  
  1936.     #region " DrawCorners "
  1937.  
  1938.  
  1939.     private SolidBrush DrawCornersBrush;
  1940.     protected void DrawCorners(Color c1, int offset)
  1941.     {
  1942.         DrawCorners(c1, 0, 0, Width, Height, offset);
  1943.     }
  1944.     protected void DrawCorners(Color c1, Rectangle r1, int offset)
  1945.     {
  1946.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
  1947.     }
  1948.     protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
  1949.     {
  1950.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1951.     }
  1952.  
  1953.     protected void DrawCorners(Color c1)
  1954.     {
  1955.         DrawCorners(c1, 0, 0, Width, Height);
  1956.     }
  1957.     protected void DrawCorners(Color c1, Rectangle r1)
  1958.     {
  1959.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
  1960.     }
  1961.     protected void DrawCorners(Color c1, int x, int y, int width, int height)
  1962.     {
  1963.         if (_NoRounding)
  1964.             return;
  1965.  
  1966.         if (_Transparent)
  1967.         {
  1968.             B.SetPixel(x, y, c1);
  1969.             B.SetPixel(x + (width - 1), y, c1);
  1970.             B.SetPixel(x, y + (height - 1), c1);
  1971.             B.SetPixel(x + (width - 1), y + (height - 1), c1);
  1972.         }
  1973.         else
  1974.         {
  1975.             DrawCornersBrush = new SolidBrush(c1);
  1976.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1);
  1977.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1);
  1978.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1);
  1979.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
  1980.         }
  1981.     }
  1982.  
  1983.     #endregion
  1984.  
  1985.     #region " DrawBorders "
  1986.  
  1987.     protected void DrawBorders(Pen p1, int offset)
  1988.     {
  1989.         DrawBorders(p1, 0, 0, Width, Height, offset);
  1990.     }
  1991.     protected void DrawBorders(Pen p1, Rectangle r, int offset)
  1992.     {
  1993.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
  1994.     }
  1995.     protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
  1996.     {
  1997.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1998.     }
  1999.  
  2000.     protected void DrawBorders(Pen p1)
  2001.     {
  2002.         DrawBorders(p1, 0, 0, Width, Height);
  2003.     }
  2004.     protected void DrawBorders(Pen p1, Rectangle r)
  2005.     {
  2006.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
  2007.     }
  2008.     protected void DrawBorders(Pen p1, int x, int y, int width, int height)
  2009.     {
  2010.         G.DrawRectangle(p1, x, y, width - 1, height - 1);
  2011.     }
  2012.  
  2013.     #endregion
  2014.  
  2015.     #region " DrawText "
  2016.  
  2017.     private Point DrawTextPoint;
  2018.  
  2019.     private Size DrawTextSize;
  2020.     protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
  2021.     {
  2022.         DrawText(b1, Text, a, x, y);
  2023.     }
  2024.     protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
  2025.     {
  2026.         if (text.Length == 0)
  2027.             return;
  2028.  
  2029.         DrawTextSize = Measure(text);
  2030.         DrawTextPoint = Center(DrawTextSize);
  2031.  
  2032.         switch (a)
  2033.         {
  2034.             case HorizontalAlignment.Left:
  2035.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y);
  2036.                 break;
  2037.             case HorizontalAlignment.Center:
  2038.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y);
  2039.                 break;
  2040.             case HorizontalAlignment.Right:
  2041.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y);
  2042.                 break;
  2043.         }
  2044.     }
  2045.  
  2046.     protected void DrawText(Brush b1, Point p1)
  2047.     {
  2048.         if (Text.Length == 0)
  2049.             return;
  2050.         G.DrawString(Text, Font, b1, p1);
  2051.     }
  2052.     protected void DrawText(Brush b1, int x, int y)
  2053.     {
  2054.         if (Text.Length == 0)
  2055.             return;
  2056.         G.DrawString(Text, Font, b1, x, y);
  2057.     }
  2058.  
  2059.     #endregion
  2060.  
  2061.     #region " DrawImage "
  2062.  
  2063.  
  2064.     private Point DrawImagePoint;
  2065.     protected void DrawImage(HorizontalAlignment a, int x, int y)
  2066.     {
  2067.         DrawImage(_Image, a, x, y);
  2068.     }
  2069.     protected void DrawImage(Image image, HorizontalAlignment a, int x, int y)
  2070.     {
  2071.         if (image == null)
  2072.             return;
  2073.         DrawImagePoint = Center(image.Size);
  2074.  
  2075.         switch (a)
  2076.         {
  2077.             case HorizontalAlignment.Left:
  2078.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height);
  2079.                 break;
  2080.             case HorizontalAlignment.Center:
  2081.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height);
  2082.                 break;
  2083.             case HorizontalAlignment.Right:
  2084.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height);
  2085.                 break;
  2086.         }
  2087.     }
  2088.  
  2089.     protected void DrawImage(Point p1)
  2090.     {
  2091.         DrawImage(_Image, p1.X, p1.Y);
  2092.     }
  2093.     protected void DrawImage(int x, int y)
  2094.     {
  2095.         DrawImage(_Image, x, y);
  2096.     }
  2097.  
  2098.     protected void DrawImage(Image image, Point p1)
  2099.     {
  2100.         DrawImage(image, p1.X, p1.Y);
  2101.     }
  2102.     protected void DrawImage(Image image, int x, int y)
  2103.     {
  2104.         if (image == null)
  2105.             return;
  2106.         G.DrawImage(image, x, y, image.Width, image.Height);
  2107.     }
  2108.  
  2109.     #endregion
  2110.  
  2111.     #region " DrawGradient "
  2112.  
  2113.     private LinearGradientBrush DrawGradientBrush;
  2114.  
  2115.     private Rectangle DrawGradientRectangle;
  2116.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
  2117.     {
  2118.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2119.         DrawGradient(blend, DrawGradientRectangle);
  2120.     }
  2121.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
  2122.     {
  2123.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2124.         DrawGradient(blend, DrawGradientRectangle, angle);
  2125.     }
  2126.  
  2127.     protected void DrawGradient(ColorBlend blend, Rectangle r)
  2128.     {
  2129.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
  2130.         DrawGradientBrush.InterpolationColors = blend;
  2131.         G.FillRectangle(DrawGradientBrush, r);
  2132.     }
  2133.     protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
  2134.     {
  2135.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
  2136.         DrawGradientBrush.InterpolationColors = blend;
  2137.         G.FillRectangle(DrawGradientBrush, r);
  2138.     }
  2139.  
  2140.  
  2141.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
  2142.     {
  2143.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2144.         DrawGradient(c1, c2, DrawGradientRectangle);
  2145.     }
  2146.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
  2147.     {
  2148.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2149.         DrawGradient(c1, c2, DrawGradientRectangle, angle);
  2150.     }
  2151.  
  2152.     protected void DrawGradient(Color c1, Color c2, Rectangle r)
  2153.     {
  2154.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
  2155.         G.FillRectangle(DrawGradientBrush, r);
  2156.     }
  2157.     protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
  2158.     {
  2159.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
  2160.         G.FillRectangle(DrawGradientBrush, r);
  2161.     }
  2162.  
  2163.     #endregion
  2164.  
  2165.     #region " DrawRadial "
  2166.  
  2167.     private GraphicsPath DrawRadialPath;
  2168.     private PathGradientBrush DrawRadialBrush1;
  2169.     private LinearGradientBrush DrawRadialBrush2;
  2170.  
  2171.     private Rectangle DrawRadialRectangle;
  2172.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
  2173.     {
  2174.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2175.         DrawRadial(blend, DrawRadialRectangle, width / 2, height / 2);
  2176.     }
  2177.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
  2178.     {
  2179.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2180.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y);
  2181.     }
  2182.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
  2183.     {
  2184.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2185.         DrawRadial(blend, DrawRadialRectangle, cx, cy);
  2186.     }
  2187.  
  2188.     public void DrawRadial(ColorBlend blend, Rectangle r)
  2189.     {
  2190.         DrawRadial(blend, r, r.Width / 2, r.Height / 2);
  2191.     }
  2192.     public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
  2193.     {
  2194.         DrawRadial(blend, r, center.X, center.Y);
  2195.     }
  2196.     public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
  2197.     {
  2198.         DrawRadialPath.Reset();
  2199.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
  2200.  
  2201.         DrawRadialBrush1 = new PathGradientBrush(DrawRadialPath);
  2202.         DrawRadialBrush1.CenterPoint = new Point(r.X + cx, r.Y + cy);
  2203.         DrawRadialBrush1.InterpolationColors = blend;
  2204.  
  2205.         if (G.SmoothingMode == SmoothingMode.AntiAlias)
  2206.         {
  2207.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3);
  2208.         }
  2209.         else
  2210.         {
  2211.             G.FillEllipse(DrawRadialBrush1, r);
  2212.         }
  2213.     }
  2214.  
  2215.  
  2216.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
  2217.     {
  2218.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2219.         DrawRadial(c1, c2, DrawRadialRectangle);
  2220.     }
  2221.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
  2222.     {
  2223.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2224.         DrawRadial(c1, c2, DrawRadialRectangle, angle);
  2225.     }
  2226.  
  2227.     protected void DrawRadial(Color c1, Color c2, Rectangle r)
  2228.     {
  2229.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
  2230.         G.FillEllipse(DrawRadialBrush2, r);
  2231.     }
  2232.     protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
  2233.     {
  2234.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
  2235.         G.FillEllipse(DrawRadialBrush2, r);
  2236.     }
  2237.  
  2238.     #endregion
  2239.  
  2240.     #region " CreateRound "
  2241.  
  2242.     private GraphicsPath CreateRoundPath;
  2243.  
  2244.     private Rectangle CreateRoundRectangle;
  2245.     public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
  2246.     {
  2247.         CreateRoundRectangle = new Rectangle(x, y, width, height);
  2248.         return CreateRound(CreateRoundRectangle, slope);
  2249.     }
  2250.  
  2251.     public GraphicsPath CreateRound(Rectangle r, int slope)
  2252.     {
  2253.         CreateRoundPath = new GraphicsPath(FillMode.Winding);
  2254.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
  2255.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
  2256.         CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
  2257.         CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
  2258.         CreateRoundPath.CloseFigure();
  2259.         return CreateRoundPath;
  2260.     }
  2261.  
  2262.     #endregion
  2263.  
  2264. }
  2265.  
  2266. static class ThemeShare
  2267. {
  2268.  
  2269.     #region " Animation "
  2270.  
  2271.     private static int Frames;
  2272.     private static bool Invalidate;
  2273.  
  2274.     public static PrecisionTimer ThemeTimer = new PrecisionTimer();
  2275.     //1000 / 50 = 20 FPS
  2276.     private const int FPS = 50;
  2277.  
  2278.     private const int Rate = 10;
  2279.     public delegate void AnimationDelegate(bool invalidate);
  2280.  
  2281.  
  2282.     private static List<AnimationDelegate> Callbacks = new List<AnimationDelegate>();
  2283.     private static void HandleCallbacks(IntPtr state, bool reserve)
  2284.     {
  2285.         Invalidate = (Frames >= FPS);
  2286.         if (Invalidate)
  2287.             Frames = 0;
  2288.  
  2289.         lock (Callbacks)
  2290.         {
  2291.             for (int I = 0; I <= Callbacks.Count - 1; I++)
  2292.             {
  2293.                 Callbacks[I].Invoke(Invalidate);
  2294.             }
  2295.         }
  2296.  
  2297.         Frames += Rate;
  2298.     }
  2299.  
  2300.     private static void InvalidateThemeTimer()
  2301.     {
  2302.         if (Callbacks.Count == 0)
  2303.         {
  2304.             ThemeTimer.Delete();
  2305.         }
  2306.         else
  2307.         {
  2308.             ThemeTimer.Create(0, Rate, HandleCallbacks);
  2309.         }
  2310.     }
  2311.  
  2312.     public static void AddAnimationCallback(AnimationDelegate callback)
  2313.     {
  2314.         lock (Callbacks)
  2315.         {
  2316.             if (Callbacks.Contains(callback))
  2317.                 return;
  2318.  
  2319.             Callbacks.Add(callback);
  2320.             InvalidateThemeTimer();
  2321.         }
  2322.     }
  2323.  
  2324.     public static void RemoveAnimationCallback(AnimationDelegate callback)
  2325.     {
  2326.         lock (Callbacks)
  2327.         {
  2328.             if (!Callbacks.Contains(callback))
  2329.                 return;
  2330.  
  2331.             Callbacks.Remove(callback);
  2332.             InvalidateThemeTimer();
  2333.         }
  2334.     }
  2335.  
  2336.     #endregion
  2337.  
  2338. }
  2339.  
  2340. enum MouseState : byte
  2341. {
  2342.     None = 0,
  2343.     Over = 1,
  2344.     Down = 2,
  2345.     Block = 3
  2346. }
  2347.  
  2348. struct Bloom
  2349. {
  2350.  
  2351.     public string _Name;
  2352.     public string Name
  2353.     {
  2354.         get { return _Name; }
  2355.     }
  2356.  
  2357.     private Color _Value;
  2358.     public Color Value
  2359.     {
  2360.         get { return _Value; }
  2361.         set { _Value = value; }
  2362.     }
  2363.  
  2364.     public string ValueHex
  2365.     {
  2366.         get { return string.Concat("#", _Value.R.ToString("X2", null), _Value.G.ToString("X2", null), _Value.B.ToString("X2", null)); }
  2367.         set
  2368.         {
  2369.             try
  2370.             {
  2371.                 _Value = ColorTranslator.FromHtml(value);
  2372.             }
  2373.             catch
  2374.             {
  2375.                 return;
  2376.             }
  2377.         }
  2378.     }
  2379.  
  2380.  
  2381.     public Bloom(string name, Color value)
  2382.     {
  2383.         _Name = name;
  2384.         _Value = value;
  2385.     }
  2386. }
  2387.  
  2388. //------------------
  2389. //Creator: aeonhack
  2390. //Site: elitevs.net
  2391. //Created: 11/30/2011
  2392. //Changed: 11/30/2011
  2393. //Version: 1.0.0
  2394. //------------------
  2395. class PrecisionTimer : IDisposable
  2396. {
  2397.  
  2398.     private bool _Enabled;
  2399.     public bool Enabled
  2400.     {
  2401.         get { return _Enabled; }
  2402.     }
  2403.  
  2404.     private IntPtr Handle;
  2405.  
  2406.     private TimerDelegate TimerCallback;
  2407.     [DllImport("kernel32.dll", EntryPoint = "CreateTimerQueueTimer")]
  2408.     private static extern bool CreateTimerQueueTimer(ref IntPtr handle, IntPtr queue, TimerDelegate callback, IntPtr state, uint dueTime, uint period, uint flags);
  2409.  
  2410.     [DllImport("kernel32.dll", EntryPoint = "DeleteTimerQueueTimer")]
  2411.     private static extern bool DeleteTimerQueueTimer(IntPtr queue, IntPtr handle, IntPtr callback);
  2412.  
  2413.     public delegate void TimerDelegate(IntPtr r1, bool r2);
  2414.  
  2415.     public void Create(uint dueTime, uint period, TimerDelegate callback)
  2416.     {
  2417.         if (_Enabled)
  2418.             return;
  2419.  
  2420.         TimerCallback = callback;
  2421.         bool Success = CreateTimerQueueTimer(ref Handle, IntPtr.Zero, TimerCallback, IntPtr.Zero, dueTime, period, 0);
  2422.  
  2423.         if (!Success)
  2424.             ThrowNewException("CreateTimerQueueTimer");
  2425.         _Enabled = Success;
  2426.     }
  2427.  
  2428.     public void Delete()
  2429.     {
  2430.         if (!_Enabled)
  2431.             return;
  2432.         bool Success = DeleteTimerQueueTimer(IntPtr.Zero, Handle, IntPtr.Zero);
  2433.  
  2434.         if (!Success && !(Marshal.GetLastWin32Error() == 997))
  2435.         {
  2436.             ThrowNewException("DeleteTimerQueueTimer");
  2437.         }
  2438.  
  2439.         _Enabled = !Success;
  2440.     }
  2441.  
  2442.     private void ThrowNewException(string name)
  2443.     {
  2444.         throw new Exception(string.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error()));
  2445.     }
  2446.  
  2447.     public void Dispose()
  2448.     {
  2449.         Delete();
  2450.     }
  2451. }
  2452. #endregion
  2453.  
  2454. #region "Credits"
  2455. ///<---------------------///
  2456. ///<Creator TheEliteNoob>
  2457. ///<Site:   myxkcd.co.cc>
  2458. ///<Created:   13-2-2012>
  2459. ///<Theme Base:    1.5.4>
  2460. ///<---------------------///
  2461. ///
  2462. #endregion
  2463.  
  2464. ///<============================================================>
  2465. ///<                     Start The Theme!                       >
  2466. ///<============================================================>
  2467.  
  2468. #region Enums for Options
  2469. public enum MultiColor
  2470. {
  2471.     Black = 0,
  2472.     Green = 1,
  2473.     Blue = 2,
  2474.     Pink = 3
  2475. }
  2476.  
  2477. public enum HoverOptions
  2478. {
  2479.     Green = 0,
  2480.     Blue = 1,
  2481.     Pink = 2
  2482. }
  2483.  
  2484. public enum HatchColors
  2485. {
  2486.     White = 0,
  2487.     Green = 1,
  2488.     Blue = 2,
  2489.     Pink = 3
  2490. }
  2491.  
  2492. public enum IsHatched
  2493. {
  2494.     Yes = 0,
  2495.     No = 1
  2496. }
  2497. #endregion
  2498.  
  2499. #region Theme
  2500. class genesisTheme : ThemeContainer154 // White hatch color
  2501. {
  2502.     #region Text Location
  2503.     public enum TextLocation
  2504.     {
  2505.         Left = 0, //if there isn't an icon
  2506.         LeftIcon = 1, //if there is an icon
  2507.         Center = 2,
  2508.         CenterIcon = 3
  2509.     }
  2510.  
  2511.     TextLocation _location;
  2512.  
  2513.     public TextLocation TextPlacement
  2514.     {
  2515.         get
  2516.         {
  2517.             return this._location;
  2518.         }
  2519.         set
  2520.         {
  2521.             this._location = value;
  2522.             Invalidate();
  2523.         }
  2524.     }
  2525.  
  2526.     MultiColor _textcolor;
  2527.  
  2528.     public MultiColor TextColor
  2529.     {
  2530.         get
  2531.         {
  2532.             return this._textcolor;
  2533.         }
  2534.         set
  2535.         {
  2536.             this._textcolor = value;
  2537.             Invalidate();
  2538.         }
  2539.     }
  2540.  
  2541.     #endregion
  2542.  
  2543.     #region Hatch Options
  2544.     HatchColors _color;
  2545.  
  2546.     public HatchColors CurrentColor
  2547.     {
  2548.         get
  2549.         {
  2550.             return this._color;
  2551.         }
  2552.         set
  2553.         {
  2554.             this._color = value;
  2555.             Invalidate();
  2556.         }
  2557.     }
  2558.  
  2559.     IsHatched _yesno;
  2560.  
  2561.     public IsHatched HatchONOff
  2562.     {
  2563.         get
  2564.         {
  2565.             return this._yesno;
  2566.         }
  2567.         set
  2568.         {
  2569.             this._yesno = value;
  2570.             Invalidate();
  2571.         }
  2572.     }
  2573.     #endregion
  2574.  
  2575.     #region IconSettings
  2576.     private Icon IconLocation;
  2577.     public Icon CustomIcon
  2578.     {
  2579.         get
  2580.         {
  2581.             return IconLocation;
  2582.         }
  2583.         set
  2584.         {
  2585.             IconLocation = value;
  2586.         }
  2587.     }
  2588.  
  2589.     public enum UseIcon
  2590.     {
  2591.         No = 0,
  2592.         Yes = 1
  2593.     }
  2594.  
  2595.     UseIcon _iconyesno;
  2596.  
  2597.     public UseIcon UseAnIcon
  2598.     {
  2599.         get
  2600.         {
  2601.             return this._iconyesno;
  2602.         }
  2603.         set
  2604.         {
  2605.             this._iconyesno = value;
  2606.             Invalidate();
  2607.         }
  2608.     }
  2609.     #endregion
  2610.  
  2611.     public genesisTheme()
  2612.     {
  2613.         BackColor = Color.FromArgb(250, 250, 250);
  2614.         SetColor("Back", 250, 250, 250);
  2615.         SetColor("Gradient1", 254, 254, 254);
  2616.         SetColor("Gradient2", 243, 243, 243);
  2617.         SetColor("Border1", 240, 240, 240);
  2618.         SetColor("Border2", 254, 254, 254);
  2619.         SetColor("Border3", 200, 200, 200);
  2620.         SetColor("Line1", 250, 250, 250);
  2621.         SetColor("Line2", 240, 240, 240);
  2622.         SetColor("Shade1", 70, Color.White);
  2623.         SetColor("Shade2", Color.Transparent);
  2624.     }
  2625.  
  2626.     private Color C1;
  2627.     private Color C2;
  2628.     private Color C3;
  2629.     private Color C4;
  2630.     private Color C5;
  2631.     private Pen P1;
  2632.     private Pen P2;
  2633.     private Pen P3;
  2634.     private Pen P4;
  2635.     private Pen P5;
  2636.     private HatchBrush B1;
  2637.     private SolidBrush B2;
  2638.  
  2639.     protected override void ColorHook()
  2640.     {
  2641.         C1 = GetColor("Back");
  2642.         C2 = GetColor("Gradient1");
  2643.         C3 = GetColor("Gradient2");
  2644.         C4 = GetColor("Shade1");
  2645.         C5 = GetColor("Shade2");
  2646.         P1 = new Pen(GetColor("Border1"));
  2647.         P2 = new Pen(GetColor("Line1"));
  2648.         P3 = new Pen(GetColor("Line2"));
  2649.         P4 = new Pen(GetColor("Border2"));
  2650.         P5 = new Pen(GetColor("Border3"));
  2651.         BackColor = C1;
  2652.     }
  2653.  
  2654.     private Rectangle RT1;
  2655.     protected override void PaintHook()
  2656.     {
  2657.         G.Clear(C1);
  2658.         RT1 = new Rectangle(1, 1, Width - 2, 22);
  2659.         DrawGradient(C2, C3, RT1, 90f);
  2660.         DrawBorders(P1, RT1);
  2661.         G.DrawLine(P2, 0, 23, Width, 23);
  2662.         switch (_yesno)
  2663.         {
  2664.             case IsHatched.Yes:
  2665.                 switch (_color)
  2666.                 {
  2667.                     case HatchColors.White:
  2668.                         SetColor("Hatch1", 254, 254, 254);
  2669.                         SetColor("Hatch2", 248, 248, 248);
  2670.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  2671.                         break;
  2672.                     case HatchColors.Blue:
  2673.                         SetColor("Hatch1", 78, 205, 196);
  2674.                         SetColor("Hatch2", 72, 199, 190);
  2675.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  2676.                         break;
  2677.                     case HatchColors.Green:
  2678.                         SetColor("Hatch1", 199, 244, 100);
  2679.                         SetColor("Hatch2", 193, 238, 94);
  2680.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  2681.                         break;
  2682.                     case HatchColors.Pink:
  2683.                         SetColor("Hatch1", 255, 107, 107);
  2684.                         SetColor("Hatch2", 249, 101, 101);
  2685.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  2686.                         break;
  2687.                 }
  2688.                 break;
  2689.             case IsHatched.No:
  2690.                 switch (_color)
  2691.                 {
  2692.                     case HatchColors.White:
  2693.                         SetColor("Hatch1", 254, 254, 254);
  2694.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  2695.                         break;
  2696.                     case HatchColors.Blue:
  2697.                         SetColor("Hatch1", 78, 205, 196);
  2698.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  2699.                         break;
  2700.                     case HatchColors.Green:
  2701.                         SetColor("Hatch1", 199, 244, 100);
  2702.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  2703.                         break;
  2704.                     case HatchColors.Pink:
  2705.                         SetColor("Hatch1", 255, 107, 107);
  2706.                         SetColor("Hatch2", 249, 101, 101);
  2707.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  2708.                         break;
  2709.                 }
  2710.                 break;
  2711.         }
  2712.         switch (_textcolor)
  2713.         {
  2714.             case MultiColor.Black:
  2715.                 SetColor("Text", 24, 24, 24);
  2716.                 B2 = new SolidBrush(GetColor("Text"));
  2717.                 break;
  2718.             case MultiColor.Blue:
  2719.                 SetColor("Text", 78, 205, 196);
  2720.                 B2 = new SolidBrush(GetColor("Text"));
  2721.                 break;
  2722.             case MultiColor.Green:
  2723.                 SetColor("Text", 199, 244, 100);
  2724.                 B2 = new SolidBrush(GetColor("Text"));
  2725.                 break;
  2726.             case MultiColor.Pink:
  2727.                 SetColor("Text", 255, 107, 107);
  2728.                 B2 = new SolidBrush(GetColor("Text"));
  2729.                 break;
  2730.         }
  2731.         G.FillRectangle(B1, 0, 24, Width, 13);
  2732.         DrawGradient(C4, C5, 0, 24, Width, 6);
  2733.         G.DrawLine(P3, 0, 37, Width, 37);
  2734.         DrawBorders(P4, 1, 38, Width - 2, Height - 39);
  2735.         switch (_iconyesno)
  2736.         {
  2737.             case UseIcon.Yes:
  2738.                 Icon ico = new Icon(IconLocation, new Size(16, 16));
  2739.                 switch (_location)
  2740.                 {
  2741.                     case TextLocation.Left:
  2742.                         DrawText(B2, HorizontalAlignment.Left, 1, -2);
  2743.                         break;
  2744.                     case TextLocation.LeftIcon:
  2745.                         G.DrawIconUnstretched(((System.Drawing.Icon)(ico)), ((Rectangle)(RT1)));
  2746.                         DrawText(B2, HorizontalAlignment.Left, 18, -2);
  2747.                         break;
  2748.                     case TextLocation.Center:
  2749.                         DrawText(B2, HorizontalAlignment.Center, 0, -2);
  2750.                         break;
  2751.                     case TextLocation.CenterIcon:
  2752.                         G.DrawIconUnstretched(((System.Drawing.Icon)(ico)), ((Rectangle)(RT1)));
  2753.                         DrawText(B2, HorizontalAlignment.Center, 0, -2);
  2754.                         break;
  2755.                 }
  2756.                 break;
  2757.             case UseIcon.No:
  2758.                 switch (_location)
  2759.                 {
  2760.                     case TextLocation.Left:
  2761.                         DrawText(B2, HorizontalAlignment.Left, 1, -2);
  2762.                         break;
  2763.                     case TextLocation.LeftIcon:
  2764.                         DrawText(B2, HorizontalAlignment.Left, 1, -2);
  2765.                         break;
  2766.                     case TextLocation.Center:
  2767.                         DrawText(B2, HorizontalAlignment.Center, 0, -2);
  2768.                         break;
  2769.                     case TextLocation.CenterIcon:
  2770.                         DrawText(B2, HorizontalAlignment.Center, 0, -2);
  2771.                         break;
  2772.                 }
  2773.                 break;
  2774.         }
  2775.         DrawBorders(P5);
  2776.     }
  2777. }
  2778. #endregion
  2779.  
  2780. #region Button
  2781. class genesisButton : ThemeControl154 /// <The Button has 4 colors defined!>
  2782. {
  2783.  
  2784.     MultiColor _color;
  2785.  
  2786.     public MultiColor CurrentColor
  2787.     {
  2788.         get
  2789.         {
  2790.             return this._color;
  2791.         }
  2792.         set
  2793.         {
  2794.             this._color = value;
  2795.             Invalidate();
  2796.         }
  2797.     }
  2798.  
  2799.     public genesisButton()
  2800.     {
  2801.         SetColor("DownGradient1", 252, 252, 252);
  2802.         SetColor("DownGradient2", 238, 238, 238);
  2803.         SetColor("NoneGradient1", 240, 240, 240);
  2804.         SetColor("NoneGradient2", 254, 254, 254);
  2805.         SetColor("HoverGradient1", 238, 238, 238);
  2806.         SetColor("HoverGradient2", 252, 252, 252);
  2807.         SetColor("TextShade", 30, 35, 35, 35);
  2808.         SetColor("Border1", 225, 225, 225);
  2809.         SetColor("Border2", 235, 235, 235);
  2810.     }
  2811.  
  2812.     private Color C1;
  2813.     private Color C2;
  2814.     private Color C3;
  2815.     private Color C4;
  2816.     private Color C5;
  2817.     private Color C6;
  2818.     private SolidBrush B1;
  2819.     private SolidBrush B2;
  2820.     private Pen P1;
  2821.     private Pen P2;
  2822.  
  2823.     protected override void ColorHook()
  2824.     {
  2825.         C1 = GetColor("DownGradient1");
  2826.         C2 = GetColor("DownGradient2");
  2827.         C3 = GetColor("NoneGradient1");
  2828.         C4 = GetColor("NoneGradient2");
  2829.         C5 = GetColor("HoverGradient1");
  2830.         C6 = GetColor("HoverGradient2");
  2831.         B1 = new SolidBrush(GetColor("TextShade"));
  2832.         P1 = new Pen(GetColor("Border1"));
  2833.         P2 = new Pen(GetColor("Border2"));
  2834.     }
  2835.  
  2836.  
  2837.     protected override void PaintHook()
  2838.     {
  2839.         if (State == MouseState.Down)
  2840.         {
  2841.             DrawGradient(C2, C1, ClientRectangle, 90f);
  2842.         }
  2843.         else if (State == MouseState.Over)
  2844.         {
  2845.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2846.         }
  2847.         else
  2848.         {
  2849.             DrawGradient(C4, C3, ClientRectangle, 90f);
  2850.         }
  2851.         DrawBorders(P1, 1);
  2852.         DrawBorders(P2);
  2853.         DrawCorners(BackColor);
  2854.         switch (_color)
  2855.         {
  2856.             case MultiColor.Black:
  2857.                 SetColor("Text", 24, 24, 24);
  2858.                 B2 = new SolidBrush(GetColor("Text"));
  2859.                 break;
  2860.             case MultiColor.Blue:
  2861.                 SetColor("Text", 78, 205, 196);
  2862.                 B2 = new SolidBrush(GetColor("Text"));
  2863.                 break;
  2864.             case MultiColor.Green:
  2865.                 SetColor("Text", 199, 244, 100);
  2866.                 B2 = new SolidBrush(GetColor("Text"));
  2867.                 break;
  2868.             case MultiColor.Pink:
  2869.                 SetColor("Text", 255, 107, 107);
  2870.                 B2 = new SolidBrush(GetColor("Text"));
  2871.                 break;
  2872.         }
  2873.         DrawText(B1, HorizontalAlignment.Center, 1, 1);
  2874.         DrawText(B2, HorizontalAlignment.Center, 0, 0);
  2875.     }
  2876.  
  2877. }
  2878. #endregion
  2879.  
  2880. #region Label
  2881. public partial class genesisLabel : Label /// <The Label has 4 colors defined!>
  2882. {
  2883.     #region Public Constructors
  2884.  
  2885.     MultiColor _color;
  2886.  
  2887.     public MultiColor CurrentColor
  2888.     {
  2889.         get
  2890.         {
  2891.             return this._color;
  2892.         }
  2893.         set
  2894.         {
  2895.             this._color = value;
  2896.             Invalidate();
  2897.         }
  2898.     }
  2899.  
  2900.     public genesisLabel()
  2901.     {
  2902.         this.AutoSize = false;
  2903.     }
  2904.  
  2905.     #endregion  Public Constructors
  2906.  
  2907.     #region  Protected Overridden Methods
  2908.  
  2909.     protected override void OnPaint(PaintEventArgs e)
  2910.     {
  2911.         base.OnPaint(e);
  2912.         switch (_color)
  2913.         {
  2914.             case MultiColor.Black:
  2915.                 this.ForeColor = Color.FromArgb(24, 24, 24);
  2916.                 break;
  2917.             case MultiColor.Blue:
  2918.                 this.ForeColor = Color.FromArgb(78, 205, 196);
  2919.                 break;
  2920.             case MultiColor.Green:
  2921.                 this.ForeColor = Color.FromArgb(199, 244, 100);
  2922.                 break;
  2923.             case MultiColor.Pink:
  2924.                 this.ForeColor = Color.FromArgb(255, 107, 107);
  2925.                 break;
  2926.         }
  2927.     }
  2928.  
  2929.     protected override void OnResize(EventArgs e)
  2930.     {
  2931.         base.OnResize(e);
  2932.  
  2933.         this.FitToContents();
  2934.     }
  2935.  
  2936.     protected override void OnTextChanged(EventArgs e)
  2937.     {
  2938.         base.OnTextChanged(e);
  2939.  
  2940.         this.FitToContents();
  2941.     }
  2942.  
  2943.     #endregion  Protected Overridden Methods
  2944.  
  2945.     #region  Protected Virtual Methods
  2946.  
  2947.     protected virtual void FitToContents()
  2948.     {
  2949.         Size size;
  2950.  
  2951.         size = this.GetPreferredSize(new Size(this.Width, 0));
  2952.  
  2953.         this.Height = size.Height;
  2954.     }
  2955.  
  2956.     #endregion  Protected Virtual Methods
  2957.  
  2958.     #region  Public Properties
  2959.  
  2960.     [DefaultValue(false), Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  2961.     public override bool AutoSize
  2962.     {
  2963.         get { return base.AutoSize; }
  2964.         set { base.AutoSize = value; }
  2965.     }
  2966.  
  2967.     #endregion  Public Properties
  2968. }
  2969. #endregion
  2970.  
  2971. #region Draw Class
  2972. public class Draw
  2973. {
  2974.     public static void Gradient(Graphics g, Color c1, Color c2, int x, int y, int width, int height)
  2975.     {
  2976.         Rectangle R = new Rectangle(x, y, width, height);
  2977.         using (LinearGradientBrush T = new LinearGradientBrush(R, c1, c2, LinearGradientMode.Vertical))
  2978.         {
  2979.             g.FillRectangle(T, R);
  2980.         }
  2981.     }
  2982.     public static void Blend(Graphics g, Color c1, Color c2, Color c3, float c, int d, int x, int y, int width, int height)
  2983.     {
  2984.         ColorBlend V = new ColorBlend(3);
  2985.         V.Colors = new Color[] { c1, c2, c3 };
  2986.         V.Positions = new float[] { 0F, c, 1F };
  2987.         Rectangle R = new Rectangle(x, y, width, height);
  2988.         using (LinearGradientBrush T = new LinearGradientBrush(R, c1, c1, (LinearGradientMode)d))
  2989.         {
  2990.             T.InterpolationColors = V;
  2991.             g.FillRectangle(T, R);
  2992.         }
  2993.     }
  2994. }
  2995. #endregion
  2996.  
  2997. #region Seperator
  2998. internal class genesisSeperator : Control
  2999. {
  3000.  
  3001.     private Orientation _Orientation;
  3002.     public Orientation Orientation
  3003.     {
  3004.         get
  3005.         {
  3006.             return _Orientation;
  3007.         }
  3008.         set
  3009.         {
  3010.             _Orientation = value;
  3011.             UpdateOffset();
  3012.             Invalidate();
  3013.         }
  3014.     }
  3015.  
  3016.     private Graphics G;
  3017.     private Bitmap B;
  3018.     private int I;
  3019.     private Color C1;
  3020.     private Pen P1;
  3021.     private Pen P2;
  3022.     public genesisSeperator()
  3023.     {
  3024.         SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
  3025.         C1 = Color.FromArgb(250, 250, 250); //Background
  3026.         P1 = new Pen(Color.FromArgb(230, 230, 230)); //Shadow
  3027.         P2 = new Pen(Color.FromArgb(255, 255, 255)); //Highlight
  3028.     }
  3029.  
  3030.     protected override void OnSizeChanged(EventArgs e)
  3031.     {
  3032.         UpdateOffset();
  3033.         base.OnSizeChanged(e);
  3034.     }
  3035.  
  3036.     public void UpdateOffset()
  3037.     {
  3038.         I = Convert.ToInt32(((_Orientation == 0) ? Height / 2 - 1 : Width / 2 - 1));
  3039.     }
  3040.  
  3041.     protected override void OnPaint(PaintEventArgs e)
  3042.     {
  3043.         B = new Bitmap(Width, Height);
  3044.         G = Graphics.FromImage(B);
  3045.  
  3046.         G.Clear(C1);
  3047.  
  3048.         if (_Orientation == 0)
  3049.         {
  3050.             G.DrawLine(P1, 0, I, Width, I);
  3051.             G.DrawLine(P2, 0, I + 1, Width, I + 1);
  3052.         }
  3053.         else
  3054.         {
  3055.             G.DrawLine(P2, I, 0, I, Height);
  3056.             G.DrawLine(P1, I + 1, 0, I + 1, Height);
  3057.         }
  3058.  
  3059.         e.Graphics.DrawImage(B, 0, 0);
  3060.         G.Dispose();
  3061.         B.Dispose();
  3062.     }
  3063.  
  3064.     protected override void OnPaintBackground(PaintEventArgs pevent)
  3065.     {
  3066.     }
  3067.  
  3068. }
  3069. #endregion
  3070.  
  3071. #region Pigment
  3072. class Pigment
  3073. {
  3074.     public string Name { get; set; }
  3075.     public Color Value { get; set; }
  3076.  
  3077.     public Pigment()
  3078.     {
  3079.     }
  3080.  
  3081.     public Pigment(string n, Color v)
  3082.     {
  3083.         Name = n;
  3084.         Value = v;
  3085.     }
  3086.  
  3087.     public Pigment(string n, byte a, byte r, byte g, byte b)
  3088.     {
  3089.         Name = n;
  3090.         Value = Color.FromArgb(a, r, g, b);
  3091.     }
  3092.  
  3093.     public Pigment(string n, byte r, byte g, byte b)
  3094.     {
  3095.         Name = n;
  3096.         Value = Color.FromArgb(r, g, b);
  3097.     }
  3098. }
  3099. #endregion
  3100.  
  3101. #region Progress Bar
  3102. class genesisProgressBar : ThemeControl154
  3103. {
  3104.     #region Properties
  3105.     private int _Maximum = 100;
  3106.     public int Maximum
  3107.     {
  3108.         get { return _Maximum; }
  3109.         set
  3110.         {
  3111.             if (value < 1)
  3112.                 value = 1;
  3113.  
  3114.             if (value < _Value)
  3115.                 _Value = value;
  3116.  
  3117.             if (_Maximum < _Minimum)
  3118.                 _Minimum = value;
  3119.  
  3120.             _Maximum = value;
  3121.             Invalidate();
  3122.         }
  3123.     }
  3124.  
  3125.     private int _Minimum = 0;
  3126.     public int Minimum
  3127.     {
  3128.         get { return _Minimum; }
  3129.         set
  3130.         {
  3131.             if (_Minimum > _Maximum)
  3132.                 _Maximum = _Minimum;
  3133.  
  3134.             if (_Minimum > _Value)
  3135.                 _Value = _Minimum;
  3136.  
  3137.             _Minimum = value;
  3138.             Invalidate();
  3139.         }
  3140.     }
  3141.  
  3142.     private int _Value = 0;
  3143.     public int Value
  3144.     {
  3145.         get { return _Value; }
  3146.         set
  3147.         {
  3148.             if (value > _Maximum)
  3149.                 value = _Maximum;
  3150.  
  3151.             if (value < _Minimum)
  3152.                 value = _Minimum;
  3153.  
  3154.             _Value = value;
  3155.             Invalidate();
  3156.         }
  3157.     }
  3158.     #endregion
  3159.     #region Hatch Options
  3160.     HatchColors _color;
  3161.  
  3162.     public HatchColors CurrentColor
  3163.     {
  3164.         get
  3165.         {
  3166.             return this._color;
  3167.         }
  3168.         set
  3169.         {
  3170.             this._color = value;
  3171.             Invalidate();
  3172.         }
  3173.     }
  3174.  
  3175.     IsHatched _yesno;
  3176.  
  3177.     public IsHatched HatchONOff
  3178.     {
  3179.         get
  3180.         {
  3181.             return this._yesno;
  3182.         }
  3183.         set
  3184.         {
  3185.             this._yesno = value;
  3186.             Invalidate();
  3187.         }
  3188.     }
  3189.     #endregion
  3190.  
  3191.     public genesisProgressBar()
  3192.     {
  3193.         SetColor("Background", Color.FromArgb(245, 245, 245));
  3194.         SetColor("Border1", 235, 235, 235);
  3195.         SetColor("Border2", 245, 245, 245);
  3196.     }
  3197.  
  3198.     private Color ProgressBarColor;
  3199.     private HatchBrush B1;
  3200.     private Pen P1;
  3201.     private Pen P2;
  3202.  
  3203.     protected override void ColorHook()
  3204.     {
  3205.         ProgressBarColor = GetColor("Background");
  3206.         P1 = new Pen(GetColor("Border1"));
  3207.         P2 = new Pen(GetColor("Border2"));
  3208.     }
  3209.  
  3210.     protected override void PaintHook()
  3211.     {
  3212.         G.Clear(ProgressBarColor);
  3213.         DrawGradient(ProgressBarColor, ProgressBarColor, ClientRectangle, 90f);
  3214.         switch (_yesno)
  3215.         {
  3216.             case IsHatched.Yes:
  3217.                 switch (_color)
  3218.                 {
  3219.                     case HatchColors.White:
  3220.                         SetColor("Hatch1", 245, 245, 245);
  3221.                         SetColor("Hatch2", 235, 235, 235);
  3222.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3223.                         break;
  3224.                     case HatchColors.Blue:
  3225.                         SetColor("Hatch1", 78, 205, 196);
  3226.                         SetColor("Hatch2", 72, 199, 190);
  3227.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3228.                         break;
  3229.                     case HatchColors.Green:
  3230.                         SetColor("Hatch1", 199, 244, 100);
  3231.                         SetColor("Hatch2", 193, 238, 94);
  3232.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3233.                         break;
  3234.                     case HatchColors.Pink:
  3235.                         SetColor("Hatch1", 255, 107, 107);
  3236.                         SetColor("Hatch2", 249, 101, 101);
  3237.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3238.                         break;
  3239.                 }
  3240.                 break;
  3241.             case IsHatched.No:
  3242.                 switch (_color)
  3243.                 {
  3244.                     case HatchColors.White:
  3245.                         SetColor("Hatch1", 245, 245, 245);
  3246.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3247.                         break;
  3248.                     case HatchColors.Blue:
  3249.                         SetColor("Hatch1", 78, 205, 196);
  3250.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3251.                         break;
  3252.                     case HatchColors.Green:
  3253.                         SetColor("Hatch1", 199, 244, 100);
  3254.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3255.                         break;
  3256.                     case HatchColors.Pink:
  3257.                         SetColor("Hatch1", 255, 107, 107);
  3258.                         SetColor("Hatch2", 249, 101, 101);
  3259.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3260.                         break;
  3261.                 }
  3262.                 break;
  3263.         }
  3264.         G.FillRectangle(B1, 2, 2, (Width * _Value) / (_Maximum - _Minimum), Height);
  3265.         DrawBorders(P1, 1);
  3266.         DrawBorders(P2);
  3267.         DrawCorners(BackColor);  
  3268.     }
  3269.     public void Increment(int num)
  3270.     {
  3271.         this._Value += num;
  3272.         Invalidate();
  3273.     }
  3274.     public void Deincrement(int num)
  3275.     {
  3276.         this._Value -= num;
  3277.         Invalidate();
  3278.     }
  3279. }
  3280. #endregion
  3281.  
  3282. #region Checkbox
  3283. [DefaultEvent("CheckedChanged")] // This is used to see if it is a checkbox and so on.
  3284. class genesisCheckBox : ThemeControl154 // This Checkbox uses a green middle
  3285. {
  3286.     #region Text Options
  3287.     MultiColor _text;
  3288.  
  3289.     public MultiColor TextColor
  3290.     {
  3291.         get
  3292.         {
  3293.             return this._text;
  3294.         }
  3295.         set
  3296.         {
  3297.             this._text = value;
  3298.             Invalidate();
  3299.         }
  3300.     }
  3301.     #endregion
  3302.  
  3303.     #region Hatch Options
  3304.     HatchColors _color;
  3305.  
  3306.     public HatchColors CurrentColor
  3307.     {
  3308.         get
  3309.         {
  3310.             return this._color;
  3311.         }
  3312.         set
  3313.         {
  3314.             this._color = value;
  3315.             Invalidate();
  3316.         }
  3317.     }
  3318.  
  3319.     IsHatched _yesno;
  3320.  
  3321.     public IsHatched HatchONOff
  3322.     {
  3323.         get
  3324.         {
  3325.             return this._yesno;
  3326.         }
  3327.         set
  3328.         {
  3329.             this._yesno = value;
  3330.             Invalidate();
  3331.         }
  3332.     }
  3333.     #endregion
  3334.  
  3335.     public genesisCheckBox()
  3336.     {
  3337.         Transparent = true; // it is infact transpernt
  3338.         BackColor = Color.Transparent;
  3339.         // no lockheight since that way they can choose how they want it.
  3340.         // no text since i want the user to choose wether or not they want check, also, that way the border doesn't go around it.
  3341.         SetColor("Background", 249, 249, 249); // Background is Dark
  3342.         SetColor("Border1", 235, 235, 235); // The Inside Border
  3343.         SetColor("Border2", 249, 249, 249); // The Outside Border
  3344.     }
  3345.  
  3346.     // set up the variables
  3347.     private Color C1; // Set up Simple Colors
  3348.     private Pen P1; // A Pen used to create borders
  3349.     private Pen P2;
  3350.     private HatchBrush B1;
  3351.  
  3352.     protected override void ColorHook()
  3353.     {
  3354.         C1 = GetColor("Background"); // Get the Colors for the Button Shading
  3355.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3356.         P2 = new Pen(GetColor("Border2"));
  3357.     }
  3358.  
  3359.     protected override void PaintHook()
  3360.     {
  3361.         G.Clear(BackColor);
  3362.         switch (_Checked)
  3363.         {
  3364.             case true:
  3365.                 //Put your checked state here
  3366.                 switch (_yesno)
  3367.                 {
  3368.                     case IsHatched.Yes:
  3369.                         switch (_color)
  3370.                         {
  3371.                             case HatchColors.White:
  3372.                                 SetColor("Hatch1", 250, 250, 250);
  3373.                                 SetColor("Hatch2", 244, 244, 244);
  3374.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3375.                                 break;
  3376.                             case HatchColors.Blue:
  3377.                                 SetColor("Hatch1", 78, 205, 196);
  3378.                                 SetColor("Hatch2", 72, 199, 190);
  3379.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3380.                                 break;
  3381.                             case HatchColors.Green:
  3382.                                 SetColor("Hatch1", 199, 244, 100);
  3383.                                 SetColor("Hatch2", 193, 238, 94);
  3384.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3385.                                 break;
  3386.                             case HatchColors.Pink:
  3387.                                 SetColor("Hatch1", 255, 107, 107);
  3388.                                 SetColor("Hatch2", 249, 101, 101);
  3389.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  3390.                                 break;
  3391.                         }
  3392.                         break;
  3393.                     case IsHatched.No:
  3394.                         switch (_color)
  3395.                         {
  3396.                             case HatchColors.White:
  3397.                                 SetColor("Hatch1", 250, 250, 250);
  3398.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3399.                                 break;
  3400.                             case HatchColors.Blue:
  3401.                                 SetColor("Hatch1", 78, 205, 196);
  3402.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3403.                                 break;
  3404.                             case HatchColors.Green:
  3405.                                 SetColor("Hatch1", 199, 244, 100);
  3406.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3407.                                 break;
  3408.                             case HatchColors.Pink:
  3409.                                 SetColor("Hatch1", 255, 107, 107);
  3410.                                 SetColor("Hatch2", 249, 101, 101);
  3411.                                 B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  3412.                                 break;
  3413.                         }
  3414.                         break;
  3415.                 }
  3416.  
  3417.                 DrawGradient(C1, C1, ClientRectangle, 90f); // checked background
  3418.                 G.FillRectangle(B1, 3, 3, this.Width - 6, this.Height - 6);
  3419.                 DrawBorders(P1, 1); // Create the Inner Border
  3420.                 this.Height = this.Width;
  3421.                 DrawBorders(P2); // Create the Outer Border
  3422.                 DrawCorners(BackColor); // Draw the Corners
  3423.                 break;
  3424.             case false:
  3425.                 //Put your unchecked state here
  3426.                 DrawGradient(C1, C1, ClientRectangle, 90f); // unchecked background
  3427.                 DrawBorders(P1, 1); // Create the Inner Border
  3428.                 this.Height = this.Width;
  3429.                 DrawBorders(P2); // Create the Outer Border
  3430.                 DrawCorners(BackColor); // Draw the Corners
  3431.                 break;
  3432.         }
  3433.     }
  3434.  
  3435.     private bool _Checked { get; set; }
  3436.     public bool Checked
  3437.     {
  3438.         get { return _Checked; }
  3439.         set { _Checked = value; }
  3440.     }
  3441.     protected override void OnClick(System.EventArgs e)
  3442.     {
  3443.         _Checked = !_Checked;
  3444.         if (CheckedChanged != null)
  3445.         {
  3446.             CheckedChanged(this);
  3447.         }
  3448.         base.OnClick(e);
  3449.     }
  3450.     public event CheckedChangedEventHandler CheckedChanged;
  3451.     public delegate void CheckedChangedEventHandler(object sender);
  3452. }
  3453. #endregion
  3454.  
  3455. #region MaximizeButton
  3456. class genesisMaximize : ThemeControl154 // A Hide Button
  3457. {
  3458.     HoverOptions _color;
  3459.  
  3460.     public HoverOptions HoverColor
  3461.     {
  3462.         get
  3463.         {
  3464.             return this._color;
  3465.         }
  3466.         set
  3467.         {
  3468.             this._color = value;
  3469.             Invalidate();
  3470.         }
  3471.     }
  3472.  
  3473.     public FormWindowState WindowState { get; set; }
  3474.     public genesisMaximize()
  3475.     {
  3476.         SetColor("NoneGradient1", 235, 235, 235);
  3477.         SetColor("NoneGradient2", 245, 245, 245);
  3478.         SetColor("Text", 24, 24, 24); // The Color for the Text
  3479.         SetColor("Texthover", 254, 254, 254); // The Color for the Text
  3480.         SetColor("Border1", 225, 225, 225); // The Inside Border
  3481.         SetColor("Border2", 235, 235, 235); // The Outside Border
  3482.     }
  3483.  
  3484.     private Color C1; // Set up Simple Colors
  3485.     private Color C2;
  3486.     private Color C3;
  3487.     private Color C4;
  3488.     private Color C5;
  3489.     private Color C6;
  3490.     private SolidBrush B1; // A Brush to use text
  3491.     private SolidBrush B2; // A Brush to use text
  3492.     private Pen P1; // A Pen used to create borders
  3493.     private Pen P2;
  3494.  
  3495.     protected override void ColorHook()
  3496.     {
  3497.         C3 = GetColor("NoneGradient1");
  3498.         C4 = GetColor("NoneGradient2");
  3499.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  3500.         B2 = new SolidBrush(GetColor("Texthover"));
  3501.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3502.         P2 = new Pen(GetColor("Border2"));
  3503.     }
  3504.  
  3505.     protected override void PaintHook()
  3506.     {
  3507.         switch (_color)
  3508.         {
  3509.             case HoverOptions.Blue:
  3510.                 SetColor("DownGradient1", 72, 199, 190); // Basic Gradients Used to Shade the Button
  3511.                 SetColor("DownGradient2", 78, 205, 196); // The Gradients are reversed, depending on if Button is Pressed or not
  3512.                 SetColor("ClickedGradient1", 72, 199, 190);
  3513.                 SetColor("ClickedGradient2", 78, 205, 196);
  3514.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3515.                 C2 = GetColor("DownGradient2");
  3516.                 C5 = GetColor("ClickedGradient1");
  3517.                 C6 = GetColor("ClickedGradient2");
  3518.                 break;
  3519.             case HoverOptions.Green:
  3520.                 SetColor("DownGradient1", 193, 238, 94); // Basic Gradients Used to Shade the Button
  3521.                 SetColor("DownGradient2", 199, 244, 100); // The Gradients are reversed, depending on if Button is Pressed or not
  3522.                 SetColor("ClickedGradient1", 193, 238, 94);
  3523.                 SetColor("ClickedGradient2", 199, 244, 100);
  3524.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3525.                 C2 = GetColor("DownGradient2");
  3526.                 C5 = GetColor("ClickedGradient1");
  3527.                 C6 = GetColor("ClickedGradient2");
  3528.                 break;
  3529.             case HoverOptions.Pink:
  3530.                 SetColor("DownGradient1", 249, 101, 101); // Basic Gradients Used to Shade the Button
  3531.                 SetColor("DownGradient2", 255, 107, 107); // The Gradients are reversed, depending on if Button is Pressed or not
  3532.                 SetColor("ClickedGradient1", 249, 101, 101);
  3533.                 SetColor("ClickedGradient2", 255, 107, 107);
  3534.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3535.                 C2 = GetColor("DownGradient2");
  3536.                 C5 = GetColor("ClickedGradient1");
  3537.                 C6 = GetColor("ClickedGradient2");
  3538.                 break;
  3539.         }
  3540.         if (this.State == MouseState.Over)
  3541.         { // Used to see if button is Hovered over
  3542.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  3543.             if (Application.OpenForms[0].WindowState == FormWindowState.Normal)
  3544.             {
  3545.                 this.Text = "+";
  3546.                 DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3547.             }
  3548.             else if (Application.OpenForms[0].WindowState == FormWindowState.Maximized)
  3549.             {
  3550.                 this.Text = "-";
  3551.                 DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3552.             }
  3553.         }
  3554.         else if (this.State == MouseState.Down)
  3555.         {
  3556.             DrawGradient(C6, C5, ClientRectangle, 90f);
  3557.             if (Application.OpenForms[0].WindowState == FormWindowState.Normal)
  3558.             {
  3559.                 this.Text = "+";
  3560.                 System.Threading.Thread.Sleep(100);
  3561.                 DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3562.                 Application.OpenForms[0].WindowState = FormWindowState.Maximized;
  3563.                 this.Text = "-";
  3564.             }
  3565.             else if (Application.OpenForms[0].WindowState == FormWindowState.Maximized)
  3566.             {
  3567.                 this.Text = "-";
  3568.                 System.Threading.Thread.Sleep(100);
  3569.                 DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3570.                 Application.OpenForms[0].WindowState = FormWindowState.Normal;
  3571.                 this.Text = "+";
  3572.             }
  3573.         }
  3574.         else
  3575.         {
  3576.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  3577.             DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3578.         }
  3579.         this.Width = 17;
  3580.         this.Height = 17;
  3581.         DrawBorders(P1, 1); // Create the Inner Border
  3582.         DrawBorders(P2); // Create the Outer Border
  3583.         DrawCorners(BackColor); // Draw the Corners
  3584.     }
  3585.  
  3586. }
  3587. #endregion
  3588.  
  3589. #region HideButton
  3590. class genesisHide : ThemeControl154 // A Hide Button
  3591. {
  3592.     HoverOptions _color;
  3593.  
  3594.     public HoverOptions HoverColor
  3595.     {
  3596.         get
  3597.         {
  3598.             return this._color;
  3599.         }
  3600.         set
  3601.         {
  3602.             this._color = value;
  3603.             Invalidate();
  3604.         }
  3605.     }
  3606.  
  3607.     public FormWindowState WindowState { get; set; }
  3608.     public genesisHide()
  3609.     {
  3610.         SetColor("NoneGradient1", 235, 235, 235);
  3611.         SetColor("NoneGradient2", 245, 245, 245);
  3612.         SetColor("Text", 24, 24, 24); // The Color for the Text
  3613.         SetColor("Texthover", 254, 254, 254); // The Color for the Text
  3614.         SetColor("Border1", 225, 225, 225); // The Inside Border
  3615.         SetColor("Border2", 235, 235, 235); // The Outside Border
  3616.     }
  3617.  
  3618.     private Color C1; // Set up Simple Colors
  3619.     private Color C2;
  3620.     private Color C3;
  3621.     private Color C4;
  3622.     private Color C5;
  3623.     private Color C6;
  3624.     private SolidBrush B1; // A Brush to use text
  3625.     private SolidBrush B2; // A Brush to use text
  3626.     private Pen P1; // A Pen used to create borders
  3627.     private Pen P2;
  3628.  
  3629.     protected override void ColorHook()
  3630.     {
  3631.         C3 = GetColor("NoneGradient1");
  3632.         C4 = GetColor("NoneGradient2");
  3633.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  3634.         B2 = new SolidBrush(GetColor("Texthover"));
  3635.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3636.         P2 = new Pen(GetColor("Border2"));
  3637.     }
  3638.  
  3639.     protected override void PaintHook()
  3640.     {
  3641.         switch (_color)
  3642.         {
  3643.             case HoverOptions.Blue:
  3644.                 SetColor("DownGradient1", 72, 199, 190); // Basic Gradients Used to Shade the Button
  3645.                 SetColor("DownGradient2", 78, 205, 196); // The Gradients are reversed, depending on if Button is Pressed or not
  3646.                 SetColor("ClickedGradient1", 72, 199, 190);
  3647.                 SetColor("ClickedGradient2", 78, 205, 196);
  3648.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3649.                 C2 = GetColor("DownGradient2");
  3650.                 C5 = GetColor("ClickedGradient1");
  3651.                 C6 = GetColor("ClickedGradient2");
  3652.                 break;
  3653.             case HoverOptions.Green:
  3654.                 SetColor("DownGradient1", 193, 238, 94); // Basic Gradients Used to Shade the Button
  3655.                 SetColor("DownGradient2", 199, 244, 100); // The Gradients are reversed, depending on if Button is Pressed or not
  3656.                 SetColor("ClickedGradient1", 193, 238, 94);
  3657.                 SetColor("ClickedGradient2", 199, 244, 100);
  3658.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3659.                 C2 = GetColor("DownGradient2");
  3660.                 C5 = GetColor("ClickedGradient1");
  3661.                 C6 = GetColor("ClickedGradient2");
  3662.                 break;
  3663.             case HoverOptions.Pink:
  3664.                 SetColor("DownGradient1", 249, 101, 101); // Basic Gradients Used to Shade the Button
  3665.                 SetColor("DownGradient2", 255, 107, 107); // The Gradients are reversed, depending on if Button is Pressed or not
  3666.                 SetColor("ClickedGradient1", 249, 101, 101);
  3667.                 SetColor("ClickedGradient2", 255, 107, 107);
  3668.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3669.                 C2 = GetColor("DownGradient2");
  3670.                 C5 = GetColor("ClickedGradient1");
  3671.                 C6 = GetColor("ClickedGradient2");
  3672.                 break;
  3673.         }
  3674.         if (this.State == MouseState.Over)
  3675.         { // Used to see if button is Hovered over
  3676.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  3677.             DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3678.             this.Text = "_";
  3679.         }
  3680.         else if (this.State == MouseState.Down)
  3681.         {
  3682.             DrawGradient(C6, C5, ClientRectangle, 90f);
  3683.             this.Text = "_";
  3684.             DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3685.             Application.OpenForms[0].WindowState = FormWindowState.Minimized;
  3686.         }
  3687.         else
  3688.         {
  3689.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  3690.             DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3691.         }
  3692.         this.Width = 17;
  3693.         this.Height = 17;
  3694.         DrawBorders(P1, 1); // Create the Inner Border
  3695.         DrawBorders(P2); // Create the Outer Border
  3696.         DrawCorners(BackColor); // Draw the Corners
  3697.     }
  3698.  
  3699. }
  3700. #endregion
  3701.  
  3702. #region CloseButton
  3703. class genesisClose : ThemeControl154 // A Hide Button
  3704. {
  3705.     HoverOptions _color;
  3706.  
  3707.     public HoverOptions HoverColor
  3708.     {
  3709.         get
  3710.         {
  3711.             return this._color;
  3712.         }
  3713.         set
  3714.         {
  3715.             this._color = value;
  3716.             Invalidate();
  3717.         }
  3718.     }
  3719.  
  3720.     public FormWindowState WindowState { get; set; }
  3721.     public genesisClose()
  3722.     {
  3723.         SetColor("NoneGradient1", 235, 235, 235);
  3724.         SetColor("NoneGradient2", 245, 245, 245);
  3725.         SetColor("Text", 24, 24, 24); // The Color for the Text
  3726.         SetColor("Texthover", 254, 254, 254); // The Color for the Text
  3727.         SetColor("Border1", 225, 225, 225); // The Inside Border
  3728.         SetColor("Border2", 235, 235, 235); // The Outside Border
  3729.     }
  3730.  
  3731.     private Color C1; // Set up Simple Colors
  3732.     private Color C2;
  3733.     private Color C3;
  3734.     private Color C4;
  3735.     private Color C5;
  3736.     private Color C6;
  3737.     private SolidBrush B1; // A Brush to use text
  3738.     private SolidBrush B2; // A Brush to use text
  3739.     private Pen P1; // A Pen used to create borders
  3740.     private Pen P2;
  3741.  
  3742.     protected override void ColorHook()
  3743.     {
  3744.         C3 = GetColor("NoneGradient1");
  3745.         C4 = GetColor("NoneGradient2");
  3746.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  3747.         B2 = new SolidBrush(GetColor("Texthover"));
  3748.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3749.         P2 = new Pen(GetColor("Border2"));
  3750.     }
  3751.  
  3752.     protected override void PaintHook()
  3753.     {
  3754.         switch (_color)
  3755.         {
  3756.             case HoverOptions.Blue:
  3757.                 SetColor("DownGradient1", 72, 199, 190); // Basic Gradients Used to Shade the Button
  3758.                 SetColor("DownGradient2", 78, 205, 196); // The Gradients are reversed, depending on if Button is Pressed or not
  3759.                 SetColor("ClickedGradient1", 72, 199, 190);
  3760.                 SetColor("ClickedGradient2", 78, 205, 196);
  3761.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3762.                 C2 = GetColor("DownGradient2");
  3763.                 C5 = GetColor("ClickedGradient1");
  3764.                 C6 = GetColor("ClickedGradient2");
  3765.                 break;
  3766.             case HoverOptions.Green:
  3767.                 SetColor("DownGradient1", 193, 238, 94); // Basic Gradients Used to Shade the Button
  3768.                 SetColor("DownGradient2", 199, 244, 100); // The Gradients are reversed, depending on if Button is Pressed or not
  3769.                 SetColor("ClickedGradient1", 193, 238, 94);
  3770.                 SetColor("ClickedGradient2", 199, 244, 100);
  3771.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3772.                 C2 = GetColor("DownGradient2");
  3773.                 C5 = GetColor("ClickedGradient1");
  3774.                 C6 = GetColor("ClickedGradient2");
  3775.                 break;
  3776.             case HoverOptions.Pink:
  3777.                 SetColor("DownGradient1", 249, 101, 101); // Basic Gradients Used to Shade the Button
  3778.                 SetColor("DownGradient2", 255, 107, 107); // The Gradients are reversed, depending on if Button is Pressed or not
  3779.                 SetColor("ClickedGradient1", 249, 101, 101);
  3780.                 SetColor("ClickedGradient2", 255, 107, 107);
  3781.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3782.                 C2 = GetColor("DownGradient2");
  3783.                 C5 = GetColor("ClickedGradient1");
  3784.                 C6 = GetColor("ClickedGradient2");
  3785.                 break;
  3786.         }
  3787.         if (this.State == MouseState.Over)
  3788.         { // Used to see if button is Hovered over
  3789.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  3790.             DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3791.             this.Text = "x";
  3792.         }
  3793.         else if (this.State == MouseState.Down)
  3794.         {
  3795.             DrawGradient(C6, C5, ClientRectangle, 90f);
  3796.             this.Text = "x";
  3797.             Application.Exit();
  3798.             DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3799.         }
  3800.         else
  3801.         {
  3802.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  3803.             DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3804.         }
  3805.         this.Width = 17;
  3806.         this.Height = 17;
  3807.         DrawBorders(P1, 1); // Create the Inner Border
  3808.         DrawBorders(P2); // Create the Outer Border
  3809.         DrawCorners(BackColor); // Draw the Corners
  3810.     }
  3811.  
  3812. }
  3813. #endregion
  3814.  
  3815. #region TopButton
  3816. class genesisTopButton : ThemeControl154 // A Hide Button
  3817. {
  3818.     HoverOptions _color;
  3819.  
  3820.     public HoverOptions HoverColor
  3821.     {
  3822.         get
  3823.         {
  3824.             return this._color;
  3825.         }
  3826.         set
  3827.         {
  3828.             this._color = value;
  3829.             Invalidate();
  3830.         }
  3831.     }
  3832.  
  3833.     public FormWindowState WindowState { get; set; }
  3834.     public genesisTopButton()
  3835.     {
  3836.         SetColor("NoneGradient1", 235, 235, 235);
  3837.         SetColor("NoneGradient2", 245, 245, 245);
  3838.         SetColor("Text", 24, 24, 24); // The Color for the Text
  3839.         SetColor("Texthover", 254, 254, 254); // The Color for the Text
  3840.         SetColor("Border1", 225, 225, 225); // The Inside Border
  3841.         SetColor("Border2", 235, 235, 235); // The Outside Border
  3842.     }
  3843.  
  3844.     private Color C1; // Set up Simple Colors
  3845.     private Color C2;
  3846.     private Color C3;
  3847.     private Color C4;
  3848.     private Color C5;
  3849.     private Color C6;
  3850.     private SolidBrush B1; // A Brush to use text
  3851.     private SolidBrush B2; // A Brush to use text
  3852.     private Pen P1; // A Pen used to create borders
  3853.     private Pen P2;
  3854.  
  3855.     protected override void ColorHook()
  3856.     {
  3857.         C3 = GetColor("NoneGradient1");
  3858.         C4 = GetColor("NoneGradient2");
  3859.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  3860.         B2 = new SolidBrush(GetColor("Texthover"));
  3861.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3862.         P2 = new Pen(GetColor("Border2"));
  3863.     }
  3864.  
  3865.     protected override void PaintHook()
  3866.     {
  3867.         switch (_color)
  3868.         {
  3869.             case HoverOptions.Blue:
  3870.                 SetColor("DownGradient1", 72, 199, 190); // Basic Gradients Used to Shade the Button
  3871.                 SetColor("DownGradient2", 78, 205, 196); // The Gradients are reversed, depending on if Button is Pressed or not
  3872.                 SetColor("ClickedGradient1", 72, 199, 190);
  3873.                 SetColor("ClickedGradient2", 78, 205, 196);
  3874.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3875.                 C2 = GetColor("DownGradient2");
  3876.                 C5 = GetColor("ClickedGradient1");
  3877.                 C6 = GetColor("ClickedGradient2");
  3878.                 break;
  3879.             case HoverOptions.Green:
  3880.                 SetColor("DownGradient1", 193, 238, 94); // Basic Gradients Used to Shade the Button
  3881.                 SetColor("DownGradient2", 199, 244, 100); // The Gradients are reversed, depending on if Button is Pressed or not
  3882.                 SetColor("ClickedGradient1", 193, 238, 94);
  3883.                 SetColor("ClickedGradient2", 199, 244, 100);
  3884.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3885.                 C2 = GetColor("DownGradient2");
  3886.                 C5 = GetColor("ClickedGradient1");
  3887.                 C6 = GetColor("ClickedGradient2");
  3888.                 break;
  3889.             case HoverOptions.Pink:
  3890.                 SetColor("DownGradient1", 249, 101, 101); // Basic Gradients Used to Shade the Button
  3891.                 SetColor("DownGradient2", 255, 107, 107); // The Gradients are reversed, depending on if Button is Pressed or not
  3892.                 SetColor("ClickedGradient1", 249, 101, 101);
  3893.                 SetColor("ClickedGradient2", 255, 107, 107);
  3894.                 C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3895.                 C2 = GetColor("DownGradient2");
  3896.                 C5 = GetColor("ClickedGradient1");
  3897.                 C6 = GetColor("ClickedGradient2");
  3898.                 break;
  3899.         }
  3900.         if (this.State == MouseState.Over)
  3901.         { // Used to see if button is Hovered over
  3902.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  3903.             DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3904.         }
  3905.         else if (this.State == MouseState.Down)
  3906.         {
  3907.             DrawGradient(C6, C5, ClientRectangle, 90f);
  3908.             DrawText(B2, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3909.         }
  3910.         else
  3911.         {
  3912.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  3913.             DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3914.         }
  3915.         this.Width = 17;
  3916.         this.Height = 17;
  3917.         DrawBorders(P1, 1); // Create the Inner Border
  3918.         DrawBorders(P2); // Create the Outer Border
  3919.         DrawCorners(BackColor); // Draw the Corners
  3920.     }
  3921.  
  3922. }
  3923. #endregion
  3924.  
  3925. #region Groupbox
  3926. class genesisGroupBox : ThemeContainer154
  3927. {
  3928.     #region Text Location
  3929.     public enum TextLocation
  3930.     {
  3931.         Left = 0,
  3932.         Center = 1,
  3933.         Right = 2
  3934.     }
  3935.  
  3936.     TextLocation _location;
  3937.  
  3938.     public TextLocation TextPlacement
  3939.     {
  3940.         get
  3941.         {
  3942.             return this._location;
  3943.         }
  3944.         set
  3945.         {
  3946.             this._location = value;
  3947.             Invalidate();
  3948.         }
  3949.     }
  3950.     #endregion
  3951.     #region TextColor
  3952.     public enum MultiColor
  3953.     {
  3954.         Black = 0,
  3955.         White = 1,
  3956.         Green = 2,
  3957.         Blue = 3,
  3958.         Pink = 4
  3959.     }
  3960.     MultiColor _color;
  3961.  
  3962.     public MultiColor TextColor
  3963.     {
  3964.         get
  3965.         {
  3966.             return this._color;
  3967.         }
  3968.         set
  3969.         {
  3970.             this._color = value;
  3971.             Invalidate();
  3972.         }
  3973.     }
  3974.     #endregion
  3975.     #region Hatch Options
  3976.     HatchColors _hatchcolor;
  3977.  
  3978.     public HatchColors HatchColor
  3979.     {
  3980.         get
  3981.         {
  3982.             return this._hatchcolor;
  3983.         }
  3984.         set
  3985.         {
  3986.             this._hatchcolor = value;
  3987.             Invalidate();
  3988.         }
  3989.     }
  3990.  
  3991.     IsHatched _yesno;
  3992.  
  3993.     public IsHatched HatchONOff
  3994.     {
  3995.         get
  3996.         {
  3997.             return this._yesno;
  3998.         }
  3999.         set
  4000.         {
  4001.             this._yesno = value;
  4002.             Invalidate();
  4003.         }
  4004.     }
  4005.     #endregion
  4006.  
  4007.     public genesisGroupBox()
  4008.     {
  4009.         ControlMode = true;
  4010.         Header = 26;
  4011.     }
  4012.  
  4013.     private HatchBrush B1;
  4014.     private SolidBrush B2;
  4015.  
  4016.     protected override void ColorHook()
  4017.     {
  4018.  
  4019.     }
  4020.  
  4021.     protected override void PaintHook()
  4022.     {
  4023.         switch (_yesno)
  4024.         {
  4025.              case IsHatched.Yes:
  4026.                 switch (_hatchcolor)
  4027.                 {
  4028.                     case HatchColors.White:
  4029.                         SetColor("Hatch1", 254, 254, 254);
  4030.                         SetColor("Hatch2", 248, 248, 248);
  4031.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  4032.                         break;
  4033.                     case HatchColors.Blue:
  4034.                         SetColor("Hatch1", 78, 205, 196);
  4035.                         SetColor("Hatch2", 72, 199, 190);
  4036.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  4037.                         break;
  4038.                     case HatchColors.Green:
  4039.                         SetColor("Hatch1", 199, 244, 100);
  4040.                         SetColor("Hatch2", 193, 238, 94);
  4041.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  4042.                         break;
  4043.                     case HatchColors.Pink:
  4044.                         SetColor("Hatch1", 255, 107, 107);
  4045.                         SetColor("Hatch2", 249, 101, 101);
  4046.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"));
  4047.                         break;
  4048.                 }
  4049.                 break;
  4050.             case IsHatched.No:
  4051.                 switch (_hatchcolor)
  4052.                 {
  4053.                     case HatchColors.White:
  4054.                         SetColor("Hatch1", 254, 254, 254);
  4055.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  4056.                         break;
  4057.                     case HatchColors.Blue:
  4058.                         SetColor("Hatch1", 78, 205, 196);
  4059.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  4060.                         break;
  4061.                     case HatchColors.Green:
  4062.                         SetColor("Hatch1", 199, 244, 100);
  4063.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  4064.                         break;
  4065.                     case HatchColors.Pink:
  4066.                         SetColor("Hatch1", 255, 107, 107);
  4067.                         SetColor("Hatch2", 249, 101, 101);
  4068.                         B1 = new HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"));
  4069.                         break;
  4070.                 }
  4071.                 break;
  4072.         }
  4073.         G.Clear(Color.FromArgb(249, 249, 249));
  4074.         G.FillRectangle(B1, 5, 5, Width - 10, 26);
  4075.         G.DrawLine(new Pen(Color.FromArgb(20, Color.White)), 7, 7, Width - 8, 7);
  4076.         DrawBorders(new Pen(Color.FromArgb(220, 220, 220)), 5, 5, Width - 10, 26, 1);
  4077.         DrawBorders(new Pen(Color.FromArgb(236, 236, 236)), 5, 5, Width - 10, 26);
  4078.         DrawBorders(new Pen(Color.FromArgb(60, 208, 208, 208)), 5, 34, Width - 10, Height - 39, 1);
  4079.         DrawBorders(new Pen(Color.FromArgb(236, 236, 236)), 5, 34, Width - 10, Height - 39);
  4080.         DrawBorders(new Pen(Color.FromArgb(236, 236, 236)), 1);
  4081.         DrawBorders(new Pen(Color.FromArgb(236, 236, 236)));
  4082.         G.DrawLine(new Pen(Color.FromArgb(248, 248, 248)), 1, 1, Width - 2, 1);
  4083.         switch (_color)
  4084.         {
  4085.             case MultiColor.White:
  4086.                 SetColor("Text", 254, 254, 254);
  4087.                 B2 = new SolidBrush(GetColor("Text"));
  4088.                 break;
  4089.             case MultiColor.Black:
  4090.                 SetColor("Text", 24, 24, 24);
  4091.                 B2 = new SolidBrush(GetColor("Text"));
  4092.                 break;
  4093.             case MultiColor.Blue:
  4094.                 SetColor("Text", 78, 205, 196);
  4095.                 B2 = new SolidBrush(GetColor("Text"));
  4096.                 break;
  4097.             case MultiColor.Green:
  4098.                 SetColor("Text", 199, 244, 100);
  4099.                 B2 = new SolidBrush(GetColor("Text"));
  4100.                 break;
  4101.             case MultiColor.Pink:
  4102.                 SetColor("Text", 255, 107, 107);
  4103.                 B2 = new SolidBrush(GetColor("Text"));
  4104.                 break;
  4105.         }
  4106.         switch (_location)
  4107.         {
  4108.             case TextLocation.Left:
  4109.                 DrawText(B2, HorizontalAlignment.Left, 9, 5);
  4110.                 break;
  4111.             case TextLocation.Center:
  4112.                 DrawText(B2, HorizontalAlignment.Center, 0, 5);
  4113.                 break;
  4114.             case TextLocation.Right:
  4115.                 DrawText(B2, HorizontalAlignment.Right, 10, 5);
  4116.                 break;
  4117.         }
  4118.  
  4119.     }
  4120. }
  4121. #endregion
  4122.  
  4123. #region Panel
  4124. class genesisPanel : ThemeContainer154
  4125. {
  4126.     public genesisPanel()
  4127.     {
  4128.         ControlMode = true;
  4129.         Header = 26;
  4130.     }
  4131.  
  4132.     protected override void ColorHook()
  4133.     {
  4134.  
  4135.     }
  4136.  
  4137.     protected override void PaintHook()
  4138.     {
  4139.         G.Clear(Color.FromArgb(250, 250, 250));
  4140.         DrawBorders(new Pen(Color.FromArgb(236, 236, 236)), 1);
  4141.         DrawBorders(new Pen(Color.FromArgb(236, 236, 236)));
  4142.         G.DrawLine(new Pen(Color.FromArgb(248, 248, 248)), 1, 1, Width - 2, 1);
  4143.     }
  4144. }
  4145. #endregion
  4146.  
  4147. #region Textbox
  4148. [DefaultEvent("TextChanged")]
  4149. class genesisTextBox : ThemeControl154
  4150. {
  4151.  
  4152.     private HorizontalAlignment _TextAlign = HorizontalAlignment.Left;
  4153.     public HorizontalAlignment TextAlign
  4154.     {
  4155.         get { return _TextAlign; }
  4156.         set
  4157.         {
  4158.             _TextAlign = value;
  4159.             if (Base != null)
  4160.             {
  4161.                 Base.TextAlign = value;
  4162.             }
  4163.         }
  4164.     }
  4165.     private int _MaxLength = 32767;
  4166.     public int MaxLength
  4167.     {
  4168.         get { return _MaxLength; }
  4169.         set
  4170.         {
  4171.             _MaxLength = value;
  4172.             if (Base != null)
  4173.             {
  4174.                 Base.MaxLength = value;
  4175.             }
  4176.         }
  4177.     }
  4178.     private bool _ReadOnly;
  4179.     public bool ReadOnly
  4180.     {
  4181.         get { return _ReadOnly; }
  4182.         set
  4183.         {
  4184.             _ReadOnly = value;
  4185.             if (Base != null)
  4186.             {
  4187.                 Base.ReadOnly = value;
  4188.             }
  4189.         }
  4190.     }
  4191.     private bool _UseSystemPasswordChar;
  4192.     public bool UseSystemPasswordChar
  4193.     {
  4194.         get { return _UseSystemPasswordChar; }
  4195.         set
  4196.         {
  4197.             _UseSystemPasswordChar = value;
  4198.             if (Base != null)
  4199.             {
  4200.                 Base.UseSystemPasswordChar = value;
  4201.             }
  4202.         }
  4203.     }
  4204.     private bool _Multiline;
  4205.     public bool Multiline
  4206.     {
  4207.         get { return _Multiline; }
  4208.         set
  4209.         {
  4210.             _Multiline = value;
  4211.             if (Base != null)
  4212.             {
  4213.                 Base.Multiline = value;
  4214.  
  4215.                 if (value)
  4216.                 {
  4217.                     LockHeight = 0;
  4218.                     Base.Height = Height - 11;
  4219.                 }
  4220.                 else
  4221.                 {
  4222.                     LockHeight = Base.Height + 11;
  4223.                 }
  4224.             }
  4225.         }
  4226.     }
  4227.     public override string Text
  4228.     {
  4229.         get { return base.Text; }
  4230.         set
  4231.         {
  4232.             base.Text = value;
  4233.             if (Base != null)
  4234.             {
  4235.                 Base.Text = value;
  4236.             }
  4237.         }
  4238.     }
  4239.     public override Font Font
  4240.     {
  4241.         get { return base.Font; }
  4242.         set
  4243.         {
  4244.             base.Font = value;
  4245.             if (Base != null)
  4246.             {
  4247.                 Base.Font = value;
  4248.                 Base.Location = new Point(3, 5);
  4249.                 Base.Width = Width - 6;
  4250.  
  4251.                 if (!_Multiline)
  4252.                 {
  4253.                     LockHeight = Base.Height + 11;
  4254.                 }
  4255.             }
  4256.         }
  4257.     }
  4258.  
  4259.     protected override void OnCreation()
  4260.     {
  4261.         if (!Controls.Contains(Base))
  4262.         {
  4263.             Controls.Add(Base);
  4264.         }
  4265.     }
  4266.  
  4267.     private TextBox Base;
  4268.     public genesisTextBox()
  4269.     {
  4270.         Base = new TextBox();
  4271.  
  4272.         Base.Font = Font;
  4273.         Base.Text = Text;
  4274.         Base.MaxLength = _MaxLength;
  4275.         Base.Multiline = _Multiline;
  4276.         Base.ReadOnly = _ReadOnly;
  4277.         Base.UseSystemPasswordChar = _UseSystemPasswordChar;
  4278.  
  4279.         Base.BorderStyle = BorderStyle.None;
  4280.  
  4281.         Base.Location = new Point(4, 4);
  4282.         Base.Width = Width - 10;
  4283.  
  4284.         if (_Multiline)
  4285.         {
  4286.             Base.Height = Height - 11;
  4287.         }
  4288.         else
  4289.         {
  4290.             LockHeight = Base.Height + 11;
  4291.         }
  4292.  
  4293.         Base.TextChanged += OnBaseTextChanged;
  4294.         Base.KeyDown += OnBaseKeyDown;
  4295.  
  4296.  
  4297.         SetColor("Text", Color.Black);
  4298.         SetColor("Backcolor", 245, 245, 245);
  4299.         SetColor("Border", 220, 220, 220);
  4300.     }
  4301.  
  4302.     private Color BG;
  4303.  
  4304.     private Pen P1;
  4305.     protected override void ColorHook()
  4306.     {
  4307.         BG = GetColor("Backcolor");
  4308.  
  4309.         P1 = GetPen("Border");
  4310.  
  4311.         Base.ForeColor = GetColor("Text");
  4312.         Base.BackColor = GetColor("Backcolor");
  4313.     }
  4314.  
  4315.     protected override void PaintHook()
  4316.     {
  4317.         G.Clear(BG);
  4318.         DrawBorders(P1);
  4319.     }
  4320.     private void OnBaseTextChanged(object s, EventArgs e)
  4321.     {
  4322.         Text = Base.Text;
  4323.     }
  4324.     private void OnBaseKeyDown(object s, KeyEventArgs e)
  4325.     {
  4326.         if (e.Control && e.KeyCode == Keys.A)
  4327.         {
  4328.             Base.SelectAll();
  4329.             e.SuppressKeyPress = true;
  4330.         }
  4331.     }
  4332.     protected override void OnResize(EventArgs e)
  4333.     {
  4334.         Base.Location = new Point(4, 5);
  4335.         Base.Width = Width - 8;
  4336.  
  4337.         if (_Multiline)
  4338.         {
  4339.             Base.Height = Height - 5;
  4340.         }
  4341.  
  4342.  
  4343.         base.OnResize(e);
  4344.     }
  4345.  
  4346. }
  4347. #endregion
  4348.  
  4349. #region RichTextbox
  4350. [DefaultEvent("TextChanged")]
  4351. class genesisRichTextBox : ThemeControl154
  4352. {
  4353.  
  4354.     private int _MaxLength = 32767;
  4355.     public int MaxLength
  4356.     {
  4357.         get { return _MaxLength; }
  4358.         set
  4359.         {
  4360.             _MaxLength = value;
  4361.             if (Base != null)
  4362.             {
  4363.                 Base.MaxLength = value;
  4364.             }
  4365.         }
  4366.     }
  4367.     private bool _ReadOnly;
  4368.     public bool ReadOnly
  4369.     {
  4370.         get { return _ReadOnly; }
  4371.         set
  4372.         {
  4373.             _ReadOnly = value;
  4374.             if (Base != null)
  4375.             {
  4376.                 Base.ReadOnly = value;
  4377.             }
  4378.         }
  4379.     }
  4380.  
  4381.     private bool _Multiline;
  4382.     public bool Multiline
  4383.     {
  4384.         get { return _Multiline; }
  4385.         set
  4386.         {
  4387.             _Multiline = value;
  4388.             if (Base != null)
  4389.             {
  4390.                 Base.Multiline = value;
  4391.  
  4392.                 if (value)
  4393.                 {
  4394.                     LockHeight = 0;
  4395.                     Base.Height = Height - 11;
  4396.                 }
  4397.                 else
  4398.                 {
  4399.                     LockHeight = Base.Height + 11;
  4400.                 }
  4401.             }
  4402.         }
  4403.     }
  4404.     public override string Text
  4405.     {
  4406.         get { return base.Text; }
  4407.         set
  4408.         {
  4409.             base.Text = value;
  4410.             if (Base != null)
  4411.             {
  4412.                 Base.Text = value;
  4413.             }
  4414.         }
  4415.     }
  4416.     public override Font Font
  4417.     {
  4418.         get { return base.Font; }
  4419.         set
  4420.         {
  4421.             base.Font = value;
  4422.             if (Base != null)
  4423.             {
  4424.                 Base.Font = value;
  4425.                 Base.Location = new Point(3, 5);
  4426.                 Base.Width = Width - 6;
  4427.  
  4428.                 if (!_Multiline)
  4429.                 {
  4430.                     LockHeight = Base.Height + 11;
  4431.                 }
  4432.             }
  4433.         }
  4434.     }
  4435.  
  4436.     protected override void OnCreation()
  4437.     {
  4438.         if (!Controls.Contains(Base))
  4439.         {
  4440.             Controls.Add(Base);
  4441.         }
  4442.     }
  4443.  
  4444.     private RichTextBox Base;
  4445.     public genesisRichTextBox()
  4446.     {
  4447.         Base = new RichTextBox();
  4448.  
  4449.         Base.Font = Font;
  4450.         Base.Text = Text;
  4451.         Base.MaxLength = _MaxLength;
  4452.         Base.Multiline = _Multiline;
  4453.         Base.ReadOnly = _ReadOnly;
  4454.  
  4455.         Base.BorderStyle = BorderStyle.None;
  4456.  
  4457.         Base.Location = new Point(4, 4);
  4458.         Base.Width = Width - 10;
  4459.  
  4460.         if (_Multiline)
  4461.         {
  4462.             Base.Height = Height - 11;
  4463.         }
  4464.         else
  4465.         {
  4466.             LockHeight = Base.Height + 11;
  4467.         }
  4468.  
  4469.         Base.TextChanged += OnBaseTextChanged;
  4470.         Base.KeyDown += OnBaseKeyDown;
  4471.  
  4472.  
  4473.         SetColor("Text", Color.Black);
  4474.         SetColor("Backcolor", 245, 245, 245);
  4475.         SetColor("Border", 220, 220, 220);
  4476.     }
  4477.  
  4478.     private Color BG;
  4479.  
  4480.     private Pen P1;
  4481.     protected override void ColorHook()
  4482.     {
  4483.         BG = GetColor("Backcolor");
  4484.  
  4485.         P1 = GetPen("Border");
  4486.  
  4487.         Base.ForeColor = GetColor("Text");
  4488.         Base.BackColor = GetColor("Backcolor");
  4489.     }
  4490.  
  4491.     protected override void PaintHook()
  4492.     {
  4493.         G.Clear(BG);
  4494.         DrawBorders(P1);
  4495.     }
  4496.     private void OnBaseTextChanged(object s, EventArgs e)
  4497.     {
  4498.         Text = Base.Text;
  4499.     }
  4500.     private void OnBaseKeyDown(object s, KeyEventArgs e)
  4501.     {
  4502.         if (e.Control && e.KeyCode == Keys.A)
  4503.         {
  4504.             Base.SelectAll();
  4505.             e.SuppressKeyPress = true;
  4506.         }
  4507.     }
  4508.     protected override void OnResize(EventArgs e)
  4509.     {
  4510.         Base.Location = new Point(4, 5);
  4511.         Base.Width = Width - 8;
  4512.  
  4513.         if (_Multiline)
  4514.         {
  4515.             Base.Height = Height - 5;
  4516.         }
  4517.  
  4518.  
  4519.         base.OnResize(e);
  4520.     }
  4521.  
  4522. }
  4523. #endregion
  4524.  
  4525. #region Listbox
  4526. class genesisListbox : ListBox
  4527. {
  4528.  
  4529.     public genesisListbox()
  4530.     {
  4531.         SetStyle(ControlStyles.DoubleBuffer, true);
  4532.         Font = new Font("Microsoft Sans Serif", 9);
  4533.         BorderStyle = System.Windows.Forms.BorderStyle.None;
  4534.         DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
  4535.         ItemHeight = 21;
  4536.         ForeColor = Color.Black;
  4537.         BackColor = Color.FromArgb(250, 250, 250);
  4538.         IntegralHeight = false;
  4539.     }
  4540.  
  4541.     protected override void WndProc(ref System.Windows.Forms.Message m)
  4542.     {
  4543.         base.WndProc(ref m);
  4544.         if (m.Msg == 15)
  4545.             CustomPaint();
  4546.     }
  4547.  
  4548.     private Image _Image;
  4549.     public Image ItemImage
  4550.     {
  4551.         get { return _Image; }
  4552.         set { _Image = value; }
  4553.     }
  4554.  
  4555.     protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)
  4556.     {
  4557.         try
  4558.         {
  4559.             if (e.Index < 0)
  4560.                 return;
  4561.             e.DrawBackground();
  4562.             Rectangle rect = new Rectangle(new Point(e.Bounds.Left, e.Bounds.Top + 2), new Size(Bounds.Width, 16));
  4563.             e.DrawFocusRectangle();
  4564.             if (Strings.InStr(e.State.ToString(), "Selected,") > 0)
  4565.             {
  4566.                 Rectangle x2 = e.Bounds;
  4567.                 Rectangle x3 = new Rectangle(x2.Location, new Size(x2.Width, (x2.Height / 2)));
  4568.                 LinearGradientBrush G1 = new LinearGradientBrush(new Point(x2.X, x2.Y), new Point(x2.X, x2.Y + x2.Height), Color.FromArgb(250, 250, 250), Color.FromArgb(210, 210, 210));
  4569.                 HatchBrush H = new HatchBrush(HatchStyle.LightDownwardDiagonal, Color.FromArgb(10, Color.Black), Color.Transparent);
  4570.                 e.Graphics.FillRectangle(G1, x2);
  4571.                 G1.Dispose();
  4572.                 e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(250, 250, 250)), x3);
  4573.                 e.Graphics.FillRectangle(H, x2);
  4574.                 G1.Dispose();
  4575.                 e.Graphics.DrawString(" " + Items[e.Index].ToString(), Font, Brushes.Black, 5, e.Bounds.Y + (e.Bounds.Height / 2) - 9);
  4576.                 e.Graphics.DrawRectangle(new Pen(Color.FromArgb(220, 220, 220)), new Rectangle(new Point(x2.Location.X, x2.Location.Y), new Size(x2.Width, x2.Height)));
  4577.             }
  4578.             else
  4579.             {
  4580.                 Rectangle x2 = e.Bounds;
  4581.                 e.Graphics.DrawString(" " + Items[e.Index].ToString(), Font, Brushes.Black, 5, e.Bounds.Y + (e.Bounds.Height / 2) - 9);
  4582.                 e.Graphics.DrawRectangle(new Pen(Color.FromArgb(240, 240, 240)), new Rectangle(new Point(x2.Location.X, x2.Location.Y), new Size(x2.Width, x2.Height)));
  4583.             }
  4584.             e.Graphics.DrawRectangle(new Pen(Color.FromArgb(220, 220, 220)), new Rectangle(0, 0, Width - 1, Height - 1));
  4585.             base.OnDrawItem(e);
  4586.         }
  4587.         catch (Exception ex)
  4588.         {
  4589.            
  4590.         }
  4591.     }
  4592.  
  4593.     public void CustomPaint()
  4594.     {
  4595.         CreateGraphics().DrawRectangle(new Pen(Color.FromArgb(220, 220, 220)), new Rectangle(0, 0, Width - 1, Height - 1));
  4596.     }
  4597. }
  4598. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement