Advertisement
theelitenoob

Elite Simple C# Theme!

Feb 23rd, 2012
1,964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 94.53 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. // Theme by M.A.
  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 System.Runtime.InteropServices;
  20. using Microsoft.VisualBasic;
  21. using System.Collections;
  22. using System.Data;
  23. using System.Diagnostics;
  24. using System.Text;
  25. using System.IO;
  26. using System.Drawing.Imaging;
  27. using System.ComponentModel.Design;
  28.  
  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 sealed 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 sealed 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.  
  2453. // ------------------
  2454. // Creator: The Elite Noob
  2455. // Created: 3-12-11
  2456. // Version: 2.0.0
  2457. // ThemeBase: 1.5.4 (by Aeonhack)
  2458. //------------------
  2459.  
  2460. class eliteSimple : ThemeContainer154 // The Theme Bar and Background, Aeonhacks themecode used as template for this
  2461. {
  2462.    
  2463.     public eliteSimple(){
  2464.         BackColor = Color.FromArgb(42, 42, 42); // Background Color
  2465.         TransparencyKey = Color.Purple; // The Color used for Transparent
  2466.         SetColor("Background", 42, 42, 42); // Background Color
  2467.         SetColor("DarkGradient", 32, 32, 32); // Used to Make a Gradient
  2468.         SetColor("BackgroundGradient", 42, 42, 42); // Used to make a Gradient
  2469.         SetColor("Line1", 42, 42, 42); // First Line Color
  2470.         SetColor("Line2", 28, 28, 28); // Second Line Color
  2471.         SetColor("Text", 254, 254, 254);// Text Color
  2472.         SetColor("Border1", 43, 43, 43); // First Border
  2473.         SetColor("Border2", 25, 25, 25); // Second Borders
  2474.     }
  2475.  
  2476.     // Declare some Variables
  2477.     // The Letter is Variable type, while the number is what color it is
  2478.     private Color C1;
  2479.     private Color C2;
  2480.     private Color C3;
  2481.     private Pen P1;
  2482.     private Pen P2;
  2483.     private Pen P3;
  2484.     private Pen P4;
  2485.     private SolidBrush B1;
  2486.  
  2487.     protected override void ColorHook(){ // Function by Aeonhack
  2488.         C1 = GetColor("Background"); // Get the Background Color
  2489.         C2 = GetColor("DarkGradient"); // Get the Dark Gradient
  2490.         C3 = GetColor("BackgroundGradient"); // The Light Gradient
  2491.         P1 = new Pen(GetColor("Line1")); // Create a Pen for the Line
  2492.         P2 = new Pen(GetColor("Line2"));
  2493.         P3 = new Pen(GetColor("Border1")); // Create a Pen for the Border
  2494.         P4 = new Pen(GetColor("Border2"));
  2495.         B1 = new SolidBrush(GetColor("Text")); // Set up a brush for the Text
  2496.         BackColor = C1; // Create a Second Variable for The Background Color
  2497.     }
  2498.  
  2499.     protected override void PaintHook(){ // Actually Create the Form, by Aeonhack
  2500.         G.Clear(C1); // Clear the Form with the Basic Color
  2501.         DrawGradient(C3, C2, 0, 0, Width, 25); // Draw the Background  Gradient
  2502.         G.DrawLine(P1, 0, 25, Width, 25); // Draw the Separtor for the Bar
  2503.         G.DrawLine(P2, 0, 25, Width, 25);
  2504.         DrawText(B1, HorizontalAlignment.Left, 5, 0); // Draw the Title Text
  2505.         DrawBorders(P3, 1); // Creating the Inner Border
  2506.         DrawBorders(P4); // Create the Outer Border
  2507.         DrawCorners(TransparencyKey); // Create a Corner with the Transparent Key
  2508.     }
  2509. }
  2510.  
  2511. // All Code from Here on is 100% Orignial and by The Elite Noob @ Hackforums
  2512.  
  2513. class eliteButton : ThemeControl154 // A Simple Button
  2514. {
  2515.  
  2516.     public eliteButton(){
  2517.         SetColor("DownGradient1", 42, 42, 42); // Basic Gradients Used to Shade the Button
  2518.         SetColor("DownGradient2", 50, 50, 50); // The Gradients are reversed, depending on if Button is Pressed or not
  2519.         SetColor("NoneGradient1", 50, 50, 50);
  2520.         SetColor("NoneGradient2", 42, 42, 42);
  2521.         SetColor("ClickedGradient1", 47, 47, 47);
  2522.         SetColor("ClickedGradient2", 39, 39, 39);
  2523.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2524.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2525.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2526.     }
  2527.  
  2528.     private Color C1; // Set up Simple Colors
  2529.     private Color C2;
  2530.     private Color C3;
  2531.     private Color C4;
  2532.     private Color C5;
  2533.     private Color C6;
  2534.     private SolidBrush B1; // A Brush to use text
  2535.     private Pen P1; // A Pen used to create borders
  2536.     private Pen P2;
  2537.  
  2538.     protected override void ColorHook(){ // Basic Function by Aeonhack
  2539.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2540.         C2 = GetColor("DownGradient2");
  2541.         C3 = GetColor("NoneGradient1");
  2542.         C4 = GetColor("NoneGradient2");
  2543.         C5 = GetColor("ClickedGradient1");
  2544.         C6 = GetColor("ClickedGradient2");
  2545.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2546.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2547.         P2 = new Pen(GetColor("Border2"));
  2548.     }
  2549.  
  2550.     protected override void PaintHook(){ // Basic Function by Aeonhack
  2551.         if(State == MouseState.Over){ // Used to see if button is Hovered over
  2552.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  2553.         }else if (State == MouseState.Down){
  2554.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2555.         } else {
  2556.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  2557.         }
  2558.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  2559.         DrawBorders(P1, 1); // Create the Inner Border
  2560.         DrawBorders(P2); // Create the Outer Border
  2561.         DrawCorners(BackColor); // Draw the Corners
  2562.     }
  2563. }
  2564.  
  2565. class eliteLabel : ThemeControl154 // Create a Custom Label
  2566. {
  2567.     public eliteLabel()
  2568.     { // Create a Label
  2569.         SetColor("Text", 254, 254, 254); // Text Color for Label
  2570.         SetColor("Background", 42, 42, 42); // Background Color
  2571.     }
  2572.  
  2573.     private Color C1; // used for the Basic Background of the Label
  2574.     private SolidBrush B1; // The Main Color of the Text, Is painted on with a brush
  2575.  
  2576.     protected override void ColorHook()
  2577.     { // Assigning the colors to variables
  2578.         C1 = GetColor("Background"); // Get the Background Color
  2579.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2580.     }
  2581.  
  2582.     protected override void PaintHook()
  2583.     {
  2584.         G.Clear(C1); // Clear the Color of Background
  2585.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Align Text In Center of Label
  2586.     }
  2587. }
  2588.  
  2589. class eliteBorderLabel : ThemeControl154 // A Simple Label with a Border
  2590. {
  2591.  
  2592.     public eliteBorderLabel()
  2593.     {
  2594.         SetColor("DownGradient1", 42, 42, 42); // Basic Gradients Used to Shade the Button
  2595.         SetColor("DownGradient2", 42, 42, 42); // The Gradients are reversed, depending on if Button is Pressed or not
  2596.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2597.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2598.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2599.     }
  2600.  
  2601.     private Color C1; // Set up Simple Colors
  2602.     private Color C2;
  2603.     private SolidBrush B1; // A Brush to use text
  2604.     private Pen P1; // A Pen used to create borders
  2605.     private Pen P2;
  2606.  
  2607.     protected override void ColorHook()
  2608.     { // Assign Variables
  2609.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2610.         C2 = GetColor("DownGradient2");
  2611.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2612.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2613.         P2 = new Pen(GetColor("Border2"));
  2614.     }
  2615.  
  2616.     protected override void PaintHook()
  2617.     { // Draw Custom Label
  2618.         DrawGradient(C1, C2, ClientRectangle, 90f); // if button is pressed
  2619.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  2620.         DrawBorders(P1, 1); // Create the Inner Border
  2621.         DrawBorders(P2); // Create the Outer Border
  2622.         DrawCorners(BackColor); // Draw the Corners
  2623.     }
  2624. }
  2625.  
  2626. class eliteHide : ThemeControl154 // A Hide Button for the App
  2627. {
  2628.     public FormWindowState WindowState { get; set; }
  2629.     public eliteHide()
  2630.     {
  2631.         SetColor("DownGradient1", 140, 138, 27); // Basic Gradients Used to Shade the Button
  2632.         SetColor("DownGradient2", 180, 196, 114); // The Gradients are reversed, depending on if Button is Pressed or not
  2633.         SetColor("NoneGradient1", 50, 50, 50);
  2634.         SetColor("NoneGradient2", 42, 42, 42);
  2635.         SetColor("ClickedGradient1", 204, 201, 35);
  2636.         SetColor("ClickedGradient2", 140, 138, 27);
  2637.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2638.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2639.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2640.     }
  2641.  
  2642.     private Color C1; // Set up Simple Colors
  2643.     private Color C2;
  2644.     private Color C3;
  2645.     private Color C4;
  2646.     private Color C5;
  2647.     private Color C6;
  2648.     private SolidBrush B1; // A Brush to use text
  2649.     private Pen P1; // A Pen used to create borders
  2650.     private Pen P2;
  2651.  
  2652.     protected override void ColorHook()
  2653.     {
  2654.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2655.         C2 = GetColor("DownGradient2");
  2656.         C3 = GetColor("NoneGradient1");
  2657.         C4 = GetColor("NoneGradient2");
  2658.         C5 = GetColor("ClickedGradient1");
  2659.         C6 = GetColor("ClickedGradient2");
  2660.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2661.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2662.         P2 = new Pen(GetColor("Border2"));
  2663.     }
  2664.  
  2665.     protected override void PaintHook()
  2666.     {
  2667.         if (this.State == MouseState.Over)
  2668.         { // Used to see if button is Hovered over
  2669.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  2670.             this.Text = "_";
  2671.         }
  2672.         else if (this.State == MouseState.Down)
  2673.         {
  2674.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2675.             this.Text = "_";
  2676.             Application.OpenForms[0].WindowState = FormWindowState.Minimized;
  2677.         }
  2678.         else
  2679.         {
  2680.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  2681.         }
  2682.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  2683.         DrawBorders(P1, 1); // Create the Inner Border
  2684.         DrawBorders(P2); // Create the Outer Border
  2685.         DrawCorners(BackColor); // Draw the Corners
  2686.     }
  2687.  
  2688. }
  2689.  
  2690. class eliteHideSecond : ThemeControl154 // A Hide Button for the App
  2691. {
  2692.     public eliteHideSecond()
  2693.     {
  2694.         SetColor("DownGradient1", 140, 138, 27); // Basic Gradients Used to Shade the Button
  2695.         SetColor("DownGradient2", 180, 196, 114); // The Gradients are reversed, depending on if Button is Pressed or not
  2696.         SetColor("NoneGradient1", 50, 50, 50);
  2697.         SetColor("NoneGradient2", 42, 42, 42);
  2698.         SetColor("ClickedGradient1", 204, 201, 35);
  2699.         SetColor("ClickedGradient2", 140, 138, 27);
  2700.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2701.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2702.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2703.     }
  2704.  
  2705.     private Color C1; // Set up Simple Colors
  2706.     private Color C2;
  2707.     private Color C3;
  2708.     private Color C4;
  2709.     private Color C5;
  2710.     private Color C6;
  2711.     private SolidBrush B1; // A Brush to use text
  2712.     private Pen P1; // A Pen used to create borders
  2713.     private Pen P2;
  2714.  
  2715.     protected override void ColorHook()
  2716.     {
  2717.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2718.         C2 = GetColor("DownGradient2");
  2719.         C3 = GetColor("NoneGradient1");
  2720.         C4 = GetColor("NoneGradient2");
  2721.         C5 = GetColor("ClickedGradient1");
  2722.         C6 = GetColor("ClickedGradient2");
  2723.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2724.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2725.         P2 = new Pen(GetColor("Border2"));
  2726.     }
  2727.  
  2728.     protected override void PaintHook()
  2729.     {
  2730.         if (this.State == MouseState.Over)
  2731.         { // Used to see if button is Hovered over
  2732.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  2733.             this.Text = "_";
  2734.         }
  2735.         else if (this.State == MouseState.Down)
  2736.         {
  2737.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2738.             this.Text = "_";
  2739.             Application.OpenForms[1].WindowState = FormWindowState.Minimized;
  2740.         }
  2741.         else
  2742.         {
  2743.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  2744.         }
  2745.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  2746.         DrawBorders(P1, 1); // Create the Inner Border
  2747.         DrawBorders(P2); // Create the Outer Border
  2748.         DrawCorners(BackColor); // Draw the Corners
  2749.     }
  2750.  
  2751. }
  2752.  
  2753. class eliteQuestion : ThemeControl154 // A simple QuestionMark Button for the App
  2754. {
  2755.     public eliteQuestion()
  2756.     {
  2757.         SetColor("DownGradient1", 140, 138, 27); // Basic Gradients Used to Shade the Button
  2758.         SetColor("DownGradient2", 180, 196, 114); // The Gradients are reversed, depending on if Button is Pressed or not
  2759.         SetColor("NoneGradient1", 50, 50, 50);
  2760.         SetColor("NoneGradient2", 42, 42, 42);
  2761.         SetColor("ClickedGradient1", 204, 201, 35);
  2762.         SetColor("ClickedGradient2", 140, 138, 27);
  2763.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2764.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2765.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2766.     }
  2767.  
  2768.     private Color C1; // Set up Simple Colors
  2769.     private Color C2;
  2770.     private Color C3;
  2771.     private Color C4;
  2772.     private Color C5;
  2773.     private Color C6;
  2774.     private SolidBrush B1; // A Brush to use text
  2775.     private Pen P1; // A Pen used to create borders
  2776.     private Pen P2;
  2777.  
  2778.     protected override void ColorHook()
  2779.     {
  2780.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2781.         C2 = GetColor("DownGradient2");
  2782.         C3 = GetColor("NoneGradient1");
  2783.         C4 = GetColor("NoneGradient2");
  2784.         C5 = GetColor("ClickedGradient1");
  2785.         C6 = GetColor("ClickedGradient2");
  2786.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2787.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2788.         P2 = new Pen(GetColor("Border2"));
  2789.     }
  2790.  
  2791.     protected override void PaintHook()
  2792.     {
  2793.         if (this.State == MouseState.Over)
  2794.         { // Used to see if button is Hovered over
  2795.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  2796.             this.Text = "?";
  2797.         }
  2798.         else if (this.State == MouseState.Down)
  2799.         {
  2800.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2801.             this.Text = "?";
  2802.         }
  2803.         else
  2804.         {
  2805.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  2806.         }
  2807.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  2808.         DrawBorders(P1, 1); // Create the Inner Border
  2809.         DrawBorders(P2); // Create the Outer Border
  2810.         DrawCorners(BackColor); // Draw the Corners
  2811.     }
  2812.  
  2813. }
  2814.  
  2815. class eliteClose : ThemeControl154 // A Close Button for the App
  2816. {
  2817.  
  2818.     public eliteClose() {
  2819.         SetColor("DownGradient1", 210, 15, 13); // Basic Gradients Used to Shade the Button
  2820.         SetColor("DownGradient2", 243, 97, 24); // The Gradients are reversed, depending on if Button is Pressed or not
  2821.         SetColor("NoneGradient1", 50, 50, 50);
  2822.         SetColor("NoneGradient2", 42, 42, 42);
  2823.         SetColor("ClickedGradient1", 247, 127, 30);
  2824.         SetColor("ClickedGradient2", 210, 15, 13);
  2825.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2826.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2827.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2828.     }
  2829.  
  2830.     private Color C1; // Set up Simple Colors
  2831.     private Color C2;
  2832.     private Color C3;
  2833.     private Color C4;
  2834.     private Color C5;
  2835.     private Color C6;
  2836.     private SolidBrush B1; // A Brush to use text
  2837.     private Pen P1; // A Pen used to create borders
  2838.     private Pen P2;
  2839.  
  2840.     protected override void ColorHook(){
  2841.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2842.         C2 = GetColor("DownGradient2");
  2843.         C3 = GetColor("NoneGradient1");
  2844.         C4 = GetColor("NoneGradient2");
  2845.         C5 = GetColor("ClickedGradient1");
  2846.         C6 = GetColor("ClickedGradient2");
  2847.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2848.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2849.         P2 = new Pen(GetColor("Border2"));
  2850.     }
  2851.  
  2852.     protected override void PaintHook(){
  2853.         if(this.State == MouseState.Over){ // Used to see if button is Hovered over
  2854.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  2855.             this.Text = "x";
  2856.         }else if (this.State == MouseState.Down){
  2857.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2858.             this.Text = "x";
  2859.             Application.Exit();
  2860.         } else {
  2861.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  2862.         }
  2863.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  2864.         DrawBorders(P1, 1); // Create the Inner Border
  2865.         DrawBorders(P2); // Create the Outer Border
  2866.         DrawCorners(BackColor); // Draw the Corners
  2867.     }
  2868.    
  2869. }
  2870.  
  2871. class eliteCloseSecond : ThemeControl154 // A Close Button for the App
  2872. {
  2873.  
  2874.     public eliteCloseSecond()
  2875.     {
  2876.         SetColor("DownGradient1", 210, 15, 13); // Basic Gradients Used to Shade the Button
  2877.         SetColor("DownGradient2", 243, 97, 24); // The Gradients are reversed, depending on if Button is Pressed or not
  2878.         SetColor("NoneGradient1", 50, 50, 50);
  2879.         SetColor("NoneGradient2", 42, 42, 42);
  2880.         SetColor("ClickedGradient1", 247, 127, 30);
  2881.         SetColor("ClickedGradient2", 210, 15, 13);
  2882.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2883.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2884.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2885.     }
  2886.  
  2887.     private Color C1; // Set up Simple Colors
  2888.     private Color C2;
  2889.     private Color C3;
  2890.     private Color C4;
  2891.     private Color C5;
  2892.     private Color C6;
  2893.     private SolidBrush B1; // A Brush to use text
  2894.     private Pen P1; // A Pen used to create borders
  2895.     private Pen P2;
  2896.  
  2897.     protected override void ColorHook()
  2898.     {
  2899.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2900.         C2 = GetColor("DownGradient2");
  2901.         C3 = GetColor("NoneGradient1");
  2902.         C4 = GetColor("NoneGradient2");
  2903.         C5 = GetColor("ClickedGradient1");
  2904.         C6 = GetColor("ClickedGradient2");
  2905.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2906.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2907.         P2 = new Pen(GetColor("Border2"));
  2908.     }
  2909.  
  2910.     protected override void PaintHook()
  2911.     {
  2912.         if (this.State == MouseState.Over)
  2913.         { // Used to see if button is Hovered over
  2914.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  2915.             this.Text = "x";
  2916.         }
  2917.         else if (this.State == MouseState.Down)
  2918.         {
  2919.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2920.             this.Text = "x";
  2921.         }
  2922.         else
  2923.         {
  2924.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  2925.         }
  2926.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  2927.         DrawBorders(P1, 1); // Create the Inner Border
  2928.         DrawBorders(P2); // Create the Outer Border
  2929.         DrawCorners(BackColor); // Draw the Corners
  2930.     }
  2931.  
  2932. }
  2933.  
  2934. class eliteMaximize : ThemeControl154 // A Normal Size, Max Sze Button for the App
  2935. {
  2936.     public FormWindowState WindowState { get; set; }
  2937.     public eliteMaximize()
  2938.     {
  2939.         SetColor("DownGradient1", 140, 138, 27); // Basic Gradients Used to Shade the Button
  2940.         SetColor("DownGradient2", 180, 196, 114); // The Gradients are reversed, depending on if Button is Pressed or not
  2941.         SetColor("NoneGradient1", 50, 50, 50);
  2942.         SetColor("NoneGradient2", 42, 42, 42);
  2943.         SetColor("ClickedGradient1", 204, 201, 35);
  2944.         SetColor("ClickedGradient2", 140, 138, 27);
  2945.         SetColor("Text", 254, 254, 254); // The Color for the Text
  2946.         SetColor("Border1", 35, 35, 35); // The Inside Border
  2947.         SetColor("Border2", 42, 42, 42); // The Outside Border
  2948.     }
  2949.  
  2950.     private Color C1; // Set up Simple Colors
  2951.     private Color C2;
  2952.     private Color C3;
  2953.     private Color C4;
  2954.     private Color C5;
  2955.     private Color C6;
  2956.     private SolidBrush B1; // A Brush to use text
  2957.     private Pen P1; // A Pen used to create borders
  2958.     private Pen P2;
  2959.  
  2960.     protected override void ColorHook()
  2961.     {
  2962.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  2963.         C2 = GetColor("DownGradient2");
  2964.         C3 = GetColor("NoneGradient1");
  2965.         C4 = GetColor("NoneGradient2");
  2966.         C5 = GetColor("ClickedGradient1");
  2967.         C6 = GetColor("ClickedGradient2");
  2968.         B1 = new SolidBrush(GetColor("Text")); // Set up Color for the Text
  2969.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  2970.         P2 = new Pen(GetColor("Border2"));
  2971.     }
  2972.  
  2973.     protected override void PaintHook()
  2974.     {
  2975.         if (this.State == MouseState.Over)
  2976.         { // Used to see if button is Hovered over
  2977.             DrawGradient(C1, C2, ClientRectangle, 90f); // if button is hovered over
  2978.             if (Application.OpenForms[0].WindowState == FormWindowState.Normal)
  2979.             {
  2980.                 this.Text = "+";
  2981.             }
  2982.             else if (Application.OpenForms[0].WindowState == FormWindowState.Maximized)
  2983.             {
  2984.                 this.Text = "-";
  2985.             }
  2986.         }
  2987.         else if (this.State == MouseState.Down)
  2988.         {
  2989.             DrawGradient(C6, C5, ClientRectangle, 90f);
  2990.             if (Application.OpenForms[0].WindowState == FormWindowState.Normal)
  2991.             {
  2992.                 this.Text = "+";
  2993.                 System.Threading.Thread.Sleep(100);
  2994.                 Application.OpenForms[0].WindowState = FormWindowState.Maximized;
  2995.                 this.Text = "-";
  2996.             }
  2997.             else if (Application.OpenForms[0].WindowState == FormWindowState.Maximized)
  2998.             {
  2999.                 this.Text = "-";
  3000.                 System.Threading.Thread.Sleep(100);
  3001.                 Application.OpenForms[0].WindowState = FormWindowState.Normal;
  3002.                 this.Text = "+";
  3003.             }
  3004.         }
  3005.         else
  3006.         {
  3007.             DrawGradient(C3, C4, ClientRectangle, 90f); // else change the shading
  3008.         }
  3009.         DrawText(B1, HorizontalAlignment.Center, 0, 0); // Draw the Text Smack dab in the middle of the button
  3010.         DrawBorders(P1, 1); // Create the Inner Border
  3011.         DrawBorders(P2); // Create the Outer Border
  3012.         DrawCorners(BackColor); // Draw the Corners
  3013.     }
  3014. }
  3015.  
  3016. class eliteSeparatorHorizontal : ThemeControl154 // A Horizontal Separator
  3017. {
  3018.  
  3019.     public eliteSeparatorHorizontal()
  3020.     {
  3021.         SetColor("DownGradient1", 42, 42, 42); // Basic Gradients Used to Shade the Button
  3022.         SetColor("DownGradient2", 42, 42, 42); // The Gradients are reversed, depending on if Button is Pressed or not
  3023.         SetColor("Border1", 35, 35, 35); // The Inside Border
  3024.         SetColor("Border2", 42, 42, 42); // The Outside Border
  3025.     }
  3026.  
  3027.     private Color C1; // Set up Simple Colors
  3028.     private Color C2;
  3029.     private Pen P1; // A Pen used to create borders
  3030.     private Pen P2;
  3031.  
  3032.     protected override void ColorHook()
  3033.     { // Assign Variables
  3034.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3035.         C2 = GetColor("DownGradient2");
  3036.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3037.         P2 = new Pen(GetColor("Border2"));
  3038.     }
  3039.  
  3040.     protected override void PaintHook()
  3041.     { // Draw Custom Label
  3042.         DrawGradient(C1, C2, ClientRectangle, 90f); // if button is pressed
  3043.         DrawBorders(P1, 1); // Create the Inner Border
  3044.         DrawBorders(P2); // Create the Outer Border
  3045.         DrawCorners(BackColor); // Draw the Corners
  3046.     }
  3047.  
  3048.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  3049.     {
  3050.         // EDIT: ADD AN EXTRA HEIGHT VALIDATION TO AVOID INITIALIZATION PROBLEMS
  3051.         // BITWISE 'AND' OPERATION: IF ZERO THEN HEIGHT IS NOT INVOLVED IN THIS OPERATION
  3052.         if ((specified & BoundsSpecified.Height) == 0 || height == 4)
  3053.         {
  3054.             base.SetBoundsCore(x, y, width, 4, specified);
  3055.         }
  3056.         else
  3057.         {
  3058.             return; // RETURN WITHOUT DOING ANY RESIZING
  3059.         }
  3060.     }
  3061. }
  3062.  
  3063. class eliteSeparatorVertical : ThemeControl154 // A Vertical Seperator
  3064. {
  3065.  
  3066.     public eliteSeparatorVertical()
  3067.     {
  3068.         SetColor("DownGradient1", 42, 42, 42); // Basic Gradients Used to Shade the Button
  3069.         SetColor("DownGradient2", 42, 42, 42); // The Gradients are reversed, depending on if Button is Pressed or not
  3070.         SetColor("Border1", 35, 35, 35); // The Inside Border
  3071.         SetColor("Border2", 42, 42, 42); // The Outside Border
  3072.     }
  3073.  
  3074.     private Color C1; // Set up Simple Colors
  3075.     private Color C2;
  3076.     private Pen P1; // A Pen used to create borders
  3077.     private Pen P2;
  3078.  
  3079.     protected override void ColorHook()
  3080.     { // Assign Variables
  3081.         C1 = GetColor("DownGradient1"); // Get the Colors for the Button Shading
  3082.         C2 = GetColor("DownGradient2");
  3083.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3084.         P2 = new Pen(GetColor("Border2"));
  3085.     }
  3086.  
  3087.     protected override void PaintHook()
  3088.     { // Draw Custom Label
  3089.         DrawGradient(C1, C2, ClientRectangle, 90f); // if button is pressed
  3090.         DrawBorders(P1, 1); // Create the Inner Border
  3091.         DrawBorders(P2); // Create the Outer Border
  3092.         DrawCorners(BackColor); // Draw the Corners
  3093.     }
  3094.  
  3095.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  3096.     {
  3097.         // EDIT: ADD AN EXTRA HEIGHT VALIDATION TO AVOID INITIALIZATION PROBLEMS
  3098.         // BITWISE 'AND' OPERATION: IF ZERO THEN HEIGHT IS NOT INVOLVED IN THIS OPERATION
  3099.         if ((specified & BoundsSpecified.Width) == 0 || width == 4)
  3100.         {
  3101.             base.SetBoundsCore(x, y, 4, height, specified);
  3102.         }
  3103.         else
  3104.         {
  3105.             return; // RETURN WITHOUT DOING ANY RESIZING
  3106.         }
  3107.     }
  3108. }
  3109.  
  3110. [DefaultEvent("CheckedChanged")] // This is used to see if it is a checkbox and so on.
  3111. class eliteCheckBox : ThemeControl154 // This Checkbox uses a green middle
  3112. {
  3113.  
  3114.     public eliteCheckBox()
  3115.     {
  3116.         Transparent = true; // it is infact transpernt
  3117.         BackColor = Color.Transparent;
  3118.         // no lockheight since that way they can choose how they want it.
  3119.         // 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.
  3120.         SetColor("Background", 249, 249, 249); // Background is Dark
  3121.         SetColor("ClickedGradient1", 204, 201, 35); // the green graident on the inside.
  3122.         SetColor("ClickedGradient2", 140, 138, 27);
  3123.         SetColor("Border1", 235, 235, 235); // The Inside Border
  3124.         SetColor("Border2", 249, 249, 249); // The Outside Border
  3125.     }
  3126.  
  3127.     // set up the variables
  3128.     private Color C1; // Set up Simple Colors
  3129.     private Color C2;
  3130.     private Color C3;
  3131.     private Pen P1; // A Pen used to create borders
  3132.     private Pen P2;
  3133.  
  3134.     protected override void ColorHook()
  3135.     {
  3136.         C1 = GetColor("Background"); // Get the Colors for the Button Shading
  3137.         C2 = GetColor("ClickedGradient1");
  3138.         C3 = GetColor("ClickedGradient2");
  3139.         P1 = new Pen(GetColor("Border1")); // Get and create the borders for the Buttons
  3140.         P2 = new Pen(GetColor("Border2"));
  3141.     }
  3142.  
  3143.     protected override void PaintHook()
  3144.     {
  3145.         G.Clear(BackColor);
  3146.         switch (_Checked)
  3147.         {
  3148.             case true:
  3149.                 //Put your checked state here
  3150.                 DrawGradient(C1, C1, ClientRectangle, 90f); // checked background
  3151.                 DrawGradient(C2, C3, 3, 3, this.Width-6, this.Height-6, 90f); // checked background
  3152.                 DrawBorders(P1, 1); // Create the Inner Border
  3153.                 this.Height = this.Width;
  3154.                 DrawBorders(P2); // Create the Outer Border
  3155.                 DrawCorners(BackColor); // Draw the Corners
  3156.                 break;
  3157.             case false:
  3158.                 //Put your unchecked state here
  3159.                 DrawGradient(C1, C1, ClientRectangle, 90f); // unchecked background
  3160.                 DrawBorders(P1, 1); // Create the Inner Border
  3161.                 this.Height = this.Width;
  3162.                 DrawBorders(P2); // Create the Outer Border
  3163.                 DrawCorners(BackColor); // Draw the Corners
  3164.                 break;
  3165.         }
  3166.     }
  3167.  
  3168.  
  3169.     private bool _Checked { get; set; }
  3170.     public bool Checked
  3171.     {
  3172.         get { return _Checked; }
  3173.         set { _Checked = value; }
  3174.     }
  3175.     protected override void OnClick(System.EventArgs e)
  3176.     {
  3177.         _Checked = !_Checked;
  3178.         if (CheckedChanged != null)
  3179.         {
  3180.             CheckedChanged(this);
  3181.         }
  3182.         base.OnClick(e);
  3183.     }
  3184.     public event CheckedChangedEventHandler CheckedChanged;
  3185.     public delegate void CheckedChangedEventHandler(object sender);
  3186. }
  3187.  
  3188. private class elitePanelBacking : UserControl // A custom Panel based on the pre-made Panel
  3189. {
  3190.     private Panel panelMain;
  3191.  
  3192.     public elitePanelBacking()
  3193.     {
  3194.         InitializeComponent();
  3195.     }
  3196.  
  3197.     private void InitializeComponent()
  3198.     {
  3199.         this.panelMain = new System.Windows.Forms.Panel();
  3200.         this.SuspendLayout();
  3201.         Color Background = Color.FromArgb(249, 249, 249);
  3202.         //
  3203.         // panelMain
  3204.         //
  3205.         this.panelMain.BackColor = Background;
  3206.         this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
  3207.         this.panelMain.Location = new System.Drawing.Point(0, 0);
  3208.         this.panelMain.Name = "elitePanelMainBacking";
  3209.         this.panelMain.Size = new System.Drawing.Size(150, 150);
  3210.         this.panelMain.TabIndex = 0;
  3211.         //
  3212.         // myPanel
  3213.         //
  3214.         this.Controls.Add(this.panelMain);
  3215.         this.Name = "elitePanelBacking";
  3216.         this.ResumeLayout(false);
  3217.     }
  3218. }
  3219.  
  3220. public class eliteGroupBox : UserControl // A custom Groupbox based on the pre-made Groupbox
  3221. {
  3222.     private GroupBox panelMain;
  3223.  
  3224.     public eliteGroupBox()
  3225.     {
  3226.         InitializeComponent();
  3227.     }
  3228.  
  3229.     private void InitializeComponent()
  3230.     {
  3231.         this.panelMain = new System.Windows.Forms.GroupBox();
  3232.         this.SuspendLayout();
  3233.         Color Background = Color.FromArgb(42, 42, 42);
  3234.         //
  3235.         // panelMain
  3236.         //
  3237.         this.panelMain.BackColor = Background;
  3238.         this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
  3239.         this.panelMain.Location = new System.Drawing.Point(0, 0);
  3240.         this.panelMain.Name = "eliteGroupBoxMain";
  3241.         this.panelMain.Size = new System.Drawing.Size(140, 140);
  3242.         this.panelMain.TabIndex = 0;
  3243.         //
  3244.         // myPanel
  3245.         //
  3246.         this.Controls.Add(this.panelMain);
  3247.         this.Name = "eliteGroupBox";
  3248.         this.ResumeLayout(false);
  3249.     }
  3250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement