Ethernal_Five

[C#] Evolve Theme by Mavamaarten

Apr 4th, 2012
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 97.19 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Reflection;
  6. using System.Diagnostics;
  7. using System.Collections;
  8. using System.Windows.Forms;
  9. using Microsoft.VisualBasic;
  10. using System.ComponentModel;
  11. using System.Drawing.Imaging;
  12. using System.Drawing.Drawing2D;
  13. using System.Collections.Generic;
  14. using System.Runtime.InteropServices;
  15.  
  16.  
  17. //############|CREDITS|############
  18. //# Theme: Mavamaarten            #
  19. //# Themebase: Aeonhack           #
  20. //# Converted to C#: Ethernal Five#
  21. //#################################
  22.  
  23.  
  24. #region "Themebase"
  25. //------------------
  26. //Creator: aeonhack
  27. //Site: elitevs.net
  28. //Created: 08/02/2011
  29. //Changed: 12/06/2011
  30. //Version: 1.5.4
  31. //------------------
  32.  
  33. abstract class ThemeContainer154 : ContainerControl
  34. {
  35.  
  36.     #region " Initialization "
  37.  
  38.     protected Graphics G;
  39.  
  40.     protected Bitmap B;
  41.     public ThemeContainer154()
  42.     {
  43.         SetStyle((ControlStyles)139270, true);
  44.  
  45.         _ImageSize = Size.Empty;
  46.         Font = new Font("Verdana", 8);
  47.  
  48.         MeasureBitmap = new Bitmap(1, 1);
  49.         MeasureGraphics = Graphics.FromImage(MeasureBitmap);
  50.  
  51.         DrawRadialPath = new GraphicsPath();
  52.  
  53.         InvalidateCustimization();
  54.     }
  55.  
  56.     protected override sealed void OnHandleCreated(EventArgs e)
  57.     {
  58.         if (DoneCreation)
  59.             InitializeMessages();
  60.  
  61.         InvalidateCustimization();
  62.         ColorHook();
  63.  
  64.         if (!(_LockWidth == 0))
  65.             Width = _LockWidth;
  66.         if (!(_LockHeight == 0))
  67.             Height = _LockHeight;
  68.         if (!_ControlMode)
  69.             base.Dock = DockStyle.Fill;
  70.  
  71.         Transparent = _Transparent;
  72.         if (_Transparent && _BackColor)
  73.             BackColor = Color.Transparent;
  74.  
  75.         base.OnHandleCreated(e);
  76.     }
  77.  
  78.     private bool DoneCreation;
  79.     protected override sealed void OnParentChanged(EventArgs e)
  80.     {
  81.         base.OnParentChanged(e);
  82.  
  83.         if (Parent == null)
  84.             return;
  85.         _IsParentForm = Parent is Form;
  86.  
  87.         if (!_ControlMode)
  88.         {
  89.             InitializeMessages();
  90.  
  91.             if (_IsParentForm)
  92.             {
  93.                 ParentForm.FormBorderStyle = _BorderStyle;
  94.                 ParentForm.TransparencyKey = _TransparencyKey;
  95.  
  96.                 if (!DesignMode)
  97.                 {
  98.                     ParentForm.Shown += FormShown;
  99.                 }
  100.             }
  101.  
  102.             Parent.BackColor = BackColor;
  103.         }
  104.  
  105.         OnCreation();
  106.         DoneCreation = true;
  107.         InvalidateTimer();
  108.     }
  109.  
  110.     #endregion
  111.  
  112.     private void DoAnimation(bool i)
  113.     {
  114.         OnAnimation();
  115.         if (i)
  116.             Invalidate();
  117.     }
  118.  
  119.     protected override sealed void OnPaint(PaintEventArgs e)
  120.     {
  121.         if (Width == 0 || Height == 0)
  122.             return;
  123.  
  124.         if (_Transparent && _ControlMode)
  125.         {
  126.             PaintHook();
  127.             e.Graphics.DrawImage(B, 0, 0);
  128.         }
  129.         else
  130.         {
  131.             G = e.Graphics;
  132.             PaintHook();
  133.         }
  134.     }
  135.  
  136.     protected override void OnHandleDestroyed(EventArgs e)
  137.     {
  138.         ThemeShare.RemoveAnimationCallback(DoAnimation);
  139.         base.OnHandleDestroyed(e);
  140.     }
  141.  
  142.     private bool HasShown;
  143.     private void FormShown(object sender, EventArgs e)
  144.     {
  145.         if (_ControlMode || HasShown)
  146.             return;
  147.  
  148.         if (_StartPosition == FormStartPosition.CenterParent || _StartPosition == FormStartPosition.CenterScreen)
  149.         {
  150.             Rectangle SB = Screen.PrimaryScreen.Bounds;
  151.             Rectangle CB = ParentForm.Bounds;
  152.             ParentForm.Location = new Point(SB.Width / 2 - CB.Width / 2, SB.Height / 2 - CB.Width / 2);
  153.         }
  154.  
  155.         HasShown = true;
  156.     }
  157.  
  158.  
  159.     #region " Size Handling "
  160.  
  161.     private Rectangle Frame;
  162.     protected override sealed void OnSizeChanged(EventArgs e)
  163.     {
  164.         if (_Movable && !_ControlMode)
  165.         {
  166.             Frame = new Rectangle(7, 7, Width - 14, _Header - 7);
  167.         }
  168.  
  169.         InvalidateBitmap();
  170.         Invalidate();
  171.  
  172.         base.OnSizeChanged(e);
  173.     }
  174.  
  175.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  176.     {
  177.         if (!(_LockWidth == 0))
  178.             width = _LockWidth;
  179.         if (!(_LockHeight == 0))
  180.             height = _LockHeight;
  181.         base.SetBoundsCore(x, y, width, height, specified);
  182.     }
  183.  
  184.     #endregion
  185.  
  186.     #region " State Handling "
  187.  
  188.     protected MouseState State;
  189.     private void SetState(MouseState current)
  190.     {
  191.         State = current;
  192.         Invalidate();
  193.     }
  194.  
  195.     protected override void OnMouseMove(MouseEventArgs e)
  196.     {
  197.         if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized))
  198.         {
  199.             if (_Sizable && !_ControlMode)
  200.                 InvalidateMouse();
  201.         }
  202.  
  203.         base.OnMouseMove(e);
  204.     }
  205.  
  206.     protected override void OnEnabledChanged(EventArgs e)
  207.     {
  208.         if (Enabled)
  209.             SetState(MouseState.None);
  210.         else
  211.             SetState(MouseState.Block);
  212.         base.OnEnabledChanged(e);
  213.     }
  214.  
  215.     protected override void OnMouseEnter(EventArgs e)
  216.     {
  217.         SetState(MouseState.Over);
  218.         base.OnMouseEnter(e);
  219.     }
  220.  
  221.     protected override void OnMouseUp(MouseEventArgs e)
  222.     {
  223.         SetState(MouseState.Over);
  224.         base.OnMouseUp(e);
  225.     }
  226.  
  227.     protected override void OnMouseLeave(EventArgs e)
  228.     {
  229.         SetState(MouseState.None);
  230.  
  231.         if (GetChildAtPoint(PointToClient(MousePosition)) != null)
  232.         {
  233.             if (_Sizable && !_ControlMode)
  234.             {
  235.                 Cursor = Cursors.Default;
  236.                 Previous = 0;
  237.             }
  238.         }
  239.  
  240.         base.OnMouseLeave(e);
  241.     }
  242.  
  243.     protected override void OnMouseDown(MouseEventArgs e)
  244.     {
  245.         if (e.Button == System.Windows.Forms.MouseButtons.Left)
  246.             SetState(MouseState.Down);
  247.  
  248.         if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized || _ControlMode))
  249.         {
  250.             if (_Movable && Frame.Contains(e.Location))
  251.             {
  252.                 Capture = false;
  253.                 WM_LMBUTTONDOWN = true;
  254.                 DefWndProc(ref Messages[0]);
  255.             }
  256.             else if (_Sizable && !(Previous == 0))
  257.             {
  258.                 Capture = false;
  259.                 WM_LMBUTTONDOWN = true;
  260.                 DefWndProc(ref Messages[Previous]);
  261.             }
  262.         }
  263.  
  264.         base.OnMouseDown(e);
  265.     }
  266.  
  267.     private bool WM_LMBUTTONDOWN;
  268.     protected override void WndProc(ref Message m)
  269.     {
  270.         base.WndProc(ref m);
  271.  
  272.         if (WM_LMBUTTONDOWN && m.Msg == 513)
  273.         {
  274.             WM_LMBUTTONDOWN = false;
  275.  
  276.             SetState(MouseState.Over);
  277.             if (!_SmartBounds)
  278.                 return;
  279.  
  280.             if (IsParentMdi)
  281.             {
  282.                 CorrectBounds(new Rectangle(Point.Empty, Parent.Parent.Size));
  283.             }
  284.             else
  285.             {
  286.                 CorrectBounds(Screen.FromControl(Parent).WorkingArea);
  287.             }
  288.         }
  289.     }
  290.  
  291.     private Point GetIndexPoint;
  292.     private bool B1;
  293.     private bool B2;
  294.     private bool B3;
  295.     private bool B4;
  296.     private int GetIndex()
  297.     {
  298.         GetIndexPoint = PointToClient(MousePosition);
  299.         B1 = GetIndexPoint.X < 7;
  300.         B2 = GetIndexPoint.X > Width - 7;
  301.         B3 = GetIndexPoint.Y < 7;
  302.         B4 = GetIndexPoint.Y > Height - 7;
  303.  
  304.         if (B1 && B3)
  305.             return 4;
  306.         if (B1 && B4)
  307.             return 7;
  308.         if (B2 && B3)
  309.             return 5;
  310.         if (B2 && B4)
  311.             return 8;
  312.         if (B1)
  313.             return 1;
  314.         if (B2)
  315.             return 2;
  316.         if (B3)
  317.             return 3;
  318.         if (B4)
  319.             return 6;
  320.         return 0;
  321.     }
  322.  
  323.     private int Current;
  324.     private int Previous;
  325.     private void InvalidateMouse()
  326.     {
  327.         Current = GetIndex();
  328.         if (Current == Previous)
  329.             return;
  330.  
  331.         Previous = Current;
  332.         switch (Previous)
  333.         {
  334.             case 0:
  335.                 Cursor = Cursors.Default;
  336.                 break;
  337.             case 1:
  338.             case 2:
  339.                 Cursor = Cursors.SizeWE;
  340.                 break;
  341.             case 3:
  342.             case 6:
  343.                 Cursor = Cursors.SizeNS;
  344.                 break;
  345.             case 4:
  346.             case 8:
  347.                 Cursor = Cursors.SizeNWSE;
  348.                 break;
  349.             case 5:
  350.             case 7:
  351.                 Cursor = Cursors.SizeNESW;
  352.                 break;
  353.         }
  354.     }
  355.  
  356.     private Message[] Messages = new Message[9];
  357.     private void InitializeMessages()
  358.     {
  359.         Messages[0] = Message.Create(Parent.Handle, 161, new IntPtr(2), IntPtr.Zero);
  360.         for (int I = 1; I <= 8; I++)
  361.         {
  362.             Messages[I] = Message.Create(Parent.Handle, 161, new IntPtr(I + 9), IntPtr.Zero);
  363.         }
  364.     }
  365.  
  366.     private void CorrectBounds(Rectangle bounds)
  367.     {
  368.         if (Parent.Width > bounds.Width)
  369.             Parent.Width = bounds.Width;
  370.         if (Parent.Height > bounds.Height)
  371.             Parent.Height = bounds.Height;
  372.  
  373.         int X = Parent.Location.X;
  374.         int Y = Parent.Location.Y;
  375.  
  376.         if (X < bounds.X)
  377.             X = bounds.X;
  378.         if (Y < bounds.Y)
  379.             Y = bounds.Y;
  380.  
  381.         int Width = bounds.X + bounds.Width;
  382.         int Height = bounds.Y + bounds.Height;
  383.  
  384.         if (X + Parent.Width > Width)
  385.             X = Width - Parent.Width;
  386.         if (Y + Parent.Height > Height)
  387.             Y = Height - Parent.Height;
  388.  
  389.         Parent.Location = new Point(X, Y);
  390.     }
  391.  
  392.     #endregion
  393.  
  394.  
  395.     #region " Base Properties "
  396.  
  397.     public override DockStyle Dock
  398.     {
  399.         get { return base.Dock; }
  400.         set
  401.         {
  402.             if (!_ControlMode)
  403.                 return;
  404.             base.Dock = value;
  405.         }
  406.     }
  407.  
  408.     private bool _BackColor;
  409.     [Category("Misc")]
  410.     public override Color BackColor
  411.     {
  412.         get { return base.BackColor; }
  413.         set
  414.         {
  415.             if (value == base.BackColor)
  416.                 return;
  417.  
  418.             if (!IsHandleCreated && _ControlMode && value == Color.Transparent)
  419.             {
  420.                 _BackColor = true;
  421.                 return;
  422.             }
  423.  
  424.             base.BackColor = value;
  425.             if (Parent != null)
  426.             {
  427.                 if (!_ControlMode)
  428.                     Parent.BackColor = value;
  429.                 ColorHook();
  430.             }
  431.         }
  432.     }
  433.  
  434.     public override Size MinimumSize
  435.     {
  436.         get { return base.MinimumSize; }
  437.         set
  438.         {
  439.             base.MinimumSize = value;
  440.             if (Parent != null)
  441.                 Parent.MinimumSize = value;
  442.         }
  443.     }
  444.  
  445.     public override Size MaximumSize
  446.     {
  447.         get { return base.MaximumSize; }
  448.         set
  449.         {
  450.             base.MaximumSize = value;
  451.             if (Parent != null)
  452.                 Parent.MaximumSize = value;
  453.         }
  454.     }
  455.  
  456.     public override string Text
  457.     {
  458.         get { return base.Text; }
  459.         set
  460.         {
  461.             base.Text = value;
  462.             Invalidate();
  463.         }
  464.     }
  465.  
  466.     public override Font Font
  467.     {
  468.         get { return base.Font; }
  469.         set
  470.         {
  471.             base.Font = value;
  472.             Invalidate();
  473.         }
  474.     }
  475.  
  476.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  477.     public override Color ForeColor
  478.     {
  479.         get { return Color.Empty; }
  480.         set { }
  481.     }
  482.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  483.     public override Image BackgroundImage
  484.     {
  485.         get { return null; }
  486.         set { }
  487.     }
  488.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  489.     public override ImageLayout BackgroundImageLayout
  490.     {
  491.         get { return ImageLayout.None; }
  492.         set { }
  493.     }
  494.  
  495.     #endregion
  496.  
  497.     #region " Public Properties "
  498.  
  499.     private bool _SmartBounds = true;
  500.     public bool SmartBounds
  501.     {
  502.         get { return _SmartBounds; }
  503.         set { _SmartBounds = value; }
  504.     }
  505.  
  506.     private bool _Movable = true;
  507.     public bool Movable
  508.     {
  509.         get { return _Movable; }
  510.         set { _Movable = value; }
  511.     }
  512.  
  513.     private bool _Sizable = true;
  514.     public bool Sizable
  515.     {
  516.         get { return _Sizable; }
  517.         set { _Sizable = value; }
  518.     }
  519.  
  520.     private Color _TransparencyKey;
  521.     public Color TransparencyKey
  522.     {
  523.         get
  524.         {
  525.             if (_IsParentForm && !_ControlMode)
  526.                 return ParentForm.TransparencyKey;
  527.             else
  528.                 return _TransparencyKey;
  529.         }
  530.         set
  531.         {
  532.             if (value == _TransparencyKey)
  533.                 return;
  534.             _TransparencyKey = value;
  535.  
  536.             if (_IsParentForm && !_ControlMode)
  537.             {
  538.                 ParentForm.TransparencyKey = value;
  539.                 ColorHook();
  540.             }
  541.         }
  542.     }
  543.  
  544.     private FormBorderStyle _BorderStyle;
  545.     public FormBorderStyle BorderStyle
  546.     {
  547.         get
  548.         {
  549.             if (_IsParentForm && !_ControlMode)
  550.                 return ParentForm.FormBorderStyle;
  551.             else
  552.                 return _BorderStyle;
  553.         }
  554.         set
  555.         {
  556.             _BorderStyle = value;
  557.  
  558.             if (_IsParentForm && !_ControlMode)
  559.             {
  560.                 ParentForm.FormBorderStyle = value;
  561.  
  562.                 if (!(value == FormBorderStyle.None))
  563.                 {
  564.                     Movable = false;
  565.                     Sizable = false;
  566.                 }
  567.             }
  568.         }
  569.     }
  570.  
  571.     private FormStartPosition _StartPosition;
  572.     public FormStartPosition StartPosition
  573.     {
  574.         get
  575.         {
  576.             if (_IsParentForm && !_ControlMode)
  577.                 return ParentForm.StartPosition;
  578.             else
  579.                 return _StartPosition;
  580.         }
  581.         set
  582.         {
  583.             _StartPosition = value;
  584.  
  585.             if (_IsParentForm && !_ControlMode)
  586.             {
  587.                 ParentForm.StartPosition = value;
  588.             }
  589.         }
  590.     }
  591.  
  592.     private bool _NoRounding;
  593.     public bool NoRounding
  594.     {
  595.         get { return _NoRounding; }
  596.         set
  597.         {
  598.             _NoRounding = value;
  599.             Invalidate();
  600.         }
  601.     }
  602.  
  603.     private Image _Image;
  604.     public Image Image
  605.     {
  606.         get { return _Image; }
  607.         set
  608.         {
  609.             if (value == null)
  610.                 _ImageSize = Size.Empty;
  611.             else
  612.                 _ImageSize = value.Size;
  613.  
  614.             _Image = value;
  615.             Invalidate();
  616.         }
  617.     }
  618.  
  619.     private Dictionary<string, Color> Items = new Dictionary<string, Color>();
  620.     public Bloom[] Colors
  621.     {
  622.         get
  623.         {
  624.             List<Bloom> T = new List<Bloom>();
  625.             Dictionary<string, Color>.Enumerator E = Items.GetEnumerator();
  626.  
  627.             while (E.MoveNext())
  628.             {
  629.                 T.Add(new Bloom(E.Current.Key, E.Current.Value));
  630.             }
  631.  
  632.             return T.ToArray();
  633.         }
  634.         set
  635.         {
  636.             foreach (Bloom B in value)
  637.             {
  638.                 if (Items.ContainsKey(B.Name))
  639.                     Items[B.Name] = B.Value;
  640.             }
  641.  
  642.             InvalidateCustimization();
  643.             ColorHook();
  644.             Invalidate();
  645.         }
  646.     }
  647.  
  648.     private string _Customization;
  649.     public string Customization
  650.     {
  651.         get { return _Customization; }
  652.         set
  653.         {
  654.             if (value == _Customization)
  655.                 return;
  656.  
  657.             byte[] Data = null;
  658.             Bloom[] Items = Colors;
  659.  
  660.             try
  661.             {
  662.                 Data = Convert.FromBase64String(value);
  663.                 for (int I = 0; I <= Items.Length - 1; I++)
  664.                 {
  665.                     Items[I].Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4));
  666.                 }
  667.             }
  668.             catch
  669.             {
  670.                 return;
  671.             }
  672.  
  673.             _Customization = value;
  674.  
  675.             Colors = Items;
  676.             ColorHook();
  677.             Invalidate();
  678.         }
  679.     }
  680.  
  681.     private bool _Transparent;
  682.     public bool Transparent
  683.     {
  684.         get { return _Transparent; }
  685.         set
  686.         {
  687.             _Transparent = value;
  688.             if (!(IsHandleCreated || _ControlMode))
  689.                 return;
  690.  
  691.             if (!value && !(BackColor.A == 255))
  692.             {
  693.                 throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
  694.             }
  695.  
  696.             SetStyle(ControlStyles.Opaque, !value);
  697.             SetStyle(ControlStyles.SupportsTransparentBackColor, value);
  698.  
  699.             InvalidateBitmap();
  700.             Invalidate();
  701.         }
  702.     }
  703.  
  704.     #endregion
  705.  
  706.     #region " Private Properties "
  707.  
  708.     private Size _ImageSize;
  709.     protected Size ImageSize
  710.     {
  711.         get { return _ImageSize; }
  712.     }
  713.  
  714.     private bool _IsParentForm;
  715.     protected bool IsParentForm
  716.     {
  717.         get { return _IsParentForm; }
  718.     }
  719.  
  720.     protected bool IsParentMdi
  721.     {
  722.         get
  723.         {
  724.             if (Parent == null)
  725.                 return false;
  726.             return Parent.Parent != null;
  727.         }
  728.     }
  729.  
  730.     private int _LockWidth;
  731.     protected int LockWidth
  732.     {
  733.         get { return _LockWidth; }
  734.         set
  735.         {
  736.             _LockWidth = value;
  737.             if (!(LockWidth == 0) && IsHandleCreated)
  738.                 Width = LockWidth;
  739.         }
  740.     }
  741.  
  742.     private int _LockHeight;
  743.     protected int LockHeight
  744.     {
  745.         get { return _LockHeight; }
  746.         set
  747.         {
  748.             _LockHeight = value;
  749.             if (!(LockHeight == 0) && IsHandleCreated)
  750.                 Height = LockHeight;
  751.         }
  752.     }
  753.  
  754.     private int _Header = 24;
  755.     protected int Header
  756.     {
  757.         get { return _Header; }
  758.         set
  759.         {
  760.             _Header = value;
  761.  
  762.             if (!_ControlMode)
  763.             {
  764.                 Frame = new Rectangle(7, 7, Width - 14, value - 7);
  765.                 Invalidate();
  766.             }
  767.         }
  768.     }
  769.  
  770.     private bool _ControlMode;
  771.     protected bool ControlMode
  772.     {
  773.         get { return _ControlMode; }
  774.         set
  775.         {
  776.             _ControlMode = value;
  777.  
  778.             Transparent = _Transparent;
  779.             if (_Transparent && _BackColor)
  780.                 BackColor = Color.Transparent;
  781.  
  782.             InvalidateBitmap();
  783.             Invalidate();
  784.         }
  785.     }
  786.  
  787.     private bool _IsAnimated;
  788.     protected bool IsAnimated
  789.     {
  790.         get { return _IsAnimated; }
  791.         set
  792.         {
  793.             _IsAnimated = value;
  794.             InvalidateTimer();
  795.         }
  796.     }
  797.  
  798.     #endregion
  799.  
  800.  
  801.     #region " Property Helpers "
  802.  
  803.     protected Pen GetPen(string name)
  804.     {
  805.         return new Pen(Items[name]);
  806.     }
  807.     protected Pen GetPen(string name, float width)
  808.     {
  809.         return new Pen(Items[name], width);
  810.     }
  811.  
  812.     protected SolidBrush GetBrush(string name)
  813.     {
  814.         return new SolidBrush(Items[name]);
  815.     }
  816.  
  817.     protected Color GetColor(string name)
  818.     {
  819.         return Items[name];
  820.     }
  821.  
  822.     protected void SetColor(string name, Color value)
  823.     {
  824.         if (Items.ContainsKey(name))
  825.             Items[name] = value;
  826.         else
  827.             Items.Add(name, value);
  828.     }
  829.     protected void SetColor(string name, byte r, byte g, byte b)
  830.     {
  831.         SetColor(name, Color.FromArgb(r, g, b));
  832.     }
  833.     protected void SetColor(string name, byte a, byte r, byte g, byte b)
  834.     {
  835.         SetColor(name, Color.FromArgb(a, r, g, b));
  836.     }
  837.     protected void SetColor(string name, byte a, Color value)
  838.     {
  839.         SetColor(name, Color.FromArgb(a, value));
  840.     }
  841.  
  842.     private void InvalidateBitmap()
  843.     {
  844.         if (_Transparent && _ControlMode)
  845.         {
  846.             if (Width == 0 || Height == 0)
  847.                 return;
  848.             B = new Bitmap(Width, Height, PixelFormat.Format32bppPArgb);
  849.             G = Graphics.FromImage(B);
  850.         }
  851.         else
  852.         {
  853.             G = null;
  854.             B = null;
  855.         }
  856.     }
  857.  
  858.     private void InvalidateCustimization()
  859.     {
  860.         MemoryStream M = new MemoryStream(Items.Count * 4);
  861.  
  862.         foreach (Bloom B in Colors)
  863.         {
  864.             M.Write(BitConverter.GetBytes(B.Value.ToArgb()), 0, 4);
  865.         }
  866.  
  867.         M.Close();
  868.         _Customization = Convert.ToBase64String(M.ToArray());
  869.     }
  870.  
  871.     private void InvalidateTimer()
  872.     {
  873.         if (DesignMode || !DoneCreation)
  874.             return;
  875.  
  876.         if (_IsAnimated)
  877.         {
  878.             ThemeShare.AddAnimationCallback(DoAnimation);
  879.         }
  880.         else
  881.         {
  882.             ThemeShare.RemoveAnimationCallback(DoAnimation);
  883.         }
  884.     }
  885.  
  886.     #endregion
  887.  
  888.  
  889.     #region " User Hooks "
  890.  
  891.     protected abstract void ColorHook();
  892.     protected abstract void PaintHook();
  893.  
  894.     protected virtual void OnCreation()
  895.     {
  896.     }
  897.  
  898.     protected virtual void OnAnimation()
  899.     {
  900.     }
  901.  
  902.     #endregion
  903.  
  904.  
  905.     #region " Offset "
  906.  
  907.     private Rectangle OffsetReturnRectangle;
  908.     protected Rectangle Offset(Rectangle r, int amount)
  909.     {
  910.         OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
  911.         return OffsetReturnRectangle;
  912.     }
  913.  
  914.     private Size OffsetReturnSize;
  915.     protected Size Offset(Size s, int amount)
  916.     {
  917.         OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
  918.         return OffsetReturnSize;
  919.     }
  920.  
  921.     private Point OffsetReturnPoint;
  922.     protected Point Offset(Point p, int amount)
  923.     {
  924.         OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
  925.         return OffsetReturnPoint;
  926.     }
  927.  
  928.     #endregion
  929.  
  930.     #region " Center "
  931.  
  932.  
  933.     private Point CenterReturn;
  934.     protected Point Center(Rectangle p, Rectangle c)
  935.     {
  936.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X + c.X, (p.Height / 2 - c.Height / 2) + p.Y + c.Y);
  937.         return CenterReturn;
  938.     }
  939.     protected Point Center(Rectangle p, Size c)
  940.     {
  941.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X, (p.Height / 2 - c.Height / 2) + p.Y);
  942.         return CenterReturn;
  943.     }
  944.  
  945.     protected Point Center(Rectangle child)
  946.     {
  947.         return Center(Width, Height, child.Width, child.Height);
  948.     }
  949.     protected Point Center(Size child)
  950.     {
  951.         return Center(Width, Height, child.Width, child.Height);
  952.     }
  953.     protected Point Center(int childWidth, int childHeight)
  954.     {
  955.         return Center(Width, Height, childWidth, childHeight);
  956.     }
  957.  
  958.     protected Point Center(Size p, Size c)
  959.     {
  960.         return Center(p.Width, p.Height, c.Width, c.Height);
  961.     }
  962.  
  963.     protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
  964.     {
  965.         CenterReturn = new Point(pWidth / 2 - cWidth / 2, pHeight / 2 - cHeight / 2);
  966.         return CenterReturn;
  967.     }
  968.  
  969.     #endregion
  970.  
  971.     #region " Measure "
  972.  
  973.     private Bitmap MeasureBitmap;
  974.  
  975.     private Graphics MeasureGraphics;
  976.     protected Size Measure()
  977.     {
  978.         lock (MeasureGraphics)
  979.         {
  980.             return MeasureGraphics.MeasureString(Text, Font, Width).ToSize();
  981.         }
  982.     }
  983.     protected Size Measure(string text)
  984.     {
  985.         lock (MeasureGraphics)
  986.         {
  987.             return MeasureGraphics.MeasureString(text, Font, Width).ToSize();
  988.         }
  989.     }
  990.  
  991.     #endregion
  992.  
  993.  
  994.     #region " DrawPixel "
  995.  
  996.  
  997.     private SolidBrush DrawPixelBrush;
  998.     protected void DrawPixel(Color c1, int x, int y)
  999.     {
  1000.         if (_Transparent)
  1001.         {
  1002.             B.SetPixel(x, y, c1);
  1003.         }
  1004.         else
  1005.         {
  1006.             DrawPixelBrush = new SolidBrush(c1);
  1007.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1);
  1008.         }
  1009.     }
  1010.  
  1011.     #endregion
  1012.  
  1013.     #region " DrawCorners "
  1014.  
  1015.  
  1016.     private SolidBrush DrawCornersBrush;
  1017.     protected void DrawCorners(Color c1, int offset)
  1018.     {
  1019.         DrawCorners(c1, 0, 0, Width, Height, offset);
  1020.     }
  1021.     protected void DrawCorners(Color c1, Rectangle r1, int offset)
  1022.     {
  1023.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
  1024.     }
  1025.     protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
  1026.     {
  1027.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1028.     }
  1029.  
  1030.     protected void DrawCorners(Color c1)
  1031.     {
  1032.         DrawCorners(c1, 0, 0, Width, Height);
  1033.     }
  1034.     protected void DrawCorners(Color c1, Rectangle r1)
  1035.     {
  1036.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
  1037.     }
  1038.     protected void DrawCorners(Color c1, int x, int y, int width, int height)
  1039.     {
  1040.         if (_NoRounding)
  1041.             return;
  1042.  
  1043.         if (_Transparent)
  1044.         {
  1045.             B.SetPixel(x, y, c1);
  1046.             B.SetPixel(x + (width - 1), y, c1);
  1047.             B.SetPixel(x, y + (height - 1), c1);
  1048.             B.SetPixel(x + (width - 1), y + (height - 1), c1);
  1049.         }
  1050.         else
  1051.         {
  1052.             DrawCornersBrush = new SolidBrush(c1);
  1053.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1);
  1054.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1);
  1055.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1);
  1056.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
  1057.         }
  1058.     }
  1059.  
  1060.     #endregion
  1061.  
  1062.     #region " DrawBorders "
  1063.  
  1064.     protected void DrawBorders(Pen p1, int offset)
  1065.     {
  1066.         DrawBorders(p1, 0, 0, Width, Height, offset);
  1067.     }
  1068.     protected void DrawBorders(Pen p1, Rectangle r, int offset)
  1069.     {
  1070.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
  1071.     }
  1072.     protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
  1073.     {
  1074.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1075.     }
  1076.  
  1077.     protected void DrawBorders(Pen p1)
  1078.     {
  1079.         DrawBorders(p1, 0, 0, Width, Height);
  1080.     }
  1081.     protected void DrawBorders(Pen p1, Rectangle r)
  1082.     {
  1083.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
  1084.     }
  1085.     protected void DrawBorders(Pen p1, int x, int y, int width, int height)
  1086.     {
  1087.         G.DrawRectangle(p1, x, y, width - 1, height - 1);
  1088.     }
  1089.  
  1090.     #endregion
  1091.  
  1092.     #region " DrawText "
  1093.  
  1094.     private Point DrawTextPoint;
  1095.  
  1096.     private Size DrawTextSize;
  1097.     protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
  1098.     {
  1099.         DrawText(b1, Text, a, x, y);
  1100.     }
  1101.     protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
  1102.     {
  1103.         if (text.Length == 0)
  1104.             return;
  1105.  
  1106.         DrawTextSize = Measure(text);
  1107.         DrawTextPoint = new Point(Width / 2 - DrawTextSize.Width / 2, Header / 2 - DrawTextSize.Height / 2);
  1108.  
  1109.         switch (a)
  1110.         {
  1111.             case HorizontalAlignment.Left:
  1112.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y);
  1113.                 break;
  1114.             case HorizontalAlignment.Center:
  1115.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y);
  1116.                 break;
  1117.             case HorizontalAlignment.Right:
  1118.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y);
  1119.                 break;
  1120.         }
  1121.     }
  1122.  
  1123.     protected void DrawText(Brush b1, Point p1)
  1124.     {
  1125.         if (Text.Length == 0)
  1126.             return;
  1127.         G.DrawString(Text, Font, b1, p1);
  1128.     }
  1129.     protected void DrawText(Brush b1, int x, int y)
  1130.     {
  1131.         if (Text.Length == 0)
  1132.             return;
  1133.         G.DrawString(Text, Font, b1, x, y);
  1134.     }
  1135.  
  1136.     #endregion
  1137.  
  1138.     #region " DrawImage "
  1139.  
  1140.  
  1141.     private Point DrawImagePoint;
  1142.     protected void DrawImage(HorizontalAlignment a, int x, int y)
  1143.     {
  1144.         DrawImage(_Image, a, x, y);
  1145.     }
  1146.     protected void DrawImage(Image image, HorizontalAlignment a, int x, int y)
  1147.     {
  1148.         if (image == null)
  1149.             return;
  1150.         DrawImagePoint = new Point(Width / 2 - image.Width / 2, Header / 2 - image.Height / 2);
  1151.  
  1152.         switch (a)
  1153.         {
  1154.             case HorizontalAlignment.Left:
  1155.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height);
  1156.                 break;
  1157.             case HorizontalAlignment.Center:
  1158.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height);
  1159.                 break;
  1160.             case HorizontalAlignment.Right:
  1161.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height);
  1162.                 break;
  1163.         }
  1164.     }
  1165.  
  1166.     protected void DrawImage(Point p1)
  1167.     {
  1168.         DrawImage(_Image, p1.X, p1.Y);
  1169.     }
  1170.     protected void DrawImage(int x, int y)
  1171.     {
  1172.         DrawImage(_Image, x, y);
  1173.     }
  1174.  
  1175.     protected void DrawImage(Image image, Point p1)
  1176.     {
  1177.         DrawImage(image, p1.X, p1.Y);
  1178.     }
  1179.     protected void DrawImage(Image image, int x, int y)
  1180.     {
  1181.         if (image == null)
  1182.             return;
  1183.         G.DrawImage(image, x, y, image.Width, image.Height);
  1184.     }
  1185.  
  1186.     #endregion
  1187.  
  1188.     #region " DrawGradient "
  1189.  
  1190.     private LinearGradientBrush DrawGradientBrush;
  1191.  
  1192.     private Rectangle DrawGradientRectangle;
  1193.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
  1194.     {
  1195.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1196.         DrawGradient(blend, DrawGradientRectangle);
  1197.     }
  1198.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
  1199.     {
  1200.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1201.         DrawGradient(blend, DrawGradientRectangle, angle);
  1202.     }
  1203.  
  1204.     protected void DrawGradient(ColorBlend blend, Rectangle r)
  1205.     {
  1206.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
  1207.         DrawGradientBrush.InterpolationColors = blend;
  1208.         G.FillRectangle(DrawGradientBrush, r);
  1209.     }
  1210.     protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
  1211.     {
  1212.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
  1213.         DrawGradientBrush.InterpolationColors = blend;
  1214.         G.FillRectangle(DrawGradientBrush, r);
  1215.     }
  1216.  
  1217.  
  1218.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
  1219.     {
  1220.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1221.         DrawGradient(c1, c2, DrawGradientRectangle);
  1222.     }
  1223.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
  1224.     {
  1225.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1226.         DrawGradient(c1, c2, DrawGradientRectangle, angle);
  1227.     }
  1228.  
  1229.     protected void DrawGradient(Color c1, Color c2, Rectangle r)
  1230.     {
  1231.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
  1232.         G.FillRectangle(DrawGradientBrush, r);
  1233.     }
  1234.     protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
  1235.     {
  1236.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
  1237.         G.FillRectangle(DrawGradientBrush, r);
  1238.     }
  1239.  
  1240.     #endregion
  1241.  
  1242.     #region " DrawRadial "
  1243.  
  1244.     private GraphicsPath DrawRadialPath;
  1245.     private PathGradientBrush DrawRadialBrush1;
  1246.     private LinearGradientBrush DrawRadialBrush2;
  1247.  
  1248.     private Rectangle DrawRadialRectangle;
  1249.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
  1250.     {
  1251.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1252.         DrawRadial(blend, DrawRadialRectangle, width / 2, height / 2);
  1253.     }
  1254.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
  1255.     {
  1256.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1257.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y);
  1258.     }
  1259.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
  1260.     {
  1261.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1262.         DrawRadial(blend, DrawRadialRectangle, cx, cy);
  1263.     }
  1264.  
  1265.     public void DrawRadial(ColorBlend blend, Rectangle r)
  1266.     {
  1267.         DrawRadial(blend, r, r.Width / 2, r.Height / 2);
  1268.     }
  1269.     public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
  1270.     {
  1271.         DrawRadial(blend, r, center.X, center.Y);
  1272.     }
  1273.     public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
  1274.     {
  1275.         DrawRadialPath.Reset();
  1276.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
  1277.  
  1278.         DrawRadialBrush1 = new PathGradientBrush(DrawRadialPath);
  1279.         DrawRadialBrush1.CenterPoint = new Point(r.X + cx, r.Y + cy);
  1280.         DrawRadialBrush1.InterpolationColors = blend;
  1281.  
  1282.         if (G.SmoothingMode == SmoothingMode.AntiAlias)
  1283.         {
  1284.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3);
  1285.         }
  1286.         else
  1287.         {
  1288.             G.FillEllipse(DrawRadialBrush1, r);
  1289.         }
  1290.     }
  1291.  
  1292.  
  1293.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
  1294.     {
  1295.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1296.         DrawRadial(c1, c2, DrawGradientRectangle);
  1297.     }
  1298.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
  1299.     {
  1300.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1301.         DrawRadial(c1, c2, DrawGradientRectangle, angle);
  1302.     }
  1303.  
  1304.     protected void DrawRadial(Color c1, Color c2, Rectangle r)
  1305.     {
  1306.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
  1307.         G.FillRectangle(DrawGradientBrush, r);
  1308.     }
  1309.     protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
  1310.     {
  1311.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
  1312.         G.FillEllipse(DrawGradientBrush, r);
  1313.     }
  1314.  
  1315.     #endregion
  1316.  
  1317.     #region " CreateRound "
  1318.  
  1319.     private GraphicsPath CreateRoundPath;
  1320.  
  1321.     private Rectangle CreateRoundRectangle;
  1322.     public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
  1323.     {
  1324.         CreateRoundRectangle = new Rectangle(x, y, width, height);
  1325.         return CreateRound(CreateRoundRectangle, slope);
  1326.     }
  1327.  
  1328.     public GraphicsPath CreateRound(Rectangle r, int slope)
  1329.     {
  1330.         CreateRoundPath = new GraphicsPath(FillMode.Winding);
  1331.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
  1332.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
  1333.         CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
  1334.         CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
  1335.         CreateRoundPath.CloseFigure();
  1336.         return CreateRoundPath;
  1337.     }
  1338.  
  1339.     #endregion
  1340.  
  1341. }
  1342.  
  1343. abstract class ThemeControl154 : Control
  1344. {
  1345.  
  1346.  
  1347.     #region " Initialization "
  1348.  
  1349.     protected Graphics G;
  1350.  
  1351.     protected Bitmap B;
  1352.     public ThemeControl154()
  1353.     {
  1354.         SetStyle((ControlStyles)139270, true);
  1355.  
  1356.         _ImageSize = Size.Empty;
  1357.         Font = new Font("Verdana", 8);
  1358.  
  1359.         MeasureBitmap = new Bitmap(1, 1);
  1360.         MeasureGraphics = Graphics.FromImage(MeasureBitmap);
  1361.  
  1362.         DrawRadialPath = new GraphicsPath();
  1363.  
  1364.         InvalidateCustimization();
  1365.         //Remove?
  1366.     }
  1367.  
  1368.     protected override sealed void OnHandleCreated(EventArgs e)
  1369.     {
  1370.         InvalidateCustimization();
  1371.         ColorHook();
  1372.  
  1373.         if (!(_LockWidth == 0))
  1374.             Width = _LockWidth;
  1375.         if (!(_LockHeight == 0))
  1376.             Height = _LockHeight;
  1377.  
  1378.         Transparent = _Transparent;
  1379.         if (_Transparent && _BackColor)
  1380.             BackColor = Color.Transparent;
  1381.  
  1382.         base.OnHandleCreated(e);
  1383.     }
  1384.  
  1385.     private bool DoneCreation;
  1386.     protected override sealed void OnParentChanged(EventArgs e)
  1387.     {
  1388.         if (Parent != null)
  1389.         {
  1390.             OnCreation();
  1391.             DoneCreation = true;
  1392.             InvalidateTimer();
  1393.         }
  1394.  
  1395.         base.OnParentChanged(e);
  1396.     }
  1397.  
  1398.     #endregion
  1399.  
  1400.     private void DoAnimation(bool i)
  1401.     {
  1402.         OnAnimation();
  1403.         if (i)
  1404.             Invalidate();
  1405.     }
  1406.  
  1407.     protected override sealed void OnPaint(PaintEventArgs e)
  1408.     {
  1409.         if (Width == 0 || Height == 0)
  1410.             return;
  1411.  
  1412.         if (_Transparent)
  1413.         {
  1414.             PaintHook();
  1415.             e.Graphics.DrawImage(B, 0, 0);
  1416.         }
  1417.         else
  1418.         {
  1419.             G = e.Graphics;
  1420.             PaintHook();
  1421.         }
  1422.     }
  1423.  
  1424.     protected override void OnHandleDestroyed(EventArgs e)
  1425.     {
  1426.         ThemeShare.RemoveAnimationCallback(DoAnimation);
  1427.         base.OnHandleDestroyed(e);
  1428.     }
  1429.  
  1430.     #region " Size Handling "
  1431.  
  1432.     protected override sealed void OnSizeChanged(EventArgs e)
  1433.     {
  1434.         if (_Transparent)
  1435.         {
  1436.             InvalidateBitmap();
  1437.         }
  1438.  
  1439.         Invalidate();
  1440.         base.OnSizeChanged(e);
  1441.     }
  1442.  
  1443.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  1444.     {
  1445.         if (!(_LockWidth == 0))
  1446.             width = _LockWidth;
  1447.         if (!(_LockHeight == 0))
  1448.             height = _LockHeight;
  1449.         base.SetBoundsCore(x, y, width, height, specified);
  1450.     }
  1451.  
  1452.     #endregion
  1453.  
  1454.     #region " State Handling "
  1455.  
  1456.     private bool InPosition;
  1457.     protected override void OnMouseEnter(EventArgs e)
  1458.     {
  1459.         InPosition = true;
  1460.         SetState(MouseState.Over);
  1461.         base.OnMouseEnter(e);
  1462.     }
  1463.  
  1464.     protected override void OnMouseUp(MouseEventArgs e)
  1465.     {
  1466.         if (InPosition)
  1467.             SetState(MouseState.Over);
  1468.         base.OnMouseUp(e);
  1469.     }
  1470.  
  1471.     protected override void OnMouseDown(MouseEventArgs e)
  1472.     {
  1473.         if (e.Button == System.Windows.Forms.MouseButtons.Left)
  1474.             SetState(MouseState.Down);
  1475.         base.OnMouseDown(e);
  1476.     }
  1477.  
  1478.     protected override void OnMouseLeave(EventArgs e)
  1479.     {
  1480.         InPosition = false;
  1481.         SetState(MouseState.None);
  1482.         base.OnMouseLeave(e);
  1483.     }
  1484.  
  1485.     protected override void OnEnabledChanged(EventArgs e)
  1486.     {
  1487.         if (Enabled)
  1488.             SetState(MouseState.None);
  1489.         else
  1490.             SetState(MouseState.Block);
  1491.         base.OnEnabledChanged(e);
  1492.     }
  1493.  
  1494.     protected MouseState State;
  1495.     private void SetState(MouseState current)
  1496.     {
  1497.         State = current;
  1498.         Invalidate();
  1499.     }
  1500.  
  1501.     #endregion
  1502.  
  1503.  
  1504.     #region " Base Properties "
  1505.  
  1506.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1507.     public override Color ForeColor
  1508.     {
  1509.         get { return Color.Empty; }
  1510.         set { }
  1511.     }
  1512.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1513.     public override Image BackgroundImage
  1514.     {
  1515.         get { return null; }
  1516.         set { }
  1517.     }
  1518.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1519.     public override ImageLayout BackgroundImageLayout
  1520.     {
  1521.         get { return ImageLayout.None; }
  1522.         set { }
  1523.     }
  1524.  
  1525.     public override string Text
  1526.     {
  1527.         get { return base.Text; }
  1528.         set
  1529.         {
  1530.             base.Text = value;
  1531.             Invalidate();
  1532.         }
  1533.     }
  1534.     public override Font Font
  1535.     {
  1536.         get { return base.Font; }
  1537.         set
  1538.         {
  1539.             base.Font = value;
  1540.             Invalidate();
  1541.         }
  1542.     }
  1543.  
  1544.     private bool _BackColor;
  1545.     [Category("Misc")]
  1546.     public override Color BackColor
  1547.     {
  1548.         get { return base.BackColor; }
  1549.         set
  1550.         {
  1551.             if (!IsHandleCreated && value == Color.Transparent)
  1552.             {
  1553.                 _BackColor = true;
  1554.                 return;
  1555.             }
  1556.  
  1557.             base.BackColor = value;
  1558.             if (Parent != null)
  1559.                 ColorHook();
  1560.         }
  1561.     }
  1562.  
  1563.     #endregion
  1564.  
  1565.     #region " Public Properties "
  1566.  
  1567.     private bool _NoRounding;
  1568.     public bool NoRounding
  1569.     {
  1570.         get { return _NoRounding; }
  1571.         set
  1572.         {
  1573.             _NoRounding = value;
  1574.             Invalidate();
  1575.         }
  1576.     }
  1577.  
  1578.     private Image _Image;
  1579.     public Image Image
  1580.     {
  1581.         get { return _Image; }
  1582.         set
  1583.         {
  1584.             if (value == null)
  1585.             {
  1586.                 _ImageSize = Size.Empty;
  1587.             }
  1588.             else
  1589.             {
  1590.                 _ImageSize = value.Size;
  1591.             }
  1592.  
  1593.             _Image = value;
  1594.             Invalidate();
  1595.         }
  1596.     }
  1597.  
  1598.     private bool _Transparent;
  1599.     public bool Transparent
  1600.     {
  1601.         get { return _Transparent; }
  1602.         set
  1603.         {
  1604.             _Transparent = value;
  1605.             if (!IsHandleCreated)
  1606.                 return;
  1607.  
  1608.             if (!value && !(BackColor.A == 255))
  1609.             {
  1610.                 throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
  1611.             }
  1612.  
  1613.             SetStyle(ControlStyles.Opaque, !value);
  1614.             SetStyle(ControlStyles.SupportsTransparentBackColor, value);
  1615.  
  1616.             if (value)
  1617.                 InvalidateBitmap();
  1618.             else
  1619.                 B = null;
  1620.             Invalidate();
  1621.         }
  1622.     }
  1623.  
  1624.     private Dictionary<string, Color> Items = new Dictionary<string, Color>();
  1625.     public Bloom[] Colors
  1626.     {
  1627.         get
  1628.         {
  1629.             List<Bloom> T = new List<Bloom>();
  1630.             Dictionary<string, Color>.Enumerator E = Items.GetEnumerator();
  1631.  
  1632.             while (E.MoveNext())
  1633.             {
  1634.                 T.Add(new Bloom(E.Current.Key, E.Current.Value));
  1635.             }
  1636.  
  1637.             return T.ToArray();
  1638.         }
  1639.         set
  1640.         {
  1641.             foreach (Bloom B in value)
  1642.             {
  1643.                 if (Items.ContainsKey(B.Name))
  1644.                     Items[B.Name] = B.Value;
  1645.             }
  1646.  
  1647.             InvalidateCustimization();
  1648.             ColorHook();
  1649.             Invalidate();
  1650.         }
  1651.     }
  1652.  
  1653.     private string _Customization;
  1654.     public string Customization
  1655.     {
  1656.         get { return _Customization; }
  1657.         set
  1658.         {
  1659.             if (value == _Customization)
  1660.                 return;
  1661.  
  1662.             byte[] Data = null;
  1663.             Bloom[] Items = Colors;
  1664.  
  1665.             try
  1666.             {
  1667.                 Data = Convert.FromBase64String(value);
  1668.                 for (int I = 0; I <= Items.Length - 1; I++)
  1669.                 {
  1670.                     Items[I].Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4));
  1671.                 }
  1672.             }
  1673.             catch
  1674.             {
  1675.                 return;
  1676.             }
  1677.  
  1678.             _Customization = value;
  1679.  
  1680.             Colors = Items;
  1681.             ColorHook();
  1682.             Invalidate();
  1683.         }
  1684.     }
  1685.  
  1686.     #endregion
  1687.  
  1688.     #region " Private Properties "
  1689.  
  1690.     private Size _ImageSize;
  1691.     protected Size ImageSize
  1692.     {
  1693.         get { return _ImageSize; }
  1694.     }
  1695.  
  1696.     private int _LockWidth;
  1697.     protected int LockWidth
  1698.     {
  1699.         get { return _LockWidth; }
  1700.         set
  1701.         {
  1702.             _LockWidth = value;
  1703.             if (!(LockWidth == 0) && IsHandleCreated)
  1704.                 Width = LockWidth;
  1705.         }
  1706.     }
  1707.  
  1708.     private int _LockHeight;
  1709.     protected int LockHeight
  1710.     {
  1711.         get { return _LockHeight; }
  1712.         set
  1713.         {
  1714.             _LockHeight = value;
  1715.             if (!(LockHeight == 0) && IsHandleCreated)
  1716.                 Height = LockHeight;
  1717.         }
  1718.     }
  1719.  
  1720.     private bool _IsAnimated;
  1721.     protected bool IsAnimated
  1722.     {
  1723.         get { return _IsAnimated; }
  1724.         set
  1725.         {
  1726.             _IsAnimated = value;
  1727.             InvalidateTimer();
  1728.         }
  1729.     }
  1730.  
  1731.     #endregion
  1732.  
  1733.  
  1734.     #region " Property Helpers "
  1735.  
  1736.     protected Pen GetPen(string name)
  1737.     {
  1738.         return new Pen(Items[name]);
  1739.     }
  1740.     protected Pen GetPen(string name, float width)
  1741.     {
  1742.         return new Pen(Items[name], width);
  1743.     }
  1744.  
  1745.     protected SolidBrush GetBrush(string name)
  1746.     {
  1747.         return new SolidBrush(Items[name]);
  1748.     }
  1749.  
  1750.     protected Color GetColor(string name)
  1751.     {
  1752.         return Items[name];
  1753.     }
  1754.  
  1755.     protected void SetColor(string name, Color value)
  1756.     {
  1757.         if (Items.ContainsKey(name))
  1758.             Items[name] = value;
  1759.         else
  1760.             Items.Add(name, value);
  1761.     }
  1762.     protected void SetColor(string name, byte r, byte g, byte b)
  1763.     {
  1764.         SetColor(name, Color.FromArgb(r, g, b));
  1765.     }
  1766.     protected void SetColor(string name, byte a, byte r, byte g, byte b)
  1767.     {
  1768.         SetColor(name, Color.FromArgb(a, r, g, b));
  1769.     }
  1770.     protected void SetColor(string name, byte a, Color value)
  1771.     {
  1772.         SetColor(name, Color.FromArgb(a, value));
  1773.     }
  1774.  
  1775.     private void InvalidateBitmap()
  1776.     {
  1777.         if (Width == 0 || Height == 0)
  1778.             return;
  1779.         B = new Bitmap(Width, Height, PixelFormat.Format32bppPArgb);
  1780.         G = Graphics.FromImage(B);
  1781.     }
  1782.  
  1783.     private void InvalidateCustimization()
  1784.     {
  1785.         MemoryStream M = new MemoryStream(Items.Count * 4);
  1786.  
  1787.         foreach (Bloom B in Colors)
  1788.         {
  1789.             M.Write(BitConverter.GetBytes(B.Value.ToArgb()), 0, 4);
  1790.         }
  1791.  
  1792.         M.Close();
  1793.         _Customization = Convert.ToBase64String(M.ToArray());
  1794.     }
  1795.  
  1796.     private void InvalidateTimer()
  1797.     {
  1798.         if (DesignMode || !DoneCreation)
  1799.             return;
  1800.  
  1801.         if (_IsAnimated)
  1802.         {
  1803.             ThemeShare.AddAnimationCallback(DoAnimation);
  1804.         }
  1805.         else
  1806.         {
  1807.             ThemeShare.RemoveAnimationCallback(DoAnimation);
  1808.         }
  1809.     }
  1810.     #endregion
  1811.  
  1812.  
  1813.     #region " User Hooks "
  1814.  
  1815.     protected abstract void ColorHook();
  1816.     protected abstract void PaintHook();
  1817.  
  1818.     protected virtual void OnCreation()
  1819.     {
  1820.     }
  1821.  
  1822.     protected virtual void OnAnimation()
  1823.     {
  1824.     }
  1825.  
  1826.     #endregion
  1827.  
  1828.  
  1829.     #region " Offset "
  1830.  
  1831.     private Rectangle OffsetReturnRectangle;
  1832.     protected Rectangle Offset(Rectangle r, int amount)
  1833.     {
  1834.         OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
  1835.         return OffsetReturnRectangle;
  1836.     }
  1837.  
  1838.     private Size OffsetReturnSize;
  1839.     protected Size Offset(Size s, int amount)
  1840.     {
  1841.         OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
  1842.         return OffsetReturnSize;
  1843.     }
  1844.  
  1845.     private Point OffsetReturnPoint;
  1846.     protected Point Offset(Point p, int amount)
  1847.     {
  1848.         OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
  1849.         return OffsetReturnPoint;
  1850.     }
  1851.  
  1852.     #endregion
  1853.  
  1854.     #region " Center "
  1855.  
  1856.  
  1857.     private Point CenterReturn;
  1858.     protected Point Center(Rectangle p, Rectangle c)
  1859.     {
  1860.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X + c.X, (p.Height / 2 - c.Height / 2) + p.Y + c.Y);
  1861.         return CenterReturn;
  1862.     }
  1863.     protected Point Center(Rectangle p, Size c)
  1864.     {
  1865.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X, (p.Height / 2 - c.Height / 2) + p.Y);
  1866.         return CenterReturn;
  1867.     }
  1868.  
  1869.     protected Point Center(Rectangle child)
  1870.     {
  1871.         return Center(Width, Height, child.Width, child.Height);
  1872.     }
  1873.     protected Point Center(Size child)
  1874.     {
  1875.         return Center(Width, Height, child.Width, child.Height);
  1876.     }
  1877.     protected Point Center(int childWidth, int childHeight)
  1878.     {
  1879.         return Center(Width, Height, childWidth, childHeight);
  1880.     }
  1881.  
  1882.     protected Point Center(Size p, Size c)
  1883.     {
  1884.         return Center(p.Width, p.Height, c.Width, c.Height);
  1885.     }
  1886.  
  1887.     protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
  1888.     {
  1889.         CenterReturn = new Point(pWidth / 2 - cWidth / 2, pHeight / 2 - cHeight / 2);
  1890.         return CenterReturn;
  1891.     }
  1892.  
  1893.     #endregion
  1894.  
  1895.     #region " Measure "
  1896.  
  1897.     private Bitmap MeasureBitmap;
  1898.     //TODO: Potential issues during multi-threading.
  1899.     private Graphics MeasureGraphics;
  1900.  
  1901.     protected Size Measure()
  1902.     {
  1903.         return MeasureGraphics.MeasureString(Text, Font, Width).ToSize();
  1904.     }
  1905.     protected Size Measure(string text)
  1906.     {
  1907.         return MeasureGraphics.MeasureString(text, Font, Width).ToSize();
  1908.     }
  1909.  
  1910.     #endregion
  1911.  
  1912.  
  1913.     #region " DrawPixel "
  1914.  
  1915.  
  1916.     private SolidBrush DrawPixelBrush;
  1917.     protected void DrawPixel(Color c1, int x, int y)
  1918.     {
  1919.         if (_Transparent)
  1920.         {
  1921.             B.SetPixel(x, y, c1);
  1922.         }
  1923.         else
  1924.         {
  1925.             DrawPixelBrush = new SolidBrush(c1);
  1926.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1);
  1927.         }
  1928.     }
  1929.  
  1930.     #endregion
  1931.  
  1932.     #region " DrawCorners "
  1933.  
  1934.  
  1935.     private SolidBrush DrawCornersBrush;
  1936.     protected void DrawCorners(Color c1, int offset)
  1937.     {
  1938.         DrawCorners(c1, 0, 0, Width, Height, offset);
  1939.     }
  1940.     protected void DrawCorners(Color c1, Rectangle r1, int offset)
  1941.     {
  1942.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
  1943.     }
  1944.     protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
  1945.     {
  1946.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1947.     }
  1948.  
  1949.     protected void DrawCorners(Color c1)
  1950.     {
  1951.         DrawCorners(c1, 0, 0, Width, Height);
  1952.     }
  1953.     protected void DrawCorners(Color c1, Rectangle r1)
  1954.     {
  1955.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
  1956.     }
  1957.     protected void DrawCorners(Color c1, int x, int y, int width, int height)
  1958.     {
  1959.         if (_NoRounding)
  1960.             return;
  1961.  
  1962.         if (_Transparent)
  1963.         {
  1964.             B.SetPixel(x, y, c1);
  1965.             B.SetPixel(x + (width - 1), y, c1);
  1966.             B.SetPixel(x, y + (height - 1), c1);
  1967.             B.SetPixel(x + (width - 1), y + (height - 1), c1);
  1968.         }
  1969.         else
  1970.         {
  1971.             DrawCornersBrush = new SolidBrush(c1);
  1972.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1);
  1973.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1);
  1974.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1);
  1975.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
  1976.         }
  1977.     }
  1978.  
  1979.     #endregion
  1980.  
  1981.     #region " DrawBorders "
  1982.  
  1983.     protected void DrawBorders(Pen p1, int offset)
  1984.     {
  1985.         DrawBorders(p1, 0, 0, Width, Height, offset);
  1986.     }
  1987.     protected void DrawBorders(Pen p1, Rectangle r, int offset)
  1988.     {
  1989.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
  1990.     }
  1991.     protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
  1992.     {
  1993.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1994.     }
  1995.  
  1996.     protected void DrawBorders(Pen p1)
  1997.     {
  1998.         DrawBorders(p1, 0, 0, Width, Height);
  1999.     }
  2000.     protected void DrawBorders(Pen p1, Rectangle r)
  2001.     {
  2002.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
  2003.     }
  2004.     protected void DrawBorders(Pen p1, int x, int y, int width, int height)
  2005.     {
  2006.         G.DrawRectangle(p1, x, y, width - 1, height - 1);
  2007.     }
  2008.  
  2009.     #endregion
  2010.  
  2011.     #region " DrawText "
  2012.  
  2013.     private Point DrawTextPoint;
  2014.  
  2015.     private Size DrawTextSize;
  2016.     protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
  2017.     {
  2018.         DrawText(b1, Text, a, x, y);
  2019.     }
  2020.     protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
  2021.     {
  2022.         if (text.Length == 0)
  2023.             return;
  2024.  
  2025.         DrawTextSize = Measure(text);
  2026.         DrawTextPoint = Center(DrawTextSize);
  2027.  
  2028.         switch (a)
  2029.         {
  2030.             case HorizontalAlignment.Left:
  2031.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y);
  2032.                 break;
  2033.             case HorizontalAlignment.Center:
  2034.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y);
  2035.                 break;
  2036.             case HorizontalAlignment.Right:
  2037.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y);
  2038.                 break;
  2039.         }
  2040.     }
  2041.  
  2042.     protected void DrawText(Brush b1, Point p1)
  2043.     {
  2044.         if (Text.Length == 0)
  2045.             return;
  2046.         G.DrawString(Text, Font, b1, p1);
  2047.     }
  2048.     protected void DrawText(Brush b1, int x, int y)
  2049.     {
  2050.         if (Text.Length == 0)
  2051.             return;
  2052.         G.DrawString(Text, Font, b1, x, y);
  2053.     }
  2054.  
  2055.     #endregion
  2056.  
  2057.     #region " DrawImage "
  2058.  
  2059.  
  2060.     private Point DrawImagePoint;
  2061.     protected void DrawImage(HorizontalAlignment a, int x, int y)
  2062.     {
  2063.         DrawImage(_Image, a, x, y);
  2064.     }
  2065.     protected void DrawImage(Image image, HorizontalAlignment a, int x, int y)
  2066.     {
  2067.         if (image == null)
  2068.             return;
  2069.         DrawImagePoint = Center(image.Size);
  2070.  
  2071.         switch (a)
  2072.         {
  2073.             case HorizontalAlignment.Left:
  2074.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height);
  2075.                 break;
  2076.             case HorizontalAlignment.Center:
  2077.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height);
  2078.                 break;
  2079.             case HorizontalAlignment.Right:
  2080.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height);
  2081.                 break;
  2082.         }
  2083.     }
  2084.  
  2085.     protected void DrawImage(Point p1)
  2086.     {
  2087.         DrawImage(_Image, p1.X, p1.Y);
  2088.     }
  2089.     protected void DrawImage(int x, int y)
  2090.     {
  2091.         DrawImage(_Image, x, y);
  2092.     }
  2093.  
  2094.     protected void DrawImage(Image image, Point p1)
  2095.     {
  2096.         DrawImage(image, p1.X, p1.Y);
  2097.     }
  2098.     protected void DrawImage(Image image, int x, int y)
  2099.     {
  2100.         if (image == null)
  2101.             return;
  2102.         G.DrawImage(image, x, y, image.Width, image.Height);
  2103.     }
  2104.  
  2105.     #endregion
  2106.  
  2107.     #region " DrawGradient "
  2108.  
  2109.     private LinearGradientBrush DrawGradientBrush;
  2110.  
  2111.     private Rectangle DrawGradientRectangle;
  2112.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
  2113.     {
  2114.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2115.         DrawGradient(blend, DrawGradientRectangle);
  2116.     }
  2117.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
  2118.     {
  2119.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2120.         DrawGradient(blend, DrawGradientRectangle, angle);
  2121.     }
  2122.  
  2123.     protected void DrawGradient(ColorBlend blend, Rectangle r)
  2124.     {
  2125.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
  2126.         DrawGradientBrush.InterpolationColors = blend;
  2127.         G.FillRectangle(DrawGradientBrush, r);
  2128.     }
  2129.     protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
  2130.     {
  2131.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
  2132.         DrawGradientBrush.InterpolationColors = blend;
  2133.         G.FillRectangle(DrawGradientBrush, r);
  2134.     }
  2135.  
  2136.  
  2137.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
  2138.     {
  2139.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2140.         DrawGradient(c1, c2, DrawGradientRectangle);
  2141.     }
  2142.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
  2143.     {
  2144.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  2145.         DrawGradient(c1, c2, DrawGradientRectangle, angle);
  2146.     }
  2147.  
  2148.     protected void DrawGradient(Color c1, Color c2, Rectangle r)
  2149.     {
  2150.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
  2151.         G.FillRectangle(DrawGradientBrush, r);
  2152.     }
  2153.     protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
  2154.     {
  2155.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
  2156.         G.FillRectangle(DrawGradientBrush, r);
  2157.     }
  2158.  
  2159.     #endregion
  2160.  
  2161.     #region " DrawRadial "
  2162.  
  2163.     private GraphicsPath DrawRadialPath;
  2164.     private PathGradientBrush DrawRadialBrush1;
  2165.     private LinearGradientBrush DrawRadialBrush2;
  2166.  
  2167.     private Rectangle DrawRadialRectangle;
  2168.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
  2169.     {
  2170.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2171.         DrawRadial(blend, DrawRadialRectangle, width / 2, height / 2);
  2172.     }
  2173.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
  2174.     {
  2175.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2176.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y);
  2177.     }
  2178.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
  2179.     {
  2180.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2181.         DrawRadial(blend, DrawRadialRectangle, cx, cy);
  2182.     }
  2183.  
  2184.     public void DrawRadial(ColorBlend blend, Rectangle r)
  2185.     {
  2186.         DrawRadial(blend, r, r.Width / 2, r.Height / 2);
  2187.     }
  2188.     public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
  2189.     {
  2190.         DrawRadial(blend, r, center.X, center.Y);
  2191.     }
  2192.     public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
  2193.     {
  2194.         DrawRadialPath.Reset();
  2195.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
  2196.  
  2197.         DrawRadialBrush1 = new PathGradientBrush(DrawRadialPath);
  2198.         DrawRadialBrush1.CenterPoint = new Point(r.X + cx, r.Y + cy);
  2199.         DrawRadialBrush1.InterpolationColors = blend;
  2200.  
  2201.         if (G.SmoothingMode == SmoothingMode.AntiAlias)
  2202.         {
  2203.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3);
  2204.         }
  2205.         else
  2206.         {
  2207.             G.FillEllipse(DrawRadialBrush1, r);
  2208.         }
  2209.     }
  2210.  
  2211.  
  2212.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
  2213.     {
  2214.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2215.         DrawRadial(c1, c2, DrawRadialRectangle);
  2216.     }
  2217.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
  2218.     {
  2219.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2220.         DrawRadial(c1, c2, DrawRadialRectangle, angle);
  2221.     }
  2222.  
  2223.     protected void DrawRadial(Color c1, Color c2, Rectangle r)
  2224.     {
  2225.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
  2226.         G.FillEllipse(DrawRadialBrush2, r);
  2227.     }
  2228.     protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
  2229.     {
  2230.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
  2231.         G.FillEllipse(DrawRadialBrush2, r);
  2232.     }
  2233.  
  2234.     #endregion
  2235.  
  2236.     #region " CreateRound "
  2237.  
  2238.     private GraphicsPath CreateRoundPath;
  2239.  
  2240.     private Rectangle CreateRoundRectangle;
  2241.     public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
  2242.     {
  2243.         CreateRoundRectangle = new Rectangle(x, y, width, height);
  2244.         return CreateRound(CreateRoundRectangle, slope);
  2245.     }
  2246.  
  2247.     public GraphicsPath CreateRound(Rectangle r, int slope)
  2248.     {
  2249.         CreateRoundPath = new GraphicsPath(FillMode.Winding);
  2250.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
  2251.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
  2252.         CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
  2253.         CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
  2254.         CreateRoundPath.CloseFigure();
  2255.         return CreateRoundPath;
  2256.     }
  2257.  
  2258.     #endregion
  2259.  
  2260. }
  2261.  
  2262. static class ThemeShare
  2263. {
  2264.  
  2265.     #region " Animation "
  2266.  
  2267.     private static int Frames;
  2268.     private static bool Invalidate;
  2269.  
  2270.     public static PrecisionTimer ThemeTimer = new PrecisionTimer();
  2271.     //1000 / 50 = 20 FPS
  2272.     private const int FPS = 50;
  2273.  
  2274.     private const int Rate = 10;
  2275.     public delegate void AnimationDelegate(bool invalidate);
  2276.  
  2277.  
  2278.     private static List<AnimationDelegate> Callbacks = new List<AnimationDelegate>();
  2279.     private static void HandleCallbacks(IntPtr state, bool reserve)
  2280.     {
  2281.         Invalidate = (Frames >= FPS);
  2282.         if (Invalidate)
  2283.             Frames = 0;
  2284.  
  2285.         lock (Callbacks)
  2286.         {
  2287.             for (int I = 0; I <= Callbacks.Count - 1; I++)
  2288.             {
  2289.                 Callbacks[I].Invoke(Invalidate);
  2290.             }
  2291.         }
  2292.  
  2293.         Frames += Rate;
  2294.     }
  2295.  
  2296.     private static void InvalidateThemeTimer()
  2297.     {
  2298.         if (Callbacks.Count == 0)
  2299.         {
  2300.             ThemeTimer.Delete();
  2301.         }
  2302.         else
  2303.         {
  2304.             ThemeTimer.Create(0, Rate, HandleCallbacks);
  2305.         }
  2306.     }
  2307.  
  2308.     public static void AddAnimationCallback(AnimationDelegate callback)
  2309.     {
  2310.         lock (Callbacks)
  2311.         {
  2312.             if (Callbacks.Contains(callback))
  2313.                 return;
  2314.  
  2315.             Callbacks.Add(callback);
  2316.             InvalidateThemeTimer();
  2317.         }
  2318.     }
  2319.  
  2320.     public static void RemoveAnimationCallback(AnimationDelegate callback)
  2321.     {
  2322.         lock (Callbacks)
  2323.         {
  2324.             if (!Callbacks.Contains(callback))
  2325.                 return;
  2326.  
  2327.             Callbacks.Remove(callback);
  2328.             InvalidateThemeTimer();
  2329.         }
  2330.     }
  2331.  
  2332.     #endregion
  2333.  
  2334. }
  2335.  
  2336. enum MouseState : byte
  2337. {
  2338.     None = 0,
  2339.     Over = 1,
  2340.     Down = 2,
  2341.     Block = 3
  2342. }
  2343.  
  2344. struct Bloom
  2345. {
  2346.  
  2347.     public string _Name;
  2348.     public string Name
  2349.     {
  2350.         get { return _Name; }
  2351.     }
  2352.  
  2353.     private Color _Value;
  2354.     public Color Value
  2355.     {
  2356.         get { return _Value; }
  2357.         set { _Value = value; }
  2358.     }
  2359.  
  2360.     public string ValueHex
  2361.     {
  2362.         get { return string.Concat("#", _Value.R.ToString("X2", null), _Value.G.ToString("X2", null), _Value.B.ToString("X2", null)); }
  2363.         set
  2364.         {
  2365.             try
  2366.             {
  2367.                 _Value = ColorTranslator.FromHtml(value);
  2368.             }
  2369.             catch
  2370.             {
  2371.                 return;
  2372.             }
  2373.         }
  2374.     }
  2375.  
  2376.  
  2377.     public Bloom(string name, Color value)
  2378.     {
  2379.         _Name = name;
  2380.         _Value = value;
  2381.     }
  2382. }
  2383.  
  2384. //------------------
  2385. //Creator: aeonhack
  2386. //Site: elitevs.net
  2387. //Created: 11/30/2011
  2388. //Changed: 11/30/2011
  2389. //Version: 1.0.0
  2390. //------------------
  2391. class PrecisionTimer : IDisposable
  2392. {
  2393.  
  2394.     private bool _Enabled;
  2395.     public bool Enabled
  2396.     {
  2397.         get { return _Enabled; }
  2398.     }
  2399.  
  2400.     private IntPtr Handle;
  2401.  
  2402.     private TimerDelegate TimerCallback;
  2403.     [DllImport("kernel32.dll", EntryPoint = "CreateTimerQueueTimer")]
  2404.     private static extern bool CreateTimerQueueTimer(ref IntPtr handle, IntPtr queue, TimerDelegate callback, IntPtr state, uint dueTime, uint period, uint flags);
  2405.  
  2406.     [DllImport("kernel32.dll", EntryPoint = "DeleteTimerQueueTimer")]
  2407.     private static extern bool DeleteTimerQueueTimer(IntPtr queue, IntPtr handle, IntPtr callback);
  2408.  
  2409.     public delegate void TimerDelegate(IntPtr r1, bool r2);
  2410.  
  2411.     public void Create(uint dueTime, uint period, TimerDelegate callback)
  2412.     {
  2413.         if (_Enabled)
  2414.             return;
  2415.  
  2416.         TimerCallback = callback;
  2417.         bool Success = CreateTimerQueueTimer(ref Handle, IntPtr.Zero, TimerCallback, IntPtr.Zero, dueTime, period, 0);
  2418.  
  2419.         if (!Success)
  2420.             ThrowNewException("CreateTimerQueueTimer");
  2421.         _Enabled = Success;
  2422.     }
  2423.  
  2424.     public void Delete()
  2425.     {
  2426.         if (!_Enabled)
  2427.             return;
  2428.         bool Success = DeleteTimerQueueTimer(IntPtr.Zero, Handle, IntPtr.Zero);
  2429.  
  2430.         if (!Success && !(Marshal.GetLastWin32Error() == 997))
  2431.         {
  2432.             ThrowNewException("DeleteTimerQueueTimer");
  2433.         }
  2434.  
  2435.         _Enabled = !Success;
  2436.     }
  2437.  
  2438.     private void ThrowNewException(string name)
  2439.     {
  2440.         throw new Exception(string.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error()));
  2441.     }
  2442.  
  2443.     public void Dispose()
  2444.     {
  2445.         Delete();
  2446.     }
  2447. }
  2448. #endregion
  2449.  
  2450. class EvolveButton : ThemeControl154
  2451. {
  2452.     protected override void ColorHook()
  2453.     {
  2454.     }
  2455.  
  2456.     public void DrawRoundedRectangle(System.Drawing.Graphics g, Rectangle r, int d, Pen p)
  2457.     {
  2458.         System.Drawing.Drawing2D.SmoothingMode mode = g.SmoothingMode;
  2459.         g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  2460.         g.DrawArc(p, r.X, r.Y, d, d, 180, 90);
  2461.         g.DrawLine(p, Convert.ToInt32(r.X + d / 2), r.Y, Convert.ToInt32(r.X + r.Width - d / 2), r.Y);
  2462.         g.DrawArc(p, r.X + r.Width - d, r.Y, d, d, 270, 90);
  2463.         g.DrawLine(p, r.X, Convert.ToInt32(r.Y + d / 2), r.X, Convert.ToInt32(r.Y + r.Height - d / 2));
  2464.         g.DrawLine(p, Convert.ToInt32(r.X + r.Width), Convert.ToInt32(r.Y + d / 2), Convert.ToInt32(r.X + r.Width), Convert.ToInt32(r.Y + r.Height - d / 2));
  2465.         g.DrawLine(p, Convert.ToInt32(r.X + d / 2), Convert.ToInt32(r.Y + r.Height), Convert.ToInt32(r.X + r.Width - d / 2), Convert.ToInt32(r.Y + r.Height));
  2466.         g.DrawArc(p, r.X, r.Y + r.Height - d, d, d, 90, 90);
  2467.         g.DrawArc(p, r.X + r.Width - d, r.Y + r.Height - d, d, d, 0, 90);
  2468.         g.SmoothingMode = mode;
  2469.     }
  2470.  
  2471.     public EvolveButton()
  2472.     {
  2473.         Transparent = true;
  2474.     }
  2475.  
  2476.     protected override void PaintHook()
  2477.     {
  2478.         if (State == MouseState.None)
  2479.         {
  2480.             LinearGradientBrush Gradientbrush1 = new LinearGradientBrush(new Rectangle(new Point(3, 2), new Size(Width - 6, (Height / 5) * 2)), Color.FromArgb(88, 88, 88), Color.FromArgb(47, 47, 47), 90f);
  2481.             G.FillRectangle(Gradientbrush1, new Rectangle(new Point(4, 2), new Size(Width - 7, (Height / 5) * 2)));
  2482.             G.DrawLine(new Pen(Color.FromArgb(121, 121, 121)), new Point(4, 2), new Point(Width - 5, 2));
  2483.             Gradientbrush1 = new LinearGradientBrush(new Rectangle(new Point(3, (Height / 5) * 2), new Size(Width - 6, Height - 16)), Color.FromArgb(43, 43, 43), Color.FromArgb(21, 21, 21), 90f);
  2484.             G.FillRectangle(Gradientbrush1, new Rectangle(new Point(3, (Height / 5) * 2 + 1), new Size(Width - 6, Height - 16)));
  2485.             G.DrawLine(new Pen(Color.FromArgb(21, 21, 21)), new Point(6, Height - 2), new Point(Width - 5, Height - 2));
  2486.             G.DrawLine(new Pen(Color.FromArgb(21, 21, 21)), new Point(5, Height - 3), new Point(Width - 5, Height - 3));
  2487.             G.DrawLine(new Pen(Color.FromArgb(21, 21, 21)), new Point(4, Height - 4), new Point(Width - 4, Height - 4));
  2488.         }
  2489.         else if (State == MouseState.Over)
  2490.         {
  2491.             LinearGradientBrush Gradientbrush1 = new LinearGradientBrush(new Rectangle(new Point(3, 2), new Size(Width - 6, (Height / 5) * 2)), Color.FromArgb(162, 72, 72), Color.FromArgb(134, 38, 38), 90f);
  2492.             G.FillRectangle(Gradientbrush1, new Rectangle(new Point(4, 2), new Size(Width - 7, (Height / 5) * 2)));
  2493.             G.DrawLine(new Pen(Color.FromArgb(179, 105, 105)), new Point(4, 2), new Point(Width - 5, 2));
  2494.             Gradientbrush1 = new LinearGradientBrush(new Rectangle(new Point(3, (Height / 5) * 2), new Size(Width - 6, Height - 16)), Color.FromArgb(126, 26, 26), Color.FromArgb(88, 12, 12), 90f);
  2495.             G.FillRectangle(Gradientbrush1, new Rectangle(new Point(3, (Height / 5) * 2 + 1), new Size(Width - 6, Height - 16)));
  2496.             G.DrawLine(new Pen(Color.FromArgb(88, 12, 12)), new Point(6, Height - 2), new Point(Width - 5, Height - 2));
  2497.             G.DrawLine(new Pen(Color.FromArgb(88, 12, 12)), new Point(5, Height - 3), new Point(Width - 5, Height - 3));
  2498.             G.DrawLine(new Pen(Color.FromArgb(88, 12, 12)), new Point(4, Height - 4), new Point(Width - 4, Height - 4));
  2499.         }
  2500.         else if (State == MouseState.Down)
  2501.         {
  2502.             LinearGradientBrush Gradientbrush1 = new LinearGradientBrush(new Rectangle(new Point(3, 2), new Size(Width - 6, (Height / 5) * 2)), Color.FromArgb(86, 21, 21), Color.FromArgb(136, 38, 38), 90f);
  2503.             G.FillRectangle(Gradientbrush1, new Rectangle(new Point(4, 2), new Size(Width - 7, (Height / 5) * 2)));
  2504.             Gradientbrush1 = new LinearGradientBrush(new Rectangle(new Point(3, (Height / 5) * 2), new Size(Width - 6, Height - 16)), Color.FromArgb(114, 30, 30), Color.FromArgb(149, 64, 64), 90f);
  2505.             G.FillRectangle(Gradientbrush1, new Rectangle(new Point(3, (Height / 5) * 2 + 1), new Size(Width - 6, Height - 16)));
  2506.             G.DrawLine(new Pen(Color.FromArgb(149, 64, 64)), new Point(6, Height - 2), new Point(Width - 5, Height - 2));
  2507.             G.DrawLine(new Pen(Color.FromArgb(149, 64, 64)), new Point(5, Height - 3), new Point(Width - 5, Height - 3));
  2508.             G.DrawLine(new Pen(Color.FromArgb(149, 64, 64)), new Point(4, Height - 4), new Point(Width - 4, Height - 4));
  2509.         }
  2510.  
  2511.         G.DrawLine(Pens.Black, new Point(3, 3), new Point(3, this.Height - 4));
  2512.         G.DrawLine(Pens.Black, new Point(5, 1), new Point(this.Width - 5, 1));
  2513.         G.DrawLine(Pens.Black, new Point(this.Width - 3, 3), new Point(this.Width - 3, this.Height - 4));
  2514.         G.DrawLine(Pens.Black, new Point(5, this.Height - 2), new Point(this.Width - 5, this.Height - 2));
  2515.         DrawPixel(Color.Black, 4, 2);
  2516.         DrawPixel(Color.Black, this.Width - 4, 2);
  2517.         DrawPixel(Color.Black, 4, this.Height - 3);
  2518.         DrawPixel(Color.Black, this.Width - 4, this.Height - 3);
  2519.  
  2520.         SizeF textSize = this.CreateGraphics().MeasureString(Text, Font, Width - 4);
  2521.         StringFormat sf = new StringFormat();
  2522.         sf.LineAlignment = StringAlignment.Center;
  2523.         sf.Alignment = StringAlignment.Center;
  2524.         G.DrawString(Text, Font, Brushes.Black, new RectangleF(1, 3, this.Width - 5, this.Height - 4), sf);
  2525.         G.DrawString(Text, Font, Brushes.Black, new RectangleF(3, 3, this.Width - 5, this.Height - 4), sf);
  2526.         G.DrawString(Text, Font, Brushes.White, new RectangleF(2, 2, this.Width - 5, this.Height - 4), sf);
  2527.  
  2528.     }
  2529. }
  2530.  
  2531. class EvolveProgressBar : ThemeControl154
  2532. {
  2533.  
  2534.     private int _Value;
  2535.     public int Value
  2536.     {
  2537.         get { return _Value; }
  2538.         set
  2539.         {
  2540.             if (value >= Minimum & value <= _Max)
  2541.                 _Value = value;
  2542.             Invalidate();
  2543.         }
  2544.     }
  2545.  
  2546.     private int _Max = 100;
  2547.     public int Maximum
  2548.     {
  2549.         get { return _Max; }
  2550.         set
  2551.         {
  2552.             if (value > _Min)
  2553.                 _Max = value;
  2554.             Invalidate();
  2555.         }
  2556.     }
  2557.  
  2558.     private int _Min = 0;
  2559.     public int Minimum
  2560.     {
  2561.         get { return _Min; }
  2562.         set
  2563.         {
  2564.             if (value < _Max)
  2565.                 _Min = value;
  2566.             Invalidate();
  2567.         }
  2568.     }
  2569.  
  2570.     public EvolveProgressBar()
  2571.     {
  2572.         Transparent = true;
  2573.     }
  2574.  
  2575.     protected override void ColorHook()
  2576.     {
  2577.     }
  2578.  
  2579.     protected override void OnResize(System.EventArgs e)
  2580.     {
  2581.         base.OnResize(e);
  2582.         Height = 11;
  2583.     }
  2584.  
  2585.     protected override void PaintHook()
  2586.     {
  2587.         G.SmoothingMode = SmoothingMode.AntiAlias;
  2588.  
  2589.         LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(new Point(6, 0), new Size(Width - 6, 10)), Color.FromArgb(10, 10, 10), Color.FromArgb(47, 47, 47), 90f);
  2590.         G.FillRectangle(Gbrush, new Rectangle(new Point(6, 0), new Size(Width - 12, 10)));
  2591.         G.FillEllipse(Gbrush, new Rectangle(new Point(0, 0), new Size(10, 10)));
  2592.         G.FillEllipse(Gbrush, new Rectangle(new Point(this.Width - 11, 0), new Size(10, 10)));
  2593.         if (Value < 3)
  2594.         {
  2595.             Gbrush = new LinearGradientBrush(new Rectangle(new Point(6, 0), new Size(Width - 6, 10)), Color.FromArgb(180, 80, 80), Color.FromArgb(160, 70, 70), 90f);
  2596.             G.FillEllipse(Gbrush, new Rectangle(new Point((this.Width / 100) * _Value - 7, 0), new Size(5, 6)));
  2597.             Gbrush = new LinearGradientBrush(new Rectangle(new Point(6, 0), new Size(Width - 6, 10)), Color.FromArgb(150, 40, 40), Color.FromArgb(120, 30, 30), 90f);
  2598.             G.FillEllipse(Gbrush, new Rectangle(new Point((this.Width / 100) * _Value - 7, 4), new Size(6, 6)));
  2599.             HatchBrush Hatch = new HatchBrush(HatchStyle.WideUpwardDiagonal, Color.FromArgb(50, Color.Black), Color.Transparent);
  2600.             G.FillRectangle(Hatch, new Rectangle(new Point(2, 1), new Size((this.Width / 100) * _Value - 2, 8)));
  2601.         }
  2602.         else
  2603.         {
  2604.             Gbrush = new LinearGradientBrush(new Rectangle(new Point(6, 0), new Size(Width - 6, 10)), Color.FromArgb(180, 80, 80), Color.FromArgb(160, 70, 70), 90f);
  2605.             G.FillEllipse(Gbrush, new Rectangle(new Point((this.Width / 100) * _Value - 7, 0), new Size(5, 6)));
  2606.             G.FillEllipse(Gbrush, new Rectangle(new Point(1, 1), new Size(9, 5)));
  2607.             G.FillRectangle(Gbrush, new Rectangle(new Point(7, 1), new Size((this.Width / 100) * _Value - 11, 4)));
  2608.             Gbrush = new LinearGradientBrush(new Rectangle(new Point(6, 0), new Size(Width - 6, 10)), Color.FromArgb(150, 40, 40), Color.FromArgb(120, 30, 30), 90f);
  2609.             G.FillEllipse(Gbrush, new Rectangle(new Point((this.Width / 100) * _Value - 7, 4), new Size(6, 6)));
  2610.             G.FillEllipse(Gbrush, new Rectangle(new Point(1, 5), new Size(9, 6)));
  2611.             G.FillRectangle(Gbrush, new Rectangle(new Point(7, 5), new Size((this.Width / 100) * _Value - 11, 4)));
  2612.             HatchBrush Hatch = new HatchBrush(HatchStyle.WideUpwardDiagonal, Color.FromArgb(50, Color.Black), Color.Transparent);
  2613.             G.FillRectangle(Hatch, new Rectangle(new Point(2, 1), new Size((this.Width / 100) * _Value - 2, 8)));
  2614.         }
  2615.  
  2616.         G.DrawArc(Pens.Black, new Rectangle(new Point(0, 0), new Size(10, 10)), -90, -180);
  2617.         G.DrawLine(Pens.Black, new Point(6, 0), new Point(this.Width - 7, 0));
  2618.         G.DrawLine(Pens.Black, new Point(6, 10), new Point(this.Width - 7, 10));
  2619.         G.DrawArc(Pens.Black, new Rectangle(new Point(this.Width - 11, 0), new Size(10, 10)), 90, -180);
  2620.         G.DrawLine(new Pen(Color.FromArgb(72, 72, 72)), new Point(4, 11), new Point(this.Width - 4, 11));
  2621.         G.DrawArc(Pens.Black, new Rectangle(new Point((this.Width / 100) * _Value - 11, 0), new Size(10, 10)), 90, -180);
  2622.  
  2623.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 0);
  2624.         DrawPixel(Color.FromArgb(47, 47, 47), 1, 0);
  2625.         DrawPixel(Color.FromArgb(47, 47, 47), 2, 0);
  2626.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 1);
  2627.         DrawPixel(Color.FromArgb(47, 47, 47), 1, 1);
  2628.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 2);
  2629.         DrawPixel(Color.FromArgb(47, 47, 47), 1, 1);
  2630.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 3);
  2631.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 4);
  2632.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 9);
  2633.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 8);
  2634.         DrawPixel(Color.FromArgb(47, 47, 47), 0, 10);
  2635.         DrawPixel(Color.FromArgb(47, 47, 47), 1, 10);
  2636.         DrawPixel(Color.FromArgb(47, 47, 47), 2, 10);
  2637.     }
  2638. }
  2639.  
  2640. class EvolveCheckBox : ThemeControl154
  2641. {
  2642.     private bool _Checked;
  2643.  
  2644.     private int X;
  2645.     protected override void ColorHook()
  2646.     {
  2647.     }
  2648.  
  2649.     public bool Checked
  2650.     {
  2651.         get { return _Checked; }
  2652.         set
  2653.         {
  2654.             _Checked = value;
  2655.             Invalidate();
  2656.         }
  2657.     }
  2658.  
  2659.     protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  2660.     {
  2661.         base.OnMouseMove(e);
  2662.         X = e.Location.X;
  2663.         Invalidate();
  2664.     }
  2665.  
  2666.     protected override void OnClick(System.EventArgs e)
  2667.     {
  2668.         base.OnClick(e);
  2669.         if (_Checked)
  2670.             _Checked = false;
  2671.         else
  2672.             _Checked = true;
  2673.     }
  2674.  
  2675.     public EvolveCheckBox()
  2676.     {
  2677.         this.BackColor = Color.FromArgb(47, 47, 47);
  2678.     }
  2679.  
  2680.     protected override void OnTextChanged(System.EventArgs e)
  2681.     {
  2682.         base.OnTextChanged(e);
  2683.         int textSize = 0;
  2684.         textSize = (int)this.CreateGraphics().MeasureString(Text, Font).Width;
  2685.         this.Width = 20 + textSize;
  2686.     }
  2687.  
  2688.     protected override void PaintHook()
  2689.     {
  2690.         G.Clear(Color.FromArgb(47, 47, 47));
  2691.         if (!Checked & State == MouseState.None)
  2692.         {
  2693.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(new Point(1, 1), new Size(14, 14)), Color.FromArgb(74, 74, 74), Color.FromArgb(22, 22, 22), 90f);
  2694.             G.FillRectangle(Gbrush, new Rectangle(new Point(1, 1), new Size(14, 14)));
  2695.             G.DrawLine(Pens.Black, 1, 0, 14, 0);
  2696.             G.DrawLine(Pens.Black, 0, 1, 0, 14);
  2697.             G.DrawLine(Pens.Black, 15, 1, 15, 14);
  2698.             G.DrawLine(Pens.Black, 1, 15, 14, 15);
  2699.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 0);
  2700.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 0);
  2701.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 15);
  2702.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 15);
  2703.             DrawPixel(Color.FromArgb(85, 85, 85), 1, 1);
  2704.             DrawPixel(Color.FromArgb(85, 85, 85), 1, 2);
  2705.             DrawPixel(Color.FromArgb(85, 85, 85), 14, 1);
  2706.             DrawPixel(Color.FromArgb(85, 85, 85), 14, 2);
  2707.             DrawPixel(Color.FromArgb(16, 16, 16), 1, 14);
  2708.             DrawPixel(Color.FromArgb(16, 16, 16), 14, 14);
  2709.             G.DrawLine(new Pen(Color.FromArgb(110, 110, 110)), 2, 1, 13, 1);
  2710.         }
  2711.         else if (!Checked & State == MouseState.Over & X < 17)
  2712.         {
  2713.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(new Point(1, 1), new Size(14, 14)), Color.FromArgb(120, 51, 51), Color.FromArgb(50, 13, 13), 90f);
  2714.             G.FillRectangle(Gbrush, new Rectangle(new Point(1, 1), new Size(14, 14)));
  2715.             G.DrawLine(Pens.Black, 1, 0, 14, 0);
  2716.             G.DrawLine(Pens.Black, 0, 1, 0, 14);
  2717.             G.DrawLine(Pens.Black, 15, 1, 15, 14);
  2718.             G.DrawLine(Pens.Black, 1, 15, 14, 15);
  2719.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 0);
  2720.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 0);
  2721.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 15);
  2722.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 15);
  2723.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 1);
  2724.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 2);
  2725.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 1);
  2726.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 2);
  2727.             DrawPixel(Color.FromArgb(69, 9, 9), 1, 14);
  2728.             DrawPixel(Color.FromArgb(69, 9, 9), 14, 14);
  2729.             G.DrawLine(new Pen(Color.FromArgb(145, 90, 90)), 2, 1, 13, 1);
  2730.         }
  2731.         else if (Checked & State == MouseState.None)
  2732.         {
  2733.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(new Point(1, 1), new Size(14, 14)), Color.FromArgb(161, 51, 51), Color.FromArgb(99, 13, 13), 90f);
  2734.             G.FillRectangle(Gbrush, new Rectangle(new Point(1, 1), new Size(14, 14)));
  2735.             G.DrawLine(Pens.Black, 1, 0, 14, 0);
  2736.             G.DrawLine(Pens.Black, 0, 1, 0, 14);
  2737.             G.DrawLine(Pens.Black, 15, 1, 15, 14);
  2738.             G.DrawLine(Pens.Black, 1, 15, 14, 15);
  2739.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 0);
  2740.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 0);
  2741.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 15);
  2742.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 15);
  2743.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 1);
  2744.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 2);
  2745.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 1);
  2746.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 2);
  2747.             DrawPixel(Color.FromArgb(69, 9, 9), 1, 14);
  2748.             DrawPixel(Color.FromArgb(69, 9, 9), 14, 14);
  2749.             G.DrawLine(new Pen(Color.FromArgb(181, 90, 90)), 2, 1, 13, 1);
  2750.             G.DrawString("a", new Font("Webdings", 13), new SolidBrush(Color.FromArgb(78, 12, 12)), new Point(-3, -2));
  2751.             G.DrawString("a", new Font("Webdings", 13), Brushes.White, new Point(-3, -3));
  2752.         }
  2753.         else if (Checked & State == MouseState.Over & X < 17)
  2754.         {
  2755.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(new Point(1, 1), new Size(14, 14)), Color.FromArgb(180, 51, 51), Color.FromArgb(120, 20, 20), 90f);
  2756.             G.FillRectangle(Gbrush, new Rectangle(new Point(1, 1), new Size(14, 14)));
  2757.             G.DrawLine(Pens.Black, 1, 0, 14, 0);
  2758.             G.DrawLine(Pens.Black, 0, 1, 0, 14);
  2759.             G.DrawLine(Pens.Black, 15, 1, 15, 14);
  2760.             G.DrawLine(Pens.Black, 1, 15, 14, 15);
  2761.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 0);
  2762.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 0);
  2763.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 15);
  2764.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 15);
  2765.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 1);
  2766.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 2);
  2767.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 1);
  2768.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 2);
  2769.             DrawPixel(Color.FromArgb(69, 9, 9), 1, 14);
  2770.             DrawPixel(Color.FromArgb(69, 9, 9), 14, 14);
  2771.             G.DrawLine(new Pen(Color.FromArgb(181, 90, 90)), 2, 1, 13, 1);
  2772.             G.DrawString("a", new Font("Webdings", 13), new SolidBrush(Color.FromArgb(78, 12, 12)), new Point(-3, -2));
  2773.             G.DrawString("a", new Font("Webdings", 13), Brushes.White, new Point(-3, -3));
  2774.         }
  2775.         else if (Checked & State == MouseState.Over & X >= 17)
  2776.         {
  2777.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(new Point(1, 1), new Size(14, 14)), Color.FromArgb(161, 51, 51), Color.FromArgb(99, 13, 13), 90f);
  2778.             G.FillRectangle(Gbrush, new Rectangle(new Point(1, 1), new Size(14, 14)));
  2779.             G.DrawLine(Pens.Black, 1, 0, 14, 0);
  2780.             G.DrawLine(Pens.Black, 0, 1, 0, 14);
  2781.             G.DrawLine(Pens.Black, 15, 1, 15, 14);
  2782.             G.DrawLine(Pens.Black, 1, 15, 14, 15);
  2783.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 0);
  2784.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 0);
  2785.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 15);
  2786.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 15);
  2787.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 1);
  2788.             DrawPixel(Color.FromArgb(125, 75, 75), 1, 2);
  2789.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 1);
  2790.             DrawPixel(Color.FromArgb(125, 75, 75), 14, 2);
  2791.             DrawPixel(Color.FromArgb(69, 9, 9), 1, 14);
  2792.             DrawPixel(Color.FromArgb(69, 9, 9), 14, 14);
  2793.             G.DrawLine(new Pen(Color.FromArgb(181, 90, 90)), 2, 1, 13, 1);
  2794.             G.DrawString("a", new Font("Webdings", 13), new SolidBrush(Color.FromArgb(78, 12, 12)), new Point(-3, -2));
  2795.             G.DrawString("a", new Font("Webdings", 13), Brushes.White, new Point(-3, -3));
  2796.         }
  2797.         else
  2798.         {
  2799.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(new Point(1, 1), new Size(14, 14)), Color.FromArgb(74, 74, 74), Color.FromArgb(22, 22, 22), 90f);
  2800.             G.FillRectangle(Gbrush, new Rectangle(new Point(1, 1), new Size(14, 14)));
  2801.             G.DrawLine(Pens.Black, 1, 0, 14, 0);
  2802.             G.DrawLine(Pens.Black, 0, 1, 0, 14);
  2803.             G.DrawLine(Pens.Black, 15, 1, 15, 14);
  2804.             G.DrawLine(Pens.Black, 1, 15, 14, 15);
  2805.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 0);
  2806.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 0);
  2807.             DrawPixel(Color.FromArgb(40, Color.Black), 15, 15);
  2808.             DrawPixel(Color.FromArgb(40, Color.Black), 0, 15);
  2809.             DrawPixel(Color.FromArgb(85, 85, 85), 1, 1);
  2810.             DrawPixel(Color.FromArgb(85, 85, 85), 1, 2);
  2811.             DrawPixel(Color.FromArgb(85, 85, 85), 14, 1);
  2812.             DrawPixel(Color.FromArgb(85, 85, 85), 14, 2);
  2813.             DrawPixel(Color.FromArgb(16, 16, 16), 1, 14);
  2814.             DrawPixel(Color.FromArgb(16, 16, 16), 14, 14);
  2815.             G.DrawLine(new Pen(Color.FromArgb(110, 110, 110)), 2, 1, 13, 1);
  2816.         }
  2817.         G.DrawString(Text, Font, Brushes.Black, 20, 2);
  2818.         G.DrawString(Text, Font, Brushes.White, 20, 1);
  2819.     }
  2820. }
  2821.  
  2822. class EvolveRadiobutton : ThemeControl154
  2823. {
  2824.  
  2825.     private bool _Checked;
  2826.     public bool Checked
  2827.     {
  2828.         get { return _Checked; }
  2829.         set
  2830.         {
  2831.             _Checked = value;
  2832.             Invalidate();
  2833.         }
  2834.     }
  2835.  
  2836.     protected override void OnClick(System.EventArgs e)
  2837.     {
  2838.         base.OnClick(e);
  2839.         foreach (Control C in Parent.Controls)
  2840.         {
  2841.             if (C.GetType().ToString() == Strings.Replace(Application.ProductName, " ", "_") + ".XtremeRadiobutton")
  2842.             {
  2843.                 EvolveRadiobutton CC = null;
  2844.                 //CC = C;
  2845.                 CC.Checked = false;
  2846.             }
  2847.         }
  2848.         _Checked = true;
  2849.     }
  2850.  
  2851.  
  2852.     protected override void ColorHook()
  2853.     {
  2854.     }
  2855.  
  2856.     protected override void OnTextChanged(System.EventArgs e)
  2857.     {
  2858.         base.OnTextChanged(e);
  2859.         int textSize = 0;
  2860.         textSize = (int)this.CreateGraphics().MeasureString(Text, Font).Width;
  2861.         this.Width = 20 + textSize;
  2862.     }
  2863.  
  2864.     protected override void PaintHook()
  2865.     {
  2866.         G.Clear(Color.FromArgb(47, 47, 47));
  2867.         G.SmoothingMode = SmoothingMode.AntiAlias;
  2868.  
  2869.         if (_Checked == false)
  2870.         {
  2871.             G.FillEllipse(new SolidBrush(Color.Black), 0, 0, 16, 16);
  2872.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(1, 1, 14, 14), Color.FromArgb(112, 112, 112), Color.FromArgb(25, 25, 25), 90f);
  2873.             G.FillEllipse(Gbrush, new Rectangle(1, 1, 14, 14));
  2874.             Gbrush = new LinearGradientBrush(new Rectangle(2, 2, 12, 12), Color.FromArgb(76, 76, 76), Color.FromArgb(25, 25, 25), 90f);
  2875.             G.FillEllipse(Gbrush, new Rectangle(2, 2, 12, 12));
  2876.         }
  2877.         else
  2878.         {
  2879.             G.FillEllipse(new SolidBrush(Color.Black), 0, 0, 16, 16);
  2880.             LinearGradientBrush Gbrush = new LinearGradientBrush(new Rectangle(1, 1, 14, 14), Color.FromArgb(181, 93, 93), Color.FromArgb(80, 10, 10), 90f);
  2881.             G.FillEllipse(Gbrush, new Rectangle(1, 1, 14, 14));
  2882.             Gbrush = new LinearGradientBrush(new Rectangle(2, 2, 12, 12), Color.FromArgb(160, 53, 53), Color.FromArgb(100, 13, 13), 90f);
  2883.             G.FillEllipse(Gbrush, new Rectangle(2, 2, 12, 12));
  2884.             G.FillEllipse(Brushes.Black, new Rectangle(5, 6, 5, 5));
  2885.             G.FillEllipse(Brushes.White, new Rectangle(5, 5, 5, 5));
  2886.         }
  2887.  
  2888.         G.DrawString(Text, Font, Brushes.Black, 18, 2);
  2889.         G.DrawString(Text, Font, Brushes.White, 18, 1);
  2890.     }
  2891.  
  2892.     public EvolveRadiobutton()
  2893.     {
  2894.         this.Size = new Size(50, 14);
  2895.     }
  2896. }
  2897.  
  2898. class EvolveThemeControl : ThemeContainer154
  2899. {
  2900.     protected override void ColorHook()
  2901.     {
  2902.     }
  2903.  
  2904.     public EvolveThemeControl()
  2905.     {
  2906.         TransparencyKey = Color.Fuchsia;
  2907.         MinimumSize = new Size(80, 55);
  2908.         Font = new Font("Segoe UI", 9);
  2909.     }
  2910.  
  2911.     protected override void PaintHook()
  2912.     {
  2913.         G.Clear(Color.FromArgb(47, 47, 47));
  2914.         DrawBorders(new Pen(Color.FromArgb(104, 104, 104)), 1);
  2915.         ColorBlend cblend = new ColorBlend(2);
  2916.         cblend.Colors[0] = Color.FromArgb(66, 66, 66);
  2917.         cblend.Colors[1] = Color.FromArgb(50, 50, 50);
  2918.         cblend.Positions[0] = 0;
  2919.         cblend.Positions[1] = 1;
  2920.         DrawGradient(cblend, new Rectangle(new Point(2, 2), new Size(this.Width - 4, 22)));
  2921.         G.DrawLine(new Pen(Color.FromArgb(30, 30, 30)), new Point(2, 24), new Point(this.Width - 3, 24));
  2922.         G.DrawLine(new Pen(Color.FromArgb(70, 70, 70)), new Point(2, 25), new Point(this.Width - 3, 25));
  2923.         DrawBorders(Pens.Black);
  2924.         DrawCorners(Color.Fuchsia);
  2925.         G.DrawIcon(this.ParentForm.Icon, new Rectangle(new Point(8, 5), new Size(16, 16)));
  2926.         G.DrawString(this.ParentForm.Text, Font, Brushes.White, new Point(28, 4));
  2927.     }
  2928. }
  2929.  
  2930. class EvolveControlBox : ThemeControl154
  2931. {
  2932.     private bool _Min = true;
  2933.     private bool _Max = true;
  2934.  
  2935.     private int X;
  2936.     protected override void ColorHook()
  2937.     {
  2938.     }
  2939.  
  2940.     public bool MinButton
  2941.     {
  2942.         get { return _Min; }
  2943.         set
  2944.         {
  2945.             _Min = value;
  2946.             int tempwidth = 40;
  2947.             if (_Min)
  2948.                 tempwidth += 25;
  2949.             if (_Max)
  2950.                 tempwidth += 25;
  2951.             this.Width = tempwidth + 1;
  2952.             this.Height = 16;
  2953.             Invalidate();
  2954.         }
  2955.     }
  2956.  
  2957.     public bool MaxButton
  2958.     {
  2959.         get { return _Max; }
  2960.         set
  2961.         {
  2962.             _Max = value;
  2963.             int tempwidth = 40;
  2964.             if (_Min)
  2965.                 tempwidth += 25;
  2966.             if (_Max)
  2967.                 tempwidth += 25;
  2968.             this.Width = tempwidth + 1;
  2969.             this.Height = 16;
  2970.             Invalidate();
  2971.         }
  2972.     }
  2973.  
  2974.     public EvolveControlBox()
  2975.     {
  2976.         Size = new Size(92, 16);
  2977.         Location = new Point(50, 2);
  2978.     }
  2979.  
  2980.     protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  2981.     {
  2982.         base.OnMouseMove(e);
  2983.         X = e.Location.X;
  2984.         Invalidate();
  2985.     }
  2986.  
  2987.     protected override void OnClick(System.EventArgs e)
  2988.     {
  2989.         base.OnClick(e);
  2990.         if (_Min & _Max)
  2991.         {
  2992.             if (X > 0 & X < 25)
  2993.             {
  2994.                 FindForm().WindowState = FormWindowState.Minimized;
  2995.             }
  2996.             else if (X > 25 & X < 50)
  2997.             {
  2998.                 if (FindForm().WindowState == FormWindowState.Maximized)
  2999.                     FindForm().WindowState = FormWindowState.Normal;
  3000.                 else
  3001.                     FindForm().WindowState = FormWindowState.Maximized;
  3002.             }
  3003.             else if (X > 50 & X < 90)
  3004.             {
  3005.                 FindForm().Close();
  3006.             }
  3007.         }
  3008.         else if (_Min)
  3009.         {
  3010.             if (X > 0 & X < 25)
  3011.             {
  3012.                 FindForm().WindowState = FormWindowState.Minimized;
  3013.             }
  3014.             else if (X > 25 & X < 65)
  3015.             {
  3016.                 FindForm().Close();
  3017.             }
  3018.         }
  3019.         else if (_Max)
  3020.         {
  3021.             if (X > 0 & X < 25)
  3022.             {
  3023.                 if (FindForm().WindowState == FormWindowState.Maximized)
  3024.                     FindForm().WindowState = FormWindowState.Normal;
  3025.                 else
  3026.                     FindForm().WindowState = FormWindowState.Maximized;
  3027.             }
  3028.             else if (X > 25 & X < 65)
  3029.             {
  3030.                 FindForm().Close();
  3031.             }
  3032.         }
  3033.         else
  3034.         {
  3035.             if (X > 0 & X < 40)
  3036.             {
  3037.                 FindForm().Close();
  3038.             }
  3039.         }
  3040.     }
  3041.  
  3042.     protected override void PaintHook()
  3043.     {
  3044.         G.Clear(Color.FromArgb(47, 47, 47));
  3045.         ColorBlend cblend = new ColorBlend(2);
  3046.         cblend.Colors[0] = Color.FromArgb(66, 66, 66);
  3047.         cblend.Colors[1] = Color.FromArgb(50, 50, 50);
  3048.         cblend.Positions[0] = 0;
  3049.         cblend.Positions[1] = 1;
  3050.         DrawGradient(cblend, new Rectangle(new Point(0, 0), new Size(this.Width, this.Height)));
  3051.  
  3052.         if (_Min & _Max)
  3053.         {
  3054.             if (State == MouseState.Over)
  3055.             {
  3056.                 if (X > 0 & X < 25)
  3057.                 {
  3058.                     cblend = new ColorBlend(2);
  3059.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3060.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3061.                     cblend.Positions[0] = 0;
  3062.                     cblend.Positions[1] = 1;
  3063.                     DrawGradient(cblend, new Rectangle(new Point(1, 0), new Size(25, 15)));
  3064.                 }
  3065.                 if (X > 25 & X < 50)
  3066.                 {
  3067.                     cblend = new ColorBlend(2);
  3068.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3069.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3070.                     cblend.Positions[0] = 0;
  3071.                     cblend.Positions[1] = 1;
  3072.                     DrawGradient(cblend, new Rectangle(new Point(25, 0), new Size(25, 15)));
  3073.                 }
  3074.                 if (X > 50 & X < 90)
  3075.                 {
  3076.                     cblend = new ColorBlend(2);
  3077.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3078.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3079.                     cblend.Positions[0] = 0;
  3080.                     cblend.Positions[1] = 1;
  3081.                     DrawGradient(cblend, new Rectangle(new Point(50, 0), new Size(40, 15)));
  3082.                 }
  3083.             }
  3084.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(0, 0), new Point(0, 14));
  3085.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(1, 15), new Point(89, 15));
  3086.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(25, 0), new Point(25, 14));
  3087.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(50, 0), new Point(50, 14));
  3088.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(90, 0), new Point(90, 14));
  3089.             DrawPixel(Color.FromArgb(104, 104, 104), 1, 14);
  3090.             DrawPixel(Color.FromArgb(104, 104, 104), 89, 14);
  3091.             G.DrawString("r", new Font("Marlett", 8), Brushes.White, new Point(63, 2));
  3092.             if (FindForm().WindowState == FormWindowState.Normal)
  3093.             {
  3094.                 G.DrawString("1", new Font("Marlett", 8), Brushes.White, new Point(32, 2));
  3095.             }
  3096.             else
  3097.             {
  3098.                 G.DrawString("2", new Font("Marlett", 8), Brushes.White, new Point(32, 2));
  3099.             }
  3100.             G.DrawString("0", new Font("Marlett", 8), Brushes.White, new Point(6, 2));
  3101.         }
  3102.         else if (_Min)
  3103.         {
  3104.             if (State == MouseState.Over)
  3105.             {
  3106.                 if (X > 0 & X < 25)
  3107.                 {
  3108.                     cblend = new ColorBlend(2);
  3109.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3110.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3111.                     cblend.Positions[0] = 0;
  3112.                     cblend.Positions[1] = 1;
  3113.                     DrawGradient(cblend, new Rectangle(new Point(1, 0), new Size(25, 15)));
  3114.                 }
  3115.                 if (X > 25 & X < 65)
  3116.                 {
  3117.                     cblend = new ColorBlend(2);
  3118.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3119.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3120.                     cblend.Positions[0] = 0;
  3121.                     cblend.Positions[1] = 1;
  3122.                     DrawGradient(cblend, new Rectangle(new Point(25, 0), new Size(40, 15)));
  3123.                 }
  3124.             }
  3125.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(0, 0), new Point(0, 14));
  3126.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(25, 0), new Point(25, 14));
  3127.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(65, 0), new Point(65, 14));
  3128.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(1, 15), new Point(64, 15));
  3129.             DrawPixel(Color.FromArgb(104, 104, 104), 1, 14);
  3130.             DrawPixel(Color.FromArgb(104, 104, 104), 64, 14);
  3131.             G.DrawString("0", new Font("Marlett", 8), Brushes.White, new Point(6, 2));
  3132.             G.DrawString("r", new Font("Marlett", 8), Brushes.White, new Point(38, 2));
  3133.         }
  3134.         else if (_Max)
  3135.         {
  3136.             if (State == MouseState.Over)
  3137.             {
  3138.                 if (X > 0 & X < 25)
  3139.                 {
  3140.                     cblend = new ColorBlend(2);
  3141.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3142.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3143.                     cblend.Positions[0] = 0;
  3144.                     cblend.Positions[1] = 1;
  3145.                     DrawGradient(cblend, new Rectangle(new Point(1, 0), new Size(25, 15)));
  3146.                 }
  3147.                 if (X > 25 & X < 65)
  3148.                 {
  3149.                     cblend = new ColorBlend(2);
  3150.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3151.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3152.                     cblend.Positions[0] = 0;
  3153.                     cblend.Positions[1] = 1;
  3154.                     DrawGradient(cblend, new Rectangle(new Point(25, 0), new Size(40, 15)));
  3155.                 }
  3156.             }
  3157.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(0, 0), new Point(0, 14));
  3158.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(25, 0), new Point(25, 14));
  3159.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(65, 0), new Point(65, 14));
  3160.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(1, 15), new Point(64, 15));
  3161.             DrawPixel(Color.FromArgb(104, 104, 104), 1, 14);
  3162.             DrawPixel(Color.FromArgb(104, 104, 104), 64, 14);
  3163.             if (FindForm().WindowState == FormWindowState.Normal)
  3164.             {
  3165.                 G.DrawString("1", new Font("Marlett", 8), Brushes.White, new Point(6, 2));
  3166.             }
  3167.             else
  3168.             {
  3169.                 G.DrawString("2", new Font("Marlett", 8), Brushes.White, new Point(6, 2));
  3170.             }
  3171.             G.DrawString("r", new Font("Marlett", 8), Brushes.White, new Point(38, 2));
  3172.         }
  3173.         else
  3174.         {
  3175.             if (State == MouseState.Over)
  3176.             {
  3177.                 if (X > 0 & X < 40)
  3178.                 {
  3179.                     cblend = new ColorBlend(2);
  3180.                     cblend.Colors[0] = Color.FromArgb(80, 80, 80);
  3181.                     cblend.Colors[1] = Color.FromArgb(60, 60, 60);
  3182.                     cblend.Positions[0] = 0;
  3183.                     cblend.Positions[1] = 1;
  3184.                     DrawGradient(cblend, new Rectangle(new Point(1, 0), new Size(40, 15)));
  3185.                 }
  3186.             }
  3187.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(0, 0), new Point(0, 14));
  3188.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(40, 0), new Point(40, 14));
  3189.             G.DrawLine(new Pen(Color.FromArgb(104, 104, 104)), new Point(1, 15), new Point(39, 15));
  3190.             DrawPixel(Color.FromArgb(104, 104, 104), 1, 14);
  3191.             DrawPixel(Color.FromArgb(104, 104, 104), 39, 14);
  3192.             G.DrawString("r", new Font("Marlett", 8), Brushes.White, new Point(13, 2));
  3193.         }
  3194.     }
  3195. }
Advertisement
Add Comment
Please, Sign In to add comment