Don't like ads? PRO users don't see any ads ;-)
Guest

Drone Theme - C#

By: a guest on May 8th, 2012  |  syntax: C#  |  size: 61.39 KB  |  hits: 271  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using Microsoft.VisualBasic;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Diagnostics;
  7. using System.IO;
  8. using System.Drawing;
  9. using System.Drawing.Drawing2D;
  10. using System.ComponentModel;
  11. using System.Windows.Forms;
  12. using System.Runtime.InteropServices;
  13. using System.Drawing.Imaging;
  14. using System.Threading;
  15.  
  16. //------------------
  17. //Creator: aeonhack
  18. //Site: elitevs.net
  19. //Created: 08/02/2011
  20. //Changed: 10/9/2011
  21. //Version: 1.5.3
  22. //------------------
  23.  
  24. abstract class ThemeContainer153 : ContainerControl
  25. {
  26.  
  27.     #region " Initialization "
  28.  
  29.     protected Graphics G;
  30.  
  31.     protected Bitmap B;
  32.     public ThemeContainer153()
  33.     {
  34.         SetStyle((ControlStyles)139270, true);
  35.  
  36.         _ImageSize = Size.Empty;
  37.         Font = new Font("Verdana", 8);
  38.  
  39.         MeasureBitmap = new Bitmap(1, 1);
  40.         MeasureGraphics = Graphics.FromImage(MeasureBitmap);
  41.  
  42.         DrawRadialPath = new GraphicsPath();
  43.  
  44.         InvalidateCustimization();
  45.         //Remove?
  46.     }
  47.  
  48.     protected override sealed void OnHandleCreated(EventArgs e)
  49.     {
  50.         InvalidateCustimization();
  51.         ColorHook();
  52.  
  53.         if (!(_LockWidth == 0))
  54.             Width = _LockWidth;
  55.         if (!(_LockHeight == 0))
  56.             Height = _LockHeight;
  57.         if (!_ControlMode)
  58.             base.Dock = DockStyle.Fill;
  59.  
  60.         Transparent = _Transparent;
  61.         if (_Transparent && _BackColor)
  62.             BackColor = Color.Transparent;
  63.  
  64.         base.OnHandleCreated(e);
  65.     }
  66.  
  67.     protected override sealed void OnParentChanged(EventArgs e)
  68.     {
  69.         base.OnParentChanged(e);
  70.  
  71.         if (Parent == null)
  72.             return;
  73.         _IsParentForm = Parent is Form;
  74.  
  75.         if (!_ControlMode)
  76.         {
  77.             InitializeMessages();
  78.  
  79.             if (_IsParentForm)
  80.             {
  81.                 ParentForm.FormBorderStyle = _BorderStyle;
  82.                 ParentForm.TransparencyKey = _TransparencyKey;
  83.             }
  84.  
  85.             Parent.BackColor = BackColor;
  86.         }
  87.  
  88.         OnCreation();
  89.     }
  90.  
  91.     #endregion
  92.  
  93.  
  94.     protected override sealed void OnPaint(PaintEventArgs e)
  95.     {
  96.         if (Width == 0 || Height == 0)
  97.             return;
  98.  
  99.         if (_Transparent && _ControlMode)
  100.         {
  101.             PaintHook();
  102.             e.Graphics.DrawImage(B, 0, 0);
  103.         }
  104.         else
  105.         {
  106.             G = e.Graphics;
  107.             PaintHook();
  108.         }
  109.     }
  110.  
  111.  
  112.     #region " Size Handling "
  113.  
  114.     private Rectangle Frame;
  115.     protected override sealed void OnSizeChanged(EventArgs e)
  116.     {
  117.         if (_Movable && !_ControlMode)
  118.         {
  119.             Frame = new Rectangle(7, 7, Width - 14, _Header - 7);
  120.         }
  121.  
  122.         InvalidateBitmap();
  123.         Invalidate();
  124.  
  125.         base.OnSizeChanged(e);
  126.     }
  127.  
  128.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  129.     {
  130.         if (!(_LockWidth == 0))
  131.             width = _LockWidth;
  132.         if (!(_LockHeight == 0))
  133.             height = _LockHeight;
  134.         base.SetBoundsCore(x, y, width, height, specified);
  135.     }
  136.  
  137.     #endregion
  138.  
  139.     #region " State Handling "
  140.  
  141.     protected MouseState State;
  142.     private void SetState(MouseState current)
  143.     {
  144.         State = current;
  145.         Invalidate();
  146.     }
  147.  
  148.     protected override void OnMouseMove(MouseEventArgs e)
  149.     {
  150.         if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized))
  151.         {
  152.             if (_Sizable && !_ControlMode)
  153.                 InvalidateMouse();
  154.         }
  155.  
  156.         base.OnMouseMove(e);
  157.     }
  158.  
  159.     protected override void OnEnabledChanged(EventArgs e)
  160.     {
  161.         if (Enabled)
  162.             SetState(MouseState.None);
  163.         else
  164.             SetState(MouseState.Block);
  165.         base.OnEnabledChanged(e);
  166.     }
  167.  
  168.     protected override void OnMouseEnter(EventArgs e)
  169.     {
  170.         SetState(MouseState.Over);
  171.         base.OnMouseEnter(e);
  172.     }
  173.  
  174.     protected override void OnMouseUp(MouseEventArgs e)
  175.     {
  176.         SetState(MouseState.Over);
  177.         base.OnMouseUp(e);
  178.     }
  179.  
  180.     protected override void OnMouseLeave(EventArgs e)
  181.     {
  182.         SetState(MouseState.None);
  183.  
  184.         if (GetChildAtPoint(PointToClient(MousePosition)) != null)
  185.         {
  186.             if (_Sizable && !_ControlMode)
  187.             {
  188.                 Cursor = Cursors.Default;
  189.                 Previous = 0;
  190.             }
  191.         }
  192.  
  193.         base.OnMouseLeave(e);
  194.     }
  195.  
  196.     protected override void OnMouseDown(MouseEventArgs e)
  197.     {
  198.         if (e.Button == System.Windows.Forms.MouseButtons.Left)
  199.             SetState(MouseState.Down);
  200.  
  201.         if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized || _ControlMode))
  202.         {
  203.             if (_Movable && Frame.Contains(e.Location))
  204.             {
  205.                 Capture = false;
  206.                 WM_LMBUTTONDOWN = true;
  207.                 DefWndProc(ref Messages[0]);
  208.             }
  209.             else if (_Sizable && !(Previous == 0))
  210.             {
  211.                 Capture = false;
  212.                 WM_LMBUTTONDOWN = true;
  213.                 DefWndProc(ref Messages[Previous]);
  214.             }
  215.         }
  216.  
  217.         base.OnMouseDown(e);
  218.     }
  219.  
  220.     private bool WM_LMBUTTONDOWN;
  221.     protected override void WndProc(ref Message m)
  222.     {
  223.         base.WndProc(ref m);
  224.  
  225.         if (WM_LMBUTTONDOWN && m.Msg == 513)
  226.         {
  227.             WM_LMBUTTONDOWN = false;
  228.  
  229.             SetState(MouseState.Over);
  230.             if (!_SmartBounds)
  231.                 return;
  232.  
  233.             if (IsParentMdi)
  234.             {
  235.                 CorrectBounds(new Rectangle(Point.Empty, Parent.Parent.Size));
  236.             }
  237.             else
  238.             {
  239.                 CorrectBounds(Screen.FromControl(Parent).WorkingArea);
  240.             }
  241.         }
  242.     }
  243.  
  244.     private Point GetIndexPoint;
  245.     private bool B1;
  246.     private bool B2;
  247.     private bool B3;
  248.     private bool B4;
  249.     private int GetIndex()
  250.     {
  251.         GetIndexPoint = PointToClient(MousePosition);
  252.         B1 = GetIndexPoint.X < 7;
  253.         B2 = GetIndexPoint.X > Width - 7;
  254.         B3 = GetIndexPoint.Y < 7;
  255.         B4 = GetIndexPoint.Y > Height - 7;
  256.  
  257.         if (B1 && B3)
  258.             return 4;
  259.         if (B1 && B4)
  260.             return 7;
  261.         if (B2 && B3)
  262.             return 5;
  263.         if (B2 && B4)
  264.             return 8;
  265.         if (B1)
  266.             return 1;
  267.         if (B2)
  268.             return 2;
  269.         if (B3)
  270.             return 3;
  271.         if (B4)
  272.             return 6;
  273.         return 0;
  274.     }
  275.  
  276.     private int Current;
  277.     private int Previous;
  278.     private void InvalidateMouse()
  279.     {
  280.         Current = GetIndex();
  281.         if (Current == Previous)
  282.             return;
  283.  
  284.         Previous = Current;
  285.         switch (Previous)
  286.         {
  287.             case 0:
  288.                 Cursor = Cursors.Default;
  289.                 break;
  290.             case 1:
  291.             case 2:
  292.                 Cursor = Cursors.SizeWE;
  293.                 break;
  294.             case 3:
  295.             case 6:
  296.                 Cursor = Cursors.SizeNS;
  297.                 break;
  298.             case 4:
  299.             case 8:
  300.                 Cursor = Cursors.SizeNWSE;
  301.                 break;
  302.             case 5:
  303.             case 7:
  304.                 Cursor = Cursors.SizeNESW;
  305.                 break;
  306.         }
  307.     }
  308.  
  309.     private Message[] Messages = new Message[9];
  310.     private void InitializeMessages()
  311.     {
  312.         Messages[0] = Message.Create(Parent.Handle, 161, new IntPtr(2), IntPtr.Zero);
  313.         for (int I = 1; I <= 8; I++)
  314.         {
  315.             Messages[I] = Message.Create(Parent.Handle, 161, new IntPtr(I + 9), IntPtr.Zero);
  316.         }
  317.     }
  318.  
  319.     private void CorrectBounds(Rectangle bounds)
  320.     {
  321.         if (Parent.Width > bounds.Width)
  322.             Parent.Width = bounds.Width;
  323.         if (Parent.Height > bounds.Height)
  324.             Parent.Height = bounds.Height;
  325.  
  326.         int X = Parent.Location.X;
  327.         int Y = Parent.Location.Y;
  328.  
  329.         if (X < bounds.X)
  330.             X = bounds.X;
  331.         if (Y < bounds.Y)
  332.             Y = bounds.Y;
  333.  
  334.         int Width = bounds.X + bounds.Width;
  335.         int Height = bounds.Y + bounds.Height;
  336.  
  337.         if (X + Parent.Width > Width)
  338.             X = Width - Parent.Width;
  339.         if (Y + Parent.Height > Height)
  340.             Y = Height - Parent.Height;
  341.  
  342.         Parent.Location = new Point(X, Y);
  343.     }
  344.  
  345.     #endregion
  346.  
  347.  
  348.     #region " Base Properties "
  349.  
  350.     public override DockStyle Dock
  351.     {
  352.         get { return base.Dock; }
  353.         set
  354.         {
  355.             if (!_ControlMode)
  356.                 return;
  357.             base.Dock = value;
  358.         }
  359.     }
  360.  
  361.     private bool _BackColor;
  362.     [Category("Misc")]
  363.     public override Color BackColor
  364.     {
  365.         get { return base.BackColor; }
  366.         set
  367.         {
  368.             if (value == base.BackColor)
  369.                 return;
  370.  
  371.             if (!IsHandleCreated && _ControlMode && value == Color.Transparent)
  372.             {
  373.                 _BackColor = true;
  374.                 return;
  375.             }
  376.  
  377.             base.BackColor = value;
  378.             if (Parent != null)
  379.             {
  380.                 if (!_ControlMode)
  381.                     Parent.BackColor = value;
  382.                 ColorHook();
  383.             }
  384.         }
  385.     }
  386.  
  387.     public override Size MinimumSize
  388.     {
  389.         get { return base.MinimumSize; }
  390.         set
  391.         {
  392.             base.MinimumSize = value;
  393.             if (Parent != null)
  394.                 Parent.MinimumSize = value;
  395.         }
  396.     }
  397.  
  398.     public override Size MaximumSize
  399.     {
  400.         get { return base.MaximumSize; }
  401.         set
  402.         {
  403.             base.MaximumSize = value;
  404.             if (Parent != null)
  405.                 Parent.MaximumSize = value;
  406.         }
  407.     }
  408.  
  409.     public override string Text
  410.     {
  411.         get { return base.Text; }
  412.         set
  413.         {
  414.             base.Text = value;
  415.             Invalidate();
  416.         }
  417.     }
  418.  
  419.     public override Font Font
  420.     {
  421.         get { return base.Font; }
  422.         set
  423.         {
  424.             base.Font = value;
  425.             Invalidate();
  426.         }
  427.     }
  428.  
  429.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  430.     public override Color ForeColor
  431.     {
  432.         get { return Color.Empty; }
  433.         set { }
  434.     }
  435.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  436.     public override Image BackgroundImage
  437.     {
  438.         get { return null; }
  439.         set { }
  440.     }
  441.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  442.     public override ImageLayout BackgroundImageLayout
  443.     {
  444.         get { return ImageLayout.None; }
  445.         set { }
  446.     }
  447.  
  448.     #endregion
  449.  
  450.     #region " Public Properties "
  451.  
  452.     private bool _SmartBounds = true;
  453.     public bool SmartBounds
  454.     {
  455.         get { return _SmartBounds; }
  456.         set { _SmartBounds = value; }
  457.     }
  458.  
  459.     private bool _Movable = true;
  460.     public bool Movable
  461.     {
  462.         get { return _Movable; }
  463.         set { _Movable = value; }
  464.     }
  465.  
  466.     private bool _Sizable = true;
  467.     public bool Sizable
  468.     {
  469.         get { return _Sizable; }
  470.         set { _Sizable = value; }
  471.     }
  472.  
  473.     private Color _TransparencyKey;
  474.     public Color TransparencyKey
  475.     {
  476.         get
  477.         {
  478.             if (_IsParentForm && !_ControlMode)
  479.                 return ParentForm.TransparencyKey;
  480.             else
  481.                 return _TransparencyKey;
  482.         }
  483.         set
  484.         {
  485.             if (value == _TransparencyKey)
  486.                 return;
  487.             _TransparencyKey = value;
  488.  
  489.             if (_IsParentForm && !_ControlMode)
  490.             {
  491.                 ParentForm.TransparencyKey = value;
  492.                 ColorHook();
  493.             }
  494.         }
  495.     }
  496.  
  497.     private FormBorderStyle _BorderStyle;
  498.     public FormBorderStyle BorderStyle
  499.     {
  500.         get
  501.         {
  502.             if (_IsParentForm && !_ControlMode)
  503.                 return ParentForm.FormBorderStyle;
  504.             else
  505.                 return _BorderStyle;
  506.         }
  507.         set
  508.         {
  509.             _BorderStyle = value;
  510.  
  511.             if (_IsParentForm && !_ControlMode)
  512.             {
  513.                 ParentForm.FormBorderStyle = value;
  514.  
  515.                 if (!(value == FormBorderStyle.None))
  516.                 {
  517.                     Movable = false;
  518.                     Sizable = false;
  519.                 }
  520.             }
  521.         }
  522.     }
  523.  
  524.     private bool _NoRounding;
  525.     public bool NoRounding
  526.     {
  527.         get { return _NoRounding; }
  528.         set
  529.         {
  530.             _NoRounding = value;
  531.             Invalidate();
  532.         }
  533.     }
  534.  
  535.     private Image _Image;
  536.     public Image Image
  537.     {
  538.         get { return _Image; }
  539.         set
  540.         {
  541.             if (value == null)
  542.                 _ImageSize = Size.Empty;
  543.             else
  544.                 _ImageSize = value.Size;
  545.  
  546.             _Image = value;
  547.             Invalidate();
  548.         }
  549.     }
  550.  
  551.     private Dictionary<string, Color> Items = new Dictionary<string, Color>();
  552.     public Bloom[] Colors
  553.     {
  554.         get
  555.         {
  556.             List<Bloom> T = new List<Bloom>();
  557.             Dictionary<string, Color>.Enumerator E = Items.GetEnumerator();
  558.  
  559.             while (E.MoveNext())
  560.             {
  561.                 T.Add(new Bloom(E.Current.Key, E.Current.Value));
  562.             }
  563.  
  564.             return T.ToArray();
  565.         }
  566.         set
  567.         {
  568.             foreach (Bloom B in value)
  569.             {
  570.                 if (Items.ContainsKey(B.Name))
  571.                     Items[B.Name] = B.Value;
  572.             }
  573.  
  574.             InvalidateCustimization();
  575.             ColorHook();
  576.             Invalidate();
  577.         }
  578.     }
  579.  
  580.     private string _Customization;
  581.     public string Customization
  582.     {
  583.         get { return _Customization; }
  584.         set
  585.         {
  586.             if (value == _Customization)
  587.                 return;
  588.  
  589.             byte[] Data = null;
  590.             Bloom[] Items = Colors;
  591.  
  592.             try
  593.             {
  594.                 Data = Convert.FromBase64String(value);
  595.                 for (int I = 0; I <= Items.Length - 1; I++)
  596.                 {
  597.                     Items[I].Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4));
  598.                 }
  599.             }
  600.             catch
  601.             {
  602.                 return;
  603.             }
  604.  
  605.             _Customization = value;
  606.  
  607.             Colors = Items;
  608.             ColorHook();
  609.             Invalidate();
  610.         }
  611.     }
  612.  
  613.     private bool _Transparent;
  614.     public bool Transparent
  615.     {
  616.         get { return _Transparent; }
  617.         set
  618.         {
  619.             _Transparent = value;
  620.             if (!(IsHandleCreated || _ControlMode))
  621.                 return;
  622.  
  623.             if (!value && !(BackColor.A == 255))
  624.             {
  625.                 throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
  626.             }
  627.  
  628.             SetStyle(ControlStyles.Opaque, !value);
  629.             SetStyle(ControlStyles.SupportsTransparentBackColor, value);
  630.  
  631.             InvalidateBitmap();
  632.             Invalidate();
  633.         }
  634.     }
  635.  
  636.     #endregion
  637.  
  638.     #region " Private Properties "
  639.  
  640.     private Size _ImageSize;
  641.     protected Size ImageSize
  642.     {
  643.         get { return _ImageSize; }
  644.     }
  645.  
  646.     private bool _IsParentForm;
  647.     protected bool IsParentForm
  648.     {
  649.         get { return _IsParentForm; }
  650.     }
  651.  
  652.     protected bool IsParentMdi
  653.     {
  654.         get
  655.         {
  656.             if (Parent == null)
  657.                 return false;
  658.             return Parent.Parent != null;
  659.         }
  660.     }
  661.  
  662.     private int _LockWidth;
  663.     protected int LockWidth
  664.     {
  665.         get { return _LockWidth; }
  666.         set
  667.         {
  668.             _LockWidth = value;
  669.             if (!(LockWidth == 0) && IsHandleCreated)
  670.                 Width = LockWidth;
  671.         }
  672.     }
  673.  
  674.     private int _LockHeight;
  675.     protected int LockHeight
  676.     {
  677.         get { return _LockHeight; }
  678.         set
  679.         {
  680.             _LockHeight = value;
  681.             if (!(LockHeight == 0) && IsHandleCreated)
  682.                 Height = LockHeight;
  683.         }
  684.     }
  685.  
  686.     private int _Header = 24;
  687.     protected int Header
  688.     {
  689.         get { return _Header; }
  690.         set
  691.         {
  692.             _Header = value;
  693.  
  694.             if (!_ControlMode)
  695.             {
  696.                 Frame = new Rectangle(7, 7, Width - 14, value - 7);
  697.                 Invalidate();
  698.             }
  699.         }
  700.     }
  701.  
  702.     private bool _ControlMode;
  703.     protected bool ControlMode
  704.     {
  705.         get { return _ControlMode; }
  706.         set
  707.         {
  708.             _ControlMode = value;
  709.  
  710.             Transparent = _Transparent;
  711.             if (_Transparent && _BackColor)
  712.                 BackColor = Color.Transparent;
  713.  
  714.             InvalidateBitmap();
  715.             Invalidate();
  716.         }
  717.     }
  718.  
  719.     #endregion
  720.  
  721.  
  722.     #region " Property Helpers "
  723.  
  724.     protected Pen GetPen(string name)
  725.     {
  726.         return new Pen(Items[name]);
  727.     }
  728.     protected Pen GetPen(string name, float width)
  729.     {
  730.         return new Pen(Items[name], width);
  731.     }
  732.  
  733.     protected SolidBrush GetBrush(string name)
  734.     {
  735.         return new SolidBrush(Items[name]);
  736.     }
  737.  
  738.     protected Color GetColor(string name)
  739.     {
  740.         return Items[name];
  741.     }
  742.  
  743.     protected void SetColor(string name, Color value)
  744.     {
  745.         if (Items.ContainsKey(name))
  746.             Items[name] = value;
  747.         else
  748.             Items.Add(name, value);
  749.     }
  750.     protected void SetColor(string name, byte r, byte g, byte b)
  751.     {
  752.         SetColor(name, Color.FromArgb(r, g, b));
  753.     }
  754.     protected void SetColor(string name, byte a, byte r, byte g, byte b)
  755.     {
  756.         SetColor(name, Color.FromArgb(a, r, g, b));
  757.     }
  758.     protected void SetColor(string name, byte a, Color value)
  759.     {
  760.         SetColor(name, Color.FromArgb(a, value));
  761.     }
  762.  
  763.     private void InvalidateBitmap()
  764.     {
  765.         if (_Transparent && _ControlMode)
  766.         {
  767.             if (Width == 0 || Height == 0)
  768.                 return;
  769.             B = new Bitmap(Width, Height, PixelFormat.Format32bppPArgb);
  770.             G = Graphics.FromImage(B);
  771.         }
  772.         else
  773.         {
  774.             G = null;
  775.             B = null;
  776.         }
  777.     }
  778.  
  779.     private void InvalidateCustimization()
  780.     {
  781.         MemoryStream M = new MemoryStream(Items.Count * 4);
  782.  
  783.         foreach (Bloom B in Colors)
  784.         {
  785.             M.Write(BitConverter.GetBytes(B.Value.ToArgb()), 0, 4);
  786.         }
  787.  
  788.         M.Close();
  789.         _Customization = Convert.ToBase64String(M.ToArray());
  790.     }
  791.  
  792.     #endregion
  793.  
  794.  
  795.     #region " User Hooks "
  796.  
  797.     protected abstract void ColorHook();
  798.     protected abstract void PaintHook();
  799.  
  800.     protected virtual void OnCreation()
  801.     {
  802.     }
  803.  
  804.     #endregion
  805.  
  806.  
  807.     #region " Offset "
  808.  
  809.     private Rectangle OffsetReturnRectangle;
  810.     protected Rectangle Offset(Rectangle r, int amount)
  811.     {
  812.         OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
  813.         return OffsetReturnRectangle;
  814.     }
  815.  
  816.     private Size OffsetReturnSize;
  817.     protected Size Offset(Size s, int amount)
  818.     {
  819.         OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
  820.         return OffsetReturnSize;
  821.     }
  822.  
  823.     private Point OffsetReturnPoint;
  824.     protected Point Offset(Point p, int amount)
  825.     {
  826.         OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
  827.         return OffsetReturnPoint;
  828.     }
  829.  
  830.     #endregion
  831.  
  832.     #region " Center "
  833.  
  834.  
  835.     private Point CenterReturn;
  836.     protected Point Center(Rectangle p, Rectangle c)
  837.     {
  838.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X + c.X, (p.Height / 2 - c.Height / 2) + p.Y + c.Y);
  839.         return CenterReturn;
  840.     }
  841.     protected Point Center(Rectangle p, Size c)
  842.     {
  843.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X, (p.Height / 2 - c.Height / 2) + p.Y);
  844.         return CenterReturn;
  845.     }
  846.  
  847.     protected Point Center(Rectangle child)
  848.     {
  849.         return Center(Width, Height, child.Width, child.Height);
  850.     }
  851.     protected Point Center(Size child)
  852.     {
  853.         return Center(Width, Height, child.Width, child.Height);
  854.     }
  855.     protected Point Center(int childWidth, int childHeight)
  856.     {
  857.         return Center(Width, Height, childWidth, childHeight);
  858.     }
  859.  
  860.     protected Point Center(Size p, Size c)
  861.     {
  862.         return Center(p.Width, p.Height, c.Width, c.Height);
  863.     }
  864.  
  865.     protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
  866.     {
  867.         CenterReturn = new Point(pWidth / 2 - cWidth / 2, pHeight / 2 - cHeight / 2);
  868.         return CenterReturn;
  869.     }
  870.  
  871.     #endregion
  872.  
  873.     #region " Measure "
  874.  
  875.     private Bitmap MeasureBitmap;
  876.     //TODO: Potential issues during multi-threading.
  877.     private Graphics MeasureGraphics;
  878.  
  879.     protected Size Measure()
  880.     {
  881.         return MeasureGraphics.MeasureString(Text, Font, Width).ToSize();
  882.     }
  883.     protected Size Measure(string text)
  884.     {
  885.         return MeasureGraphics.MeasureString(text, Font, Width).ToSize();
  886.     }
  887.  
  888.     #endregion
  889.  
  890.  
  891.     #region " DrawPixel "
  892.  
  893.  
  894.     private SolidBrush DrawPixelBrush;
  895.     protected void DrawPixel(Color c1, int x, int y)
  896.     {
  897.         if (_Transparent)
  898.         {
  899.             B.SetPixel(x, y, c1);
  900.         }
  901.         else
  902.         {
  903.             DrawPixelBrush = new SolidBrush(c1);
  904.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1);
  905.         }
  906.     }
  907.  
  908.     #endregion
  909.  
  910.     #region " DrawCorners "
  911.  
  912.  
  913.     private SolidBrush DrawCornersBrush;
  914.     protected void DrawCorners(Color c1, int offset)
  915.     {
  916.         DrawCorners(c1, 0, 0, Width, Height, offset);
  917.     }
  918.     protected void DrawCorners(Color c1, Rectangle r1, int offset)
  919.     {
  920.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
  921.     }
  922.     protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
  923.     {
  924.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  925.     }
  926.  
  927.     protected void DrawCorners(Color c1)
  928.     {
  929.         DrawCorners(c1, 0, 0, Width, Height);
  930.     }
  931.     protected void DrawCorners(Color c1, Rectangle r1)
  932.     {
  933.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
  934.     }
  935.     protected void DrawCorners(Color c1, int x, int y, int width, int height)
  936.     {
  937.         if (_NoRounding)
  938.             return;
  939.  
  940.         if (_Transparent)
  941.         {
  942.             B.SetPixel(x, y, c1);
  943.             B.SetPixel(x + (width - 1), y, c1);
  944.             B.SetPixel(x, y + (height - 1), c1);
  945.             B.SetPixel(x + (width - 1), y + (height - 1), c1);
  946.         }
  947.         else
  948.         {
  949.             DrawCornersBrush = new SolidBrush(c1);
  950.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1);
  951.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1);
  952.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1);
  953.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
  954.         }
  955.     }
  956.  
  957.     #endregion
  958.  
  959.     #region " DrawBorders "
  960.  
  961.     protected void DrawBorders(Pen p1, int offset)
  962.     {
  963.         DrawBorders(p1, 0, 0, Width, Height, offset);
  964.     }
  965.     protected void DrawBorders(Pen p1, Rectangle r, int offset)
  966.     {
  967.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
  968.     }
  969.     protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
  970.     {
  971.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  972.     }
  973.  
  974.     protected void DrawBorders(Pen p1)
  975.     {
  976.         DrawBorders(p1, 0, 0, Width, Height);
  977.     }
  978.     protected void DrawBorders(Pen p1, Rectangle r)
  979.     {
  980.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
  981.     }
  982.     protected void DrawBorders(Pen p1, int x, int y, int width, int height)
  983.     {
  984.         G.DrawRectangle(p1, x, y, width - 1, height - 1);
  985.     }
  986.  
  987.     #endregion
  988.  
  989.     #region " DrawText "
  990.  
  991.     private Point DrawTextPoint;
  992.  
  993.     private Size DrawTextSize;
  994.     protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
  995.     {
  996.         DrawText(b1, Text, a, x, y);
  997.     }
  998.     protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
  999.     {
  1000.         if (text.Length == 0)
  1001.             return;
  1002.  
  1003.         DrawTextSize = Measure(text);
  1004.         DrawTextPoint = new Point(Width / 2 - DrawTextSize.Width / 2, Header / 2 - DrawTextSize.Height / 2);
  1005.  
  1006.         switch (a)
  1007.         {
  1008.             case HorizontalAlignment.Left:
  1009.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y);
  1010.                 break;
  1011.             case HorizontalAlignment.Center:
  1012.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y);
  1013.                 break;
  1014.             case HorizontalAlignment.Right:
  1015.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y);
  1016.                 break;
  1017.         }
  1018.     }
  1019.  
  1020.     protected void DrawText(Brush b1, Point p1)
  1021.     {
  1022.         if (Text.Length == 0)
  1023.             return;
  1024.         G.DrawString(Text, Font, b1, p1);
  1025.     }
  1026.     protected void DrawText(Brush b1, int x, int y)
  1027.     {
  1028.         if (Text.Length == 0)
  1029.             return;
  1030.         G.DrawString(Text, Font, b1, x, y);
  1031.     }
  1032.  
  1033.     #endregion
  1034.  
  1035.     #region " DrawImage "
  1036.  
  1037.  
  1038.     private Point DrawImagePoint;
  1039.     protected void DrawImage(HorizontalAlignment a, int x, int y)
  1040.     {
  1041.         DrawImage(_Image, a, x, y);
  1042.     }
  1043.     protected void DrawImage(Image image, HorizontalAlignment a, int x, int y)
  1044.     {
  1045.         if (image == null)
  1046.             return;
  1047.         DrawImagePoint = new Point(Width / 2 - image.Width / 2, Header / 2 - image.Height / 2);
  1048.  
  1049.         switch (a)
  1050.         {
  1051.             case HorizontalAlignment.Left:
  1052.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height);
  1053.                 break;
  1054.             case HorizontalAlignment.Center:
  1055.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height);
  1056.                 break;
  1057.             case HorizontalAlignment.Right:
  1058.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height);
  1059.                 break;
  1060.         }
  1061.     }
  1062.  
  1063.     protected void DrawImage(Point p1)
  1064.     {
  1065.         DrawImage(_Image, p1.X, p1.Y);
  1066.     }
  1067.     protected void DrawImage(int x, int y)
  1068.     {
  1069.         DrawImage(_Image, x, y);
  1070.     }
  1071.  
  1072.     protected void DrawImage(Image image, Point p1)
  1073.     {
  1074.         DrawImage(image, p1.X, p1.Y);
  1075.     }
  1076.     protected void DrawImage(Image image, int x, int y)
  1077.     {
  1078.         if (image == null)
  1079.             return;
  1080.         G.DrawImage(image, x, y, image.Width, image.Height);
  1081.     }
  1082.  
  1083.     #endregion
  1084.  
  1085.     #region " DrawGradient "
  1086.  
  1087.     private LinearGradientBrush DrawGradientBrush;
  1088.  
  1089.     private Rectangle DrawGradientRectangle;
  1090.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
  1091.     {
  1092.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1093.         DrawGradient(blend, DrawGradientRectangle);
  1094.     }
  1095.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
  1096.     {
  1097.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1098.         DrawGradient(blend, DrawGradientRectangle, angle);
  1099.     }
  1100.  
  1101.     protected void DrawGradient(ColorBlend blend, Rectangle r)
  1102.     {
  1103.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
  1104.         DrawGradientBrush.InterpolationColors = blend;
  1105.         G.FillRectangle(DrawGradientBrush, r);
  1106.     }
  1107.     protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
  1108.     {
  1109.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
  1110.         DrawGradientBrush.InterpolationColors = blend;
  1111.         G.FillRectangle(DrawGradientBrush, r);
  1112.     }
  1113.  
  1114.  
  1115.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
  1116.     {
  1117.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1118.         DrawGradient(c1, c2, DrawGradientRectangle);
  1119.     }
  1120.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
  1121.     {
  1122.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1123.         DrawGradient(c1, c2, DrawGradientRectangle, angle);
  1124.     }
  1125.  
  1126.     protected void DrawGradient(Color c1, Color c2, Rectangle r)
  1127.     {
  1128.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
  1129.         G.FillRectangle(DrawGradientBrush, r);
  1130.     }
  1131.     protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
  1132.     {
  1133.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
  1134.         G.FillRectangle(DrawGradientBrush, r);
  1135.     }
  1136.  
  1137.     #endregion
  1138.  
  1139.     #region " DrawRadial "
  1140.  
  1141.     private GraphicsPath DrawRadialPath;
  1142.     private PathGradientBrush DrawRadialBrush1;
  1143.     private LinearGradientBrush DrawRadialBrush2;
  1144.  
  1145.     private Rectangle DrawRadialRectangle;
  1146.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
  1147.     {
  1148.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1149.         DrawRadial(blend, DrawRadialRectangle, width / 2, height / 2);
  1150.     }
  1151.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
  1152.     {
  1153.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1154.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y);
  1155.     }
  1156.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
  1157.     {
  1158.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1159.         DrawRadial(blend, DrawRadialRectangle, cx, cy);
  1160.     }
  1161.  
  1162.     public void DrawRadial(ColorBlend blend, Rectangle r)
  1163.     {
  1164.         DrawRadial(blend, r, r.Width / 2, r.Height / 2);
  1165.     }
  1166.     public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
  1167.     {
  1168.         DrawRadial(blend, r, center.X, center.Y);
  1169.     }
  1170.     public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
  1171.     {
  1172.         DrawRadialPath.Reset();
  1173.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
  1174.  
  1175.         DrawRadialBrush1 = new PathGradientBrush(DrawRadialPath);
  1176.         DrawRadialBrush1.CenterPoint = new Point(r.X + cx, r.Y + cy);
  1177.         DrawRadialBrush1.InterpolationColors = blend;
  1178.  
  1179.         if (G.SmoothingMode == SmoothingMode.AntiAlias)
  1180.         {
  1181.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3);
  1182.         }
  1183.         else
  1184.         {
  1185.             G.FillEllipse(DrawRadialBrush1, r);
  1186.         }
  1187.     }
  1188.  
  1189.  
  1190.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
  1191.     {
  1192.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1193.         DrawRadial(c1, c2, DrawGradientRectangle);
  1194.     }
  1195.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
  1196.     {
  1197.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1198.         DrawRadial(c1, c2, DrawGradientRectangle, angle);
  1199.     }
  1200.  
  1201.     protected void DrawRadial(Color c1, Color c2, Rectangle r)
  1202.     {
  1203.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
  1204.         G.FillRectangle(DrawGradientBrush, r);
  1205.     }
  1206.     protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
  1207.     {
  1208.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
  1209.         G.FillEllipse(DrawGradientBrush, r);
  1210.     }
  1211.  
  1212.     #endregion
  1213.  
  1214. }
  1215.  
  1216. abstract class ThemeControl153 : Control
  1217. {
  1218.  
  1219.  
  1220.     #region " Initialization "
  1221.  
  1222.     protected Graphics G;
  1223.  
  1224.     protected Bitmap B;
  1225.     public ThemeControl153()
  1226.     {
  1227.         SetStyle((ControlStyles)139270, true);
  1228.  
  1229.         _ImageSize = Size.Empty;
  1230.         Font = new Font("Verdana", 8);
  1231.  
  1232.         MeasureBitmap = new Bitmap(1, 1);
  1233.         MeasureGraphics = Graphics.FromImage(MeasureBitmap);
  1234.  
  1235.         DrawRadialPath = new GraphicsPath();
  1236.  
  1237.         InvalidateCustimization();
  1238.         //Remove?
  1239.     }
  1240.  
  1241.     protected override sealed void OnHandleCreated(EventArgs e)
  1242.     {
  1243.         InvalidateCustimization();
  1244.         ColorHook();
  1245.  
  1246.         if (!(_LockWidth == 0))
  1247.             Width = _LockWidth;
  1248.         if (!(_LockHeight == 0))
  1249.             Height = _LockHeight;
  1250.  
  1251.         Transparent = _Transparent;
  1252.         if (_Transparent && _BackColor)
  1253.             BackColor = Color.Transparent;
  1254.  
  1255.         base.OnHandleCreated(e);
  1256.     }
  1257.  
  1258.     protected override sealed void OnParentChanged(EventArgs e)
  1259.     {
  1260.         if (Parent != null)
  1261.             OnCreation();
  1262.         base.OnParentChanged(e);
  1263.     }
  1264.  
  1265.     #endregion
  1266.  
  1267.  
  1268.     protected override sealed void OnPaint(PaintEventArgs e)
  1269.     {
  1270.         if (Width == 0 || Height == 0)
  1271.             return;
  1272.  
  1273.         if (_Transparent)
  1274.         {
  1275.             PaintHook();
  1276.             e.Graphics.DrawImage(B, 0, 0);
  1277.         }
  1278.         else
  1279.         {
  1280.             G = e.Graphics;
  1281.             PaintHook();
  1282.         }
  1283.     }
  1284.  
  1285.  
  1286.     #region " Size Handling "
  1287.  
  1288.     protected override sealed void OnSizeChanged(EventArgs e)
  1289.     {
  1290.         if (_Transparent)
  1291.         {
  1292.             InvalidateBitmap();
  1293.         }
  1294.  
  1295.         Invalidate();
  1296.         base.OnSizeChanged(e);
  1297.     }
  1298.  
  1299.     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  1300.     {
  1301.         if (!(_LockWidth == 0))
  1302.             width = _LockWidth;
  1303.         if (!(_LockHeight == 0))
  1304.             height = _LockHeight;
  1305.         base.SetBoundsCore(x, y, width, height, specified);
  1306.     }
  1307.  
  1308.     #endregion
  1309.  
  1310.     #region " State Handling "
  1311.  
  1312.     private bool InPosition;
  1313.     protected override void OnMouseEnter(EventArgs e)
  1314.     {
  1315.         InPosition = true;
  1316.         SetState(MouseState.Over);
  1317.         base.OnMouseEnter(e);
  1318.     }
  1319.  
  1320.     protected override void OnMouseUp(MouseEventArgs e)
  1321.     {
  1322.         if (InPosition)
  1323.             SetState(MouseState.Over);
  1324.         base.OnMouseUp(e);
  1325.     }
  1326.  
  1327.     protected override void OnMouseDown(MouseEventArgs e)
  1328.     {
  1329.         if (e.Button == System.Windows.Forms.MouseButtons.Left)
  1330.             SetState(MouseState.Down);
  1331.         base.OnMouseDown(e);
  1332.     }
  1333.  
  1334.     protected override void OnMouseLeave(EventArgs e)
  1335.     {
  1336.         InPosition = false;
  1337.         SetState(MouseState.None);
  1338.         base.OnMouseLeave(e);
  1339.     }
  1340.  
  1341.     protected override void OnEnabledChanged(EventArgs e)
  1342.     {
  1343.         if (Enabled)
  1344.             SetState(MouseState.None);
  1345.         else
  1346.             SetState(MouseState.Block);
  1347.         base.OnEnabledChanged(e);
  1348.     }
  1349.  
  1350.     protected MouseState State;
  1351.     private void SetState(MouseState current)
  1352.     {
  1353.         State = current;
  1354.         Invalidate();
  1355.     }
  1356.  
  1357.     #endregion
  1358.  
  1359.  
  1360.     #region " Base Properties "
  1361.  
  1362.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1363.     public override Color ForeColor
  1364.     {
  1365.         get { return Color.Empty; }
  1366.         set { }
  1367.     }
  1368.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1369.     public override Image BackgroundImage
  1370.     {
  1371.         get { return null; }
  1372.         set { }
  1373.     }
  1374.     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  1375.     public override ImageLayout BackgroundImageLayout
  1376.     {
  1377.         get { return ImageLayout.None; }
  1378.         set { }
  1379.     }
  1380.  
  1381.     public override string Text
  1382.     {
  1383.         get { return base.Text; }
  1384.         set
  1385.         {
  1386.             base.Text = value;
  1387.             Invalidate();
  1388.         }
  1389.     }
  1390.     public override Font Font
  1391.     {
  1392.         get { return base.Font; }
  1393.         set
  1394.         {
  1395.             base.Font = value;
  1396.             Invalidate();
  1397.         }
  1398.     }
  1399.  
  1400.     private bool _BackColor;
  1401.     [Category("Misc")]
  1402.     public override Color BackColor
  1403.     {
  1404.         get { return base.BackColor; }
  1405.         set
  1406.         {
  1407.             if (!IsHandleCreated && value == Color.Transparent)
  1408.             {
  1409.                 _BackColor = true;
  1410.                 return;
  1411.             }
  1412.  
  1413.             base.BackColor = value;
  1414.             if (Parent != null)
  1415.                 ColorHook();
  1416.         }
  1417.     }
  1418.  
  1419.     #endregion
  1420.  
  1421.     #region " Public Properties "
  1422.  
  1423.     private bool _NoRounding;
  1424.     public bool NoRounding
  1425.     {
  1426.         get { return _NoRounding; }
  1427.         set
  1428.         {
  1429.             _NoRounding = value;
  1430.             Invalidate();
  1431.         }
  1432.     }
  1433.  
  1434.     private Image _Image;
  1435.     public Image Image
  1436.     {
  1437.         get { return _Image; }
  1438.         set
  1439.         {
  1440.             if (value == null)
  1441.             {
  1442.                 _ImageSize = Size.Empty;
  1443.             }
  1444.             else
  1445.             {
  1446.                 _ImageSize = value.Size;
  1447.             }
  1448.  
  1449.             _Image = value;
  1450.             Invalidate();
  1451.         }
  1452.     }
  1453.  
  1454.     private bool _Transparent;
  1455.     public bool Transparent
  1456.     {
  1457.         get { return _Transparent; }
  1458.         set
  1459.         {
  1460.             _Transparent = value;
  1461.             if (!IsHandleCreated)
  1462.                 return;
  1463.  
  1464.             if (!value && !(BackColor.A == 255))
  1465.             {
  1466.                 throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
  1467.             }
  1468.  
  1469.             SetStyle(ControlStyles.Opaque, !value);
  1470.             SetStyle(ControlStyles.SupportsTransparentBackColor, value);
  1471.  
  1472.             if (value)
  1473.                 InvalidateBitmap();
  1474.             else
  1475.                 B = null;
  1476.             Invalidate();
  1477.         }
  1478.     }
  1479.  
  1480.     private Dictionary<string, Color> Items = new Dictionary<string, Color>();
  1481.     public Bloom[] Colors
  1482.     {
  1483.         get
  1484.         {
  1485.             List<Bloom> T = new List<Bloom>();
  1486.             Dictionary<string, Color>.Enumerator E = Items.GetEnumerator();
  1487.  
  1488.             while (E.MoveNext())
  1489.             {
  1490.                 T.Add(new Bloom(E.Current.Key, E.Current.Value));
  1491.             }
  1492.  
  1493.             return T.ToArray();
  1494.         }
  1495.         set
  1496.         {
  1497.             foreach (Bloom B in value)
  1498.             {
  1499.                 if (Items.ContainsKey(B.Name))
  1500.                     Items[B.Name] = B.Value;
  1501.             }
  1502.  
  1503.             InvalidateCustimization();
  1504.             ColorHook();
  1505.             Invalidate();
  1506.         }
  1507.     }
  1508.  
  1509.     private string _Customization;
  1510.     public string Customization
  1511.     {
  1512.         get { return _Customization; }
  1513.         set
  1514.         {
  1515.             if (value == _Customization)
  1516.                 return;
  1517.  
  1518.             byte[] Data = null;
  1519.             Bloom[] Items = Colors;
  1520.  
  1521.             try
  1522.             {
  1523.                 Data = Convert.FromBase64String(value);
  1524.                 for (int I = 0; I <= Items.Length - 1; I++)
  1525.                 {
  1526.                     Items[I].Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4));
  1527.                 }
  1528.             }
  1529.             catch
  1530.             {
  1531.                 return;
  1532.             }
  1533.  
  1534.             _Customization = value;
  1535.  
  1536.             Colors = Items;
  1537.             ColorHook();
  1538.             Invalidate();
  1539.         }
  1540.     }
  1541.  
  1542.     #endregion
  1543.  
  1544.     #region " Private Properties "
  1545.  
  1546.     private Size _ImageSize;
  1547.     protected Size ImageSize
  1548.     {
  1549.         get { return _ImageSize; }
  1550.     }
  1551.  
  1552.     private int _LockWidth;
  1553.     protected int LockWidth
  1554.     {
  1555.         get { return _LockWidth; }
  1556.         set
  1557.         {
  1558.             _LockWidth = value;
  1559.             if (!(LockWidth == 0) && IsHandleCreated)
  1560.                 Width = LockWidth;
  1561.         }
  1562.     }
  1563.  
  1564.     private int _LockHeight;
  1565.     protected int LockHeight
  1566.     {
  1567.         get { return _LockHeight; }
  1568.         set
  1569.         {
  1570.             _LockHeight = value;
  1571.             if (!(LockHeight == 0) && IsHandleCreated)
  1572.                 Height = LockHeight;
  1573.         }
  1574.     }
  1575.  
  1576.     #endregion
  1577.  
  1578.  
  1579.     #region " Property Helpers "
  1580.  
  1581.     protected Pen GetPen(string name)
  1582.     {
  1583.         return new Pen(Items[name]);
  1584.     }
  1585.     protected Pen GetPen(string name, float width)
  1586.     {
  1587.         return new Pen(Items[name], width);
  1588.     }
  1589.  
  1590.     protected SolidBrush GetBrush(string name)
  1591.     {
  1592.         return new SolidBrush(Items[name]);
  1593.     }
  1594.  
  1595.     protected Color GetColor(string name)
  1596.     {
  1597.         return Items[name];
  1598.     }
  1599.  
  1600.     protected void SetColor(string name, Color value)
  1601.     {
  1602.         if (Items.ContainsKey(name))
  1603.             Items[name] = value;
  1604.         else
  1605.             Items.Add(name, value);
  1606.     }
  1607.     protected void SetColor(string name, byte r, byte g, byte b)
  1608.     {
  1609.         SetColor(name, Color.FromArgb(r, g, b));
  1610.     }
  1611.     protected void SetColor(string name, byte a, byte r, byte g, byte b)
  1612.     {
  1613.         SetColor(name, Color.FromArgb(a, r, g, b));
  1614.     }
  1615.     protected void SetColor(string name, byte a, Color value)
  1616.     {
  1617.         SetColor(name, Color.FromArgb(a, value));
  1618.     }
  1619.  
  1620.     private void InvalidateBitmap()
  1621.     {
  1622.         if (Width == 0 || Height == 0)
  1623.             return;
  1624.         B = new Bitmap(Width, Height, PixelFormat.Format32bppPArgb);
  1625.         G = Graphics.FromImage(B);
  1626.     }
  1627.  
  1628.     private void InvalidateCustimization()
  1629.     {
  1630.         MemoryStream M = new MemoryStream(Items.Count * 4);
  1631.  
  1632.         foreach (Bloom B in Colors)
  1633.         {
  1634.             M.Write(BitConverter.GetBytes(B.Value.ToArgb()), 0, 4);
  1635.         }
  1636.  
  1637.         M.Close();
  1638.         _Customization = Convert.ToBase64String(M.ToArray());
  1639.     }
  1640.  
  1641.     #endregion
  1642.  
  1643.  
  1644.     #region " User Hooks "
  1645.  
  1646.     protected abstract void ColorHook();
  1647.     protected abstract void PaintHook();
  1648.  
  1649.     protected virtual void OnCreation()
  1650.     {
  1651.     }
  1652.  
  1653.     #endregion
  1654.  
  1655.  
  1656.     #region " Offset "
  1657.  
  1658.     private Rectangle OffsetReturnRectangle;
  1659.     protected Rectangle Offset(Rectangle r, int amount)
  1660.     {
  1661.         OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
  1662.         return OffsetReturnRectangle;
  1663.     }
  1664.  
  1665.     private Size OffsetReturnSize;
  1666.     protected Size Offset(Size s, int amount)
  1667.     {
  1668.         OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
  1669.         return OffsetReturnSize;
  1670.     }
  1671.  
  1672.     private Point OffsetReturnPoint;
  1673.     protected Point Offset(Point p, int amount)
  1674.     {
  1675.         OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
  1676.         return OffsetReturnPoint;
  1677.     }
  1678.  
  1679.     #endregion
  1680.  
  1681.     #region " Center "
  1682.  
  1683.  
  1684.     private Point CenterReturn;
  1685.     protected Point Center(Rectangle p, Rectangle c)
  1686.     {
  1687.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X + c.X, (p.Height / 2 - c.Height / 2) + p.Y + c.Y);
  1688.         return CenterReturn;
  1689.     }
  1690.     protected Point Center(Rectangle p, Size c)
  1691.     {
  1692.         CenterReturn = new Point((p.Width / 2 - c.Width / 2) + p.X, (p.Height / 2 - c.Height / 2) + p.Y);
  1693.         return CenterReturn;
  1694.     }
  1695.  
  1696.     protected Point Center(Rectangle child)
  1697.     {
  1698.         return Center(Width, Height, child.Width, child.Height);
  1699.     }
  1700.     protected Point Center(Size child)
  1701.     {
  1702.         return Center(Width, Height, child.Width, child.Height);
  1703.     }
  1704.     protected Point Center(int childWidth, int childHeight)
  1705.     {
  1706.         return Center(Width, Height, childWidth, childHeight);
  1707.     }
  1708.  
  1709.     protected Point Center(Size p, Size c)
  1710.     {
  1711.         return Center(p.Width, p.Height, c.Width, c.Height);
  1712.     }
  1713.  
  1714.     protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
  1715.     {
  1716.         CenterReturn = new Point(pWidth / 2 - cWidth / 2, pHeight / 2 - cHeight / 2);
  1717.         return CenterReturn;
  1718.     }
  1719.  
  1720.     #endregion
  1721.  
  1722.     #region " Measure "
  1723.  
  1724.     private Bitmap MeasureBitmap;
  1725.     //TODO: Potential issues during multi-threading.
  1726.     private Graphics MeasureGraphics;
  1727.  
  1728.     protected Size Measure()
  1729.     {
  1730.         return MeasureGraphics.MeasureString(Text, Font, Width).ToSize();
  1731.     }
  1732.     protected Size Measure(string text)
  1733.     {
  1734.         return MeasureGraphics.MeasureString(text, Font, Width).ToSize();
  1735.     }
  1736.  
  1737.     #endregion
  1738.  
  1739.  
  1740.     #region " DrawPixel "
  1741.  
  1742.  
  1743.     private SolidBrush DrawPixelBrush;
  1744.     protected void DrawPixel(Color c1, int x, int y)
  1745.     {
  1746.         if (_Transparent)
  1747.         {
  1748.             B.SetPixel(x, y, c1);
  1749.         }
  1750.         else
  1751.         {
  1752.             DrawPixelBrush = new SolidBrush(c1);
  1753.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1);
  1754.         }
  1755.     }
  1756.  
  1757.     #endregion
  1758.  
  1759.     #region " DrawCorners "
  1760.  
  1761.  
  1762.     private SolidBrush DrawCornersBrush;
  1763.     protected void DrawCorners(Color c1, int offset)
  1764.     {
  1765.         DrawCorners(c1, 0, 0, Width, Height, offset);
  1766.     }
  1767.     protected void DrawCorners(Color c1, Rectangle r1, int offset)
  1768.     {
  1769.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
  1770.     }
  1771.     protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
  1772.     {
  1773.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1774.     }
  1775.  
  1776.     protected void DrawCorners(Color c1)
  1777.     {
  1778.         DrawCorners(c1, 0, 0, Width, Height);
  1779.     }
  1780.     protected void DrawCorners(Color c1, Rectangle r1)
  1781.     {
  1782.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
  1783.     }
  1784.     protected void DrawCorners(Color c1, int x, int y, int width, int height)
  1785.     {
  1786.         if (_NoRounding)
  1787.             return;
  1788.  
  1789.         if (_Transparent)
  1790.         {
  1791.             B.SetPixel(x, y, c1);
  1792.             B.SetPixel(x + (width - 1), y, c1);
  1793.             B.SetPixel(x, y + (height - 1), c1);
  1794.             B.SetPixel(x + (width - 1), y + (height - 1), c1);
  1795.         }
  1796.         else
  1797.         {
  1798.             DrawCornersBrush = new SolidBrush(c1);
  1799.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1);
  1800.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1);
  1801.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1);
  1802.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
  1803.         }
  1804.     }
  1805.  
  1806.     #endregion
  1807.  
  1808.     #region " DrawBorders "
  1809.  
  1810.     protected void DrawBorders(Pen p1, int offset)
  1811.     {
  1812.         DrawBorders(p1, 0, 0, Width, Height, offset);
  1813.     }
  1814.     protected void DrawBorders(Pen p1, Rectangle r, int offset)
  1815.     {
  1816.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
  1817.     }
  1818.     protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
  1819.     {
  1820.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
  1821.     }
  1822.  
  1823.     protected void DrawBorders(Pen p1)
  1824.     {
  1825.         DrawBorders(p1, 0, 0, Width, Height);
  1826.     }
  1827.     protected void DrawBorders(Pen p1, Rectangle r)
  1828.     {
  1829.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
  1830.     }
  1831.     protected void DrawBorders(Pen p1, int x, int y, int width, int height)
  1832.     {
  1833.         G.DrawRectangle(p1, x, y, width - 1, height - 1);
  1834.     }
  1835.  
  1836.     #endregion
  1837.  
  1838.     #region " DrawText "
  1839.  
  1840.     private Point DrawTextPoint;
  1841.  
  1842.     private Size DrawTextSize;
  1843.     protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
  1844.     {
  1845.         DrawText(b1, Text, a, x, y);
  1846.     }
  1847.     protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
  1848.     {
  1849.         if (text.Length == 0)
  1850.             return;
  1851.  
  1852.         DrawTextSize = Measure(text);
  1853.         DrawTextPoint = Center(DrawTextSize);
  1854.  
  1855.         switch (a)
  1856.         {
  1857.             case HorizontalAlignment.Left:
  1858.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y);
  1859.                 break;
  1860.             case HorizontalAlignment.Center:
  1861.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y);
  1862.                 break;
  1863.             case HorizontalAlignment.Right:
  1864.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y);
  1865.                 break;
  1866.         }
  1867.     }
  1868.  
  1869.     protected void DrawText(Brush b1, Point p1)
  1870.     {
  1871.         if (Text.Length == 0)
  1872.             return;
  1873.         G.DrawString(Text, Font, b1, p1);
  1874.     }
  1875.     protected void DrawText(Brush b1, int x, int y)
  1876.     {
  1877.         if (Text.Length == 0)
  1878.             return;
  1879.         G.DrawString(Text, Font, b1, x, y);
  1880.     }
  1881.  
  1882.     #endregion
  1883.  
  1884.     #region " DrawImage "
  1885.  
  1886.  
  1887.     private Point DrawImagePoint;
  1888.     protected void DrawImage(HorizontalAlignment a, int x, int y)
  1889.     {
  1890.         DrawImage(_Image, a, x, y);
  1891.     }
  1892.     protected void DrawImage(Image image, HorizontalAlignment a, int x, int y)
  1893.     {
  1894.         if (image == null)
  1895.             return;
  1896.         DrawImagePoint = Center(image.Size);
  1897.  
  1898.         switch (a)
  1899.         {
  1900.             case HorizontalAlignment.Left:
  1901.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height);
  1902.                 break;
  1903.             case HorizontalAlignment.Center:
  1904.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height);
  1905.                 break;
  1906.             case HorizontalAlignment.Right:
  1907.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height);
  1908.                 break;
  1909.         }
  1910.     }
  1911.  
  1912.     protected void DrawImage(Point p1)
  1913.     {
  1914.         DrawImage(_Image, p1.X, p1.Y);
  1915.     }
  1916.     protected void DrawImage(int x, int y)
  1917.     {
  1918.         DrawImage(_Image, x, y);
  1919.     }
  1920.  
  1921.     protected void DrawImage(Image image, Point p1)
  1922.     {
  1923.         DrawImage(image, p1.X, p1.Y);
  1924.     }
  1925.     protected void DrawImage(Image image, int x, int y)
  1926.     {
  1927.         if (image == null)
  1928.             return;
  1929.         G.DrawImage(image, x, y, image.Width, image.Height);
  1930.     }
  1931.  
  1932.     #endregion
  1933.  
  1934.     #region " DrawGradient "
  1935.  
  1936.     private LinearGradientBrush DrawGradientBrush;
  1937.  
  1938.     private Rectangle DrawGradientRectangle;
  1939.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
  1940.     {
  1941.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1942.         DrawGradient(blend, DrawGradientRectangle);
  1943.     }
  1944.     protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
  1945.     {
  1946.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1947.         DrawGradient(blend, DrawGradientRectangle, angle);
  1948.     }
  1949.  
  1950.     protected void DrawGradient(ColorBlend blend, Rectangle r)
  1951.     {
  1952.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
  1953.         DrawGradientBrush.InterpolationColors = blend;
  1954.         G.FillRectangle(DrawGradientBrush, r);
  1955.     }
  1956.     protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
  1957.     {
  1958.         DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
  1959.         DrawGradientBrush.InterpolationColors = blend;
  1960.         G.FillRectangle(DrawGradientBrush, r);
  1961.     }
  1962.  
  1963.  
  1964.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
  1965.     {
  1966.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1967.         DrawGradient(c1, c2, DrawGradientRectangle);
  1968.     }
  1969.     protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
  1970.     {
  1971.         DrawGradientRectangle = new Rectangle(x, y, width, height);
  1972.         DrawGradient(c1, c2, DrawGradientRectangle, angle);
  1973.     }
  1974.  
  1975.     protected void DrawGradient(Color c1, Color c2, Rectangle r)
  1976.     {
  1977.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
  1978.         G.FillRectangle(DrawGradientBrush, r);
  1979.     }
  1980.     protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
  1981.     {
  1982.         DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
  1983.         G.FillRectangle(DrawGradientBrush, r);
  1984.     }
  1985.  
  1986.     #endregion
  1987.  
  1988.     #region " DrawRadial "
  1989.  
  1990.     private GraphicsPath DrawRadialPath;
  1991.     private PathGradientBrush DrawRadialBrush1;
  1992.     private LinearGradientBrush DrawRadialBrush2;
  1993.  
  1994.     private Rectangle DrawRadialRectangle;
  1995.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
  1996.     {
  1997.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  1998.         DrawRadial(blend, DrawRadialRectangle, width / 2, height / 2);
  1999.     }
  2000.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
  2001.     {
  2002.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2003.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y);
  2004.     }
  2005.     public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
  2006.     {
  2007.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2008.         DrawRadial(blend, DrawRadialRectangle, cx, cy);
  2009.     }
  2010.  
  2011.     public void DrawRadial(ColorBlend blend, Rectangle r)
  2012.     {
  2013.         DrawRadial(blend, r, r.Width / 2, r.Height / 2);
  2014.     }
  2015.     public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
  2016.     {
  2017.         DrawRadial(blend, r, center.X, center.Y);
  2018.     }
  2019.     public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
  2020.     {
  2021.         DrawRadialPath.Reset();
  2022.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
  2023.  
  2024.         DrawRadialBrush1 = new PathGradientBrush(DrawRadialPath);
  2025.         DrawRadialBrush1.CenterPoint = new Point(r.X + cx, r.Y + cy);
  2026.         DrawRadialBrush1.InterpolationColors = blend;
  2027.  
  2028.         if (G.SmoothingMode == SmoothingMode.AntiAlias)
  2029.         {
  2030.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3);
  2031.         }
  2032.         else
  2033.         {
  2034.             G.FillEllipse(DrawRadialBrush1, r);
  2035.         }
  2036.     }
  2037.  
  2038.  
  2039.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
  2040.     {
  2041.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2042.         DrawRadial(c1, c2, DrawRadialRectangle);
  2043.     }
  2044.     protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
  2045.     {
  2046.         DrawRadialRectangle = new Rectangle(x, y, width, height);
  2047.         DrawRadial(c1, c2, DrawRadialRectangle, angle);
  2048.     }
  2049.  
  2050.     protected void DrawRadial(Color c1, Color c2, Rectangle r)
  2051.     {
  2052.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
  2053.         G.FillEllipse(DrawRadialBrush2, r);
  2054.     }
  2055.     protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
  2056.     {
  2057.         DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
  2058.         G.FillEllipse(DrawRadialBrush2, r);
  2059.     }
  2060.  
  2061.     #endregion
  2062.  
  2063. }
  2064.  
  2065. enum MouseState : byte
  2066. {
  2067.     None = 0,
  2068.     Over = 1,
  2069.     Down = 2,
  2070.     Block = 3
  2071. }
  2072.  
  2073. struct Bloom
  2074. {
  2075.  
  2076.     public string _Name;
  2077.     public string Name
  2078.     {
  2079.         get { return _Name; }
  2080.     }
  2081.  
  2082.     private Color _Value;
  2083.     public Color Value
  2084.     {
  2085.         get { return _Value; }
  2086.         set { _Value = value; }
  2087.     }
  2088.  
  2089.     public Bloom(string name, Color value)
  2090.     {
  2091.         _Name = name;
  2092.         _Value = value;
  2093.     }
  2094. }
  2095.  
  2096. class DroneTheme : ThemeContainer153
  2097. {
  2098.  
  2099.     public DroneTheme()
  2100.     {
  2101.         Header = 24;
  2102.         TransparencyKey = Color.Fuchsia;
  2103.  
  2104.     }
  2105.  
  2106.  
  2107.     protected override void ColorHook()
  2108.     {
  2109.     }
  2110.  
  2111.     protected override void PaintHook()
  2112.     {
  2113.         G.Clear(Color.FromArgb(24, 24, 24));
  2114.  
  2115.         DrawGradient(Color.FromArgb(0, 55, 90), Color.FromArgb(0, 70, 128), 11, 8, Width - 22, 17);
  2116.         G.FillRectangle(new SolidBrush(Color.FromArgb(0, 55, 90)), 11, 3, Width - 22, 5);
  2117.  
  2118.         Pen P = new Pen(Color.FromArgb(13, Color.White));
  2119.         G.DrawLine(P, 10, 1, 10, Height);
  2120.         G.DrawLine(P, Width - 11, 1, Width - 11, Height);
  2121.         G.DrawLine(P, 11, Height - 11, Width - 12, Height - 11);
  2122.         G.DrawLine(P, 11, 29, Width - 12, 29);
  2123.         G.DrawLine(P, 11, 25, Width - 12, 25);
  2124.  
  2125.         G.FillRectangle(new SolidBrush(Color.FromArgb(13, Color.White)), 0, 2, Width, 6);
  2126.         G.FillRectangle(new SolidBrush(Color.FromArgb(13, Color.White)), 0, Height - 6, Width, 4);
  2127.  
  2128.         G.FillRectangle(new SolidBrush(Color.FromArgb(24, 24, 24)), 11, Height - 6, Width - 22, 4);
  2129.  
  2130.         HatchBrush T = new HatchBrush(HatchStyle.Trellis, Color.FromArgb(24, 24, 24), Color.FromArgb(8, 8, 8));
  2131.         G.FillRectangle(T, 11, 30, Width - 22, Height - 41);
  2132.  
  2133.         DrawText(Brushes.White, HorizontalAlignment.Left, 15, 2);
  2134.  
  2135.         DrawBorders(new Pen(Color.FromArgb(58, 58, 58)), 1);
  2136.         DrawBorders(Pens.Black);
  2137.  
  2138.         P = new Pen(Color.FromArgb(25, Color.White));
  2139.         G.DrawLine(P, 11, 3, Width - 12, 3);
  2140.         G.DrawLine(P, 12, 2, 12, 7);
  2141.         G.DrawLine(P, Width - 13, 2, Width - 13, 7);
  2142.  
  2143.         G.DrawLine(Pens.Black, 11, 0, 11, Height);
  2144.         G.DrawLine(Pens.Black, Width - 12, 0, Width - 12, Height);
  2145.  
  2146.         G.DrawRectangle(Pens.Black, 11, 2, Width - 23, 22);
  2147.         G.DrawLine(Pens.Black, 11, Height - 12, Width - 12, Height - 12);
  2148.         G.DrawLine(Pens.Black, 11, 30, Width - 12, 30);
  2149.  
  2150.         DrawCorners(Color.Fuchsia);
  2151.     }
  2152.  
  2153. }
  2154.  
  2155. class DroneButton : ThemeControl153
  2156. {
  2157.  
  2158.  
  2159.     protected override void ColorHook()
  2160.     {
  2161.     }
  2162.  
  2163.     protected override void PaintHook()
  2164.     {
  2165.         DrawBorders(new Pen(Color.FromArgb(32, 32, 32)), 1);
  2166.         G.FillRectangle(new SolidBrush(Color.FromArgb(62, 62, 62)), 0, 0, Width, 8);
  2167.         DrawBorders(Pens.Black, 2);
  2168.         DrawBorders(Pens.Black);
  2169.  
  2170.         if (State == MouseState.Over)
  2171.         {
  2172.             G.FillRectangle(new SolidBrush(Color.FromArgb(0, 55, 90)), 3, 3, Width - 6, Height - 6);
  2173.             DrawBorders(new Pen(Color.FromArgb(0, 66, 108)), 3);
  2174.         }
  2175.         else if (State == MouseState.Down)
  2176.         {
  2177.             G.FillRectangle(new SolidBrush(Color.FromArgb(0, 44, 72)), 3, 3, Width - 6, Height - 6);
  2178.             DrawBorders(new Pen(Color.FromArgb(0, 55, 90)), 3);
  2179.         }
  2180.         else
  2181.         {
  2182.             G.FillRectangle(new SolidBrush(Color.FromArgb(24, 24, 24)), 3, 3, Width - 6, Height - 6);
  2183.             DrawBorders(new Pen(Color.FromArgb(38, 38, 38)), 3);
  2184.         }
  2185.  
  2186.         G.FillRectangle(new SolidBrush(Color.FromArgb(13, Color.White)), 3, 3, Width - 6, 8);
  2187.  
  2188.         if (State == MouseState.Down)
  2189.         {
  2190.             DrawText(Brushes.White, HorizontalAlignment.Center, 1, 1);
  2191.         }
  2192.         else
  2193.         {
  2194.             DrawText(Brushes.White, HorizontalAlignment.Center, 0, 0);
  2195.         }
  2196.  
  2197.     }
  2198.  
  2199. }
  2200.  
  2201. class DroneGroupBox : ThemeContainer153
  2202. {
  2203.  
  2204.     public DroneGroupBox()
  2205.     {
  2206.         ControlMode = true;
  2207.         Header = 26;
  2208.     }
  2209.  
  2210.  
  2211.     protected override void ColorHook()
  2212.     {
  2213.     }
  2214.  
  2215.     protected override void PaintHook()
  2216.     {
  2217.         G.Clear(Color.FromArgb(24, 24, 24));
  2218.  
  2219.         DrawGradient(Color.FromArgb(0, 55, 90), Color.FromArgb(0, 70, 128), 5, 5, Width - 10, 26);
  2220.         G.DrawLine(new Pen(Color.FromArgb(20, Color.White)), 7, 7, Width - 8, 7);
  2221.  
  2222.         DrawBorders(Pens.Black, 5, 5, Width - 10, 26, 1);
  2223.         DrawBorders(new Pen(Color.FromArgb(36, 36, 36)), 5, 5, Width - 10, 26);
  2224.  
  2225.         //???
  2226.         DrawBorders(new Pen(Color.FromArgb(8, 8, 8)), 5, 34, Width - 10, Height - 39, 1);
  2227.         DrawBorders(new Pen(Color.FromArgb(36, 36, 36)), 5, 34, Width - 10, Height - 39);
  2228.  
  2229.         DrawBorders(new Pen(Color.FromArgb(36, 36, 36)), 1);
  2230.         DrawBorders(Pens.Black);
  2231.  
  2232.         G.DrawLine(new Pen(Color.FromArgb(48, 48, 48)), 1, 1, Width - 2, 1);
  2233.  
  2234.         DrawText(Brushes.White, HorizontalAlignment.Left, 9, 5);
  2235.     }
  2236. }
  2237.  
  2238. class DroneBackground : ThemeContainer153
  2239. {
  2240.  
  2241.     public DroneBackground()
  2242.     {
  2243.         TransparencyKey = Color.Fuchsia;
  2244.     }
  2245.  
  2246.  
  2247.     protected override void ColorHook()
  2248.     {
  2249.     }
  2250.  
  2251.     protected override void PaintHook()
  2252.     {
  2253.         G.Clear(Color.FromArgb(24, 24, 24));
  2254.         Pen P = new Pen(Color.FromArgb(13, Color.White));
  2255.         HatchBrush T = new HatchBrush(HatchStyle.Trellis, Color.FromArgb(24, 24, 24), Color.FromArgb(8, 8, 8));
  2256.         G.FillRectangle(T, 0, 0, Width, Height);
  2257.     }
  2258.  
  2259. }
  2260.  
  2261. class DroneCheckbox : ThemeControl153
  2262. {
  2263.  
  2264.     public DroneCheckbox()
  2265.     {
  2266.         Click += new EventHandler(DroneCheckbox_Click);
  2267.         Transparent = true;
  2268.         BackColor = Color.Transparent;
  2269.         LockHeight = 16;
  2270.     }
  2271.  
  2272.     private bool _Checked = false;
  2273.     public bool Checked
  2274.     {
  2275.         get { return _Checked; }
  2276.         set
  2277.         {
  2278.             _Checked = value;
  2279.             Invalidate();
  2280.         }
  2281.     }
  2282.  
  2283.     public void DroneCheckbox_Click(object sender, EventArgs e)
  2284.     {
  2285.         _Checked = !_Checked;
  2286.     }
  2287.  
  2288.  
  2289.     protected override void ColorHook()
  2290.     {
  2291.     }
  2292.  
  2293.     protected override void PaintHook()
  2294.     {
  2295.         G.Clear(BackColor);
  2296.         DrawBorders(new Pen(Color.FromArgb(32, 32, 32)), 0, 0, 16, 16, 1);
  2297.         G.FillRectangle(new SolidBrush(Color.FromArgb(62, 62, 62)), 0, 0, 16, 5);
  2298.         DrawBorders(Pens.Black, 0, 0, 16, 16, 2);
  2299.         DrawBorders(Pens.Black, 0, 0, 16, 16);
  2300.  
  2301.         if (_Checked)
  2302.         {
  2303.             if (State == MouseState.Over)
  2304.             {
  2305.                 G.FillRectangle(new SolidBrush(Color.FromArgb(0, 55, 90)), 3, 3, 10, 10);
  2306.                 DrawBorders(new Pen(Color.FromArgb(0, 66, 108)), 0, 0, 16, 16, 3);
  2307.             }
  2308.             else
  2309.             {
  2310.                 G.FillRectangle(new SolidBrush(Color.FromArgb(0, 44, 72)), 3, 3, 10, 10);
  2311.                 DrawBorders(new Pen(Color.FromArgb(0, 55, 90)), 0, 0, 16, 16, 3);
  2312.             }
  2313.         }
  2314.         else
  2315.         {
  2316.             if (State == MouseState.Over)
  2317.             {
  2318.                 G.FillRectangle(new SolidBrush(Color.FromArgb(35, 35, 35)), 3, 3, 10, 10);
  2319.                 DrawBorders(new Pen(Color.FromArgb(49, 49, 49)), 0, 0, 16, 16, 3);
  2320.             }
  2321.             else
  2322.             {
  2323.                 G.FillRectangle(new SolidBrush(Color.FromArgb(24, 24, 24)), 3, 3, 10, 10);
  2324.                 DrawBorders(new Pen(Color.FromArgb(38, 38, 38)), 0, 0, 16, 16, 3);
  2325.             }
  2326.         }
  2327.  
  2328.         G.FillRectangle(new SolidBrush(Color.FromArgb(13, Color.White)), 3, 3, 10, 5);
  2329.  
  2330.         DrawText(Brushes.White, HorizontalAlignment.Left, 18, 0);
  2331.     }
  2332. }