13 Years of Service
24%

Code:
>using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.ComponentModel;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
//Vulcan Theme Reloaded
//Convert into C# by DrWhite
//Theme
internal class VulcanTheme : ThemeContainer154
{
public VulcanTheme()
{
this.TransparencyKey = Color.Fuchsia;
this.BackColor = Color.FromArgb(30, 30, 30);
this.Header = 30;
}
protected override void ColorHook()
{
}
protected override void PaintHook()
{
base.G.Clear(Color.FromArgb(30, 30, 30));
base.G.FillRectangle(Brushes.Fuchsia, 0, 0, this.Width, 5);
this.DrawBorders(Pens.Black, 0, 30, this.Width, this.Height);
this.DrawGradient(Color.Black, Color.Transparent, 1, 0x1c, this.Width, 10);
this.DrawGradient(Color.Transparent, Color.Black, 0, this.Height - 0x17, this.Width, 10);
base.G.FillRectangle(Brushes.Black, 0, this.Height - 12, this.Width, this.Height);
base.G.DrawLine(new Pen(Color.FromArgb(60, 60, 60)), 0, this.Height - 13, this.Width, this.Height - 13);
base.G.DrawLine(new Pen(Color.FromArgb(60, 60, 60)), 0, this.Height - 1, this.Width, this.Height - 1);
base.G.FillRectangle(Brushes.Black, 0, 30, 8, this.Height);
this.DrawBorders(Pens.Black, 1, 30, 9, this.Height - 2);
base.G.DrawLine(new Pen(Color.FromArgb(40, 40, 40)), 8, 30, 8, this.Height);
base.G.FillRectangle(Brushes.Black, this.Width - 9, 30, 11, this.Height - 20);
this.DrawBorders(Pens.Black, this.Width - 10, 30, 11, this.Height - 2);
base.G.DrawLine(new Pen(Color.FromArgb(60, 60, 60)), this.Width - 9, 30, this.Width - 9, this.Height);
base.G.FillRectangle(Brushes.Black, 0, 5, this.Width, 0x18);
this.DrawText(Brushes.Red, HorizontalAlignment.Left, 0x37, 2);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(50, Color.White)), 0, 5, this.Width - 1, 11);
this.DrawBorders(Pens.Black, 1, 4, this.Width - 2, 0x18);
base.G.DrawLine(new Pen(Color.FromArgb(0x6c, 0x6c, 0x6c)), 1, 5, this.Width, 5);
base.G.DrawLine(new Pen(Color.FromArgb(60, 60, 60)), 1, 0x1c, this.Width - 2, 0x1c);
base.G.DrawLine(Pens.Black, 1, 30, this.Width - 3, 30);
this.DrawBorders(Pens.Black, 8, 0, 0x22, 0x20);
this.DrawGradient(Color.FromArgb(0x39, 0x39, 0x3a), Color.FromArgb(2, 4, 12), 9, 1, 0x20, 0x10);
this.DrawGradient(Color.FromArgb(2, 4, 0x17), Color.FromArgb(0x39, 0x39, 0x3a), 9, 15, 0x20, 0x10);
this.DrawGradient(Color.FromArgb(0xfc, 0x38, 0x2d), Color.FromArgb(0xd8, 14, 13), 0x11, 8, 3, 15);
this.DrawGradient(Color.FromArgb(0xfc, 0x38, 0x2d), Color.FromArgb(0xd8, 14, 13), 0x18, 4, 3, 20);
this.DrawGradient(Color.FromArgb(0xfc, 0x38, 0x2d), Color.FromArgb(0xd8, 14, 13), 30, 8, 3, 15);
this.DrawImage(HorizontalAlignment.Left, 9, 1);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(15, Color.White)), 10, 2, 0x1f, 13);
this.DrawGradient(Color.FromArgb(10, 10, 10), Color.FromArgb(0x2f, 0x2f, 0x2f), 0x2a, 2, 5, 15);
this.DrawGradient(Color.FromArgb(0x2f, 0x2f, 0x2f), Color.FromArgb(10, 10, 10), 0x2a, 15, 5, 15);
this.DrawGradient(Color.FromArgb(0x2f, 0x2f, 0x2f), Color.FromArgb(10, 10, 10), 3, 2, 5, 15);
this.DrawGradient(Color.FromArgb(10, 10, 10), Color.FromArgb(0x2f, 0x2f, 0x2f), 3, 15, 5, 15);
this.DrawBorders(Pens.Black, 0x2a, 2, 5, 0x1d);
this.DrawBorders(Pens.Black, 3, 2, 5, 0x1d);
base.G.DrawLine(Pens.Black, 3, 15, 7, 15);
base.G.DrawLine(Pens.Black, 0x2a, 15, 0x2e, 15);
base.G.DrawLine(Pens.Black, 0, this.Height - 1, this.Width, this.Height - 1);
this.DrawCorners(Color.Fuchsia);
}
}
internal class VulcanButton : ThemeControl154
{
public VulcanButton()
{
this.Transparent = true;
this.BackColor = Color.Transparent;
}
protected override void ColorHook()
{
}
protected override void PaintHook()
{
this.DrawGradient(Color.FromArgb(0x19, 0x19, 0x19), Color.Black, 0, 0, this.Width, this.Height, 45f);
this.DrawText(Brushes.Red, HorizontalAlignment.Center, 0, 0);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.White)), 0, 0, this.Width, this.Height / 2);
this.DrawBorders(Pens.Black);
this.DrawBorders(new Pen(Color.FromArgb(0x45, 0x47, 70)), 1);
this.DrawGradient(Color.White, Color.FromArgb(0x45, 0x47, 70), 1, 1, this.Width / 2, 1, 360f);
this.DrawGradient(Color.White, Color.FromArgb(0x45, 0x47, 70), 1, 1, 1, this.Height / 2);
this.DrawGradient(Color.White, Color.FromArgb(0x45, 0x47, 70), this.Width - 2, 1, 1, this.Height / 2, 270f);
this.DrawGradient(Color.White, Color.FromArgb(0x45, 0x47, 70), this.Width - 2, this.Height / 2, 1, this.Height / 2);
if (base.State == MouseState.Over)
{
this.DrawGradient(Color.FromArgb(0xff, 0x4e, 0x53), Color.Red, 0, 0, this.Width, this.Height, 45f);
this.DrawBorders(Pens.Red);
this.DrawBorders(new Pen(Color.FromArgb(0xff, 0x3f, 0x4a)), 1);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, this.Width / 2, 1, 360f);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, 1, this.Height / 2);
this.DrawText(Brushes.Black, HorizontalAlignment.Center, 0, 0);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.White)), 0, 0, this.Width, 13);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), this.Width - 2, 1, 1, this.Height / 2, 270f);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), this.Width - 2, this.Height / 2, 1, this.Height / 2);
this.DrawCorners(Color.Red, 1);
}
else if (base.State == MouseState.Down)
{
this.DrawGradient(Color.FromArgb(0xff, 0x26, 0x2c), Color.FromArgb(0xa6, 0, 0), 0, 0, this.Width, this.Height, 45f);
this.DrawBorders(Pens.Red);
this.DrawBorders(new Pen(Color.FromArgb(0xff, 0x3f, 0x4a)), 1);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, this.Width / 2, 1, 360f);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, 1, this.Height / 2);
this.DrawText(Brushes.Black, HorizontalAlignment.Center, 0, 0);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.White)), 0, 0, this.Width, 13);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), this.Width - 2, 1, 1, this.Height / 2, 270f);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), this.Width - 2, this.Height / 2, 1, this.Height / 2);
this.DrawCorners(Color.Red, 1);
}
this.DrawCorners(this.BackColor);
}
}
[DefaultEvent("CheckedChanged")]
internal class VulcanCheckbox : ThemeControl154
{
[CompilerGenerated]
private bool __Checked;
public event CheckedChangedEventHandler CheckedChanged;
public VulcanCheckbox()
{
this._Checked = false;
this.Transparent = true;
this.BackColor = Color.Transparent;
this.LockHeight = 15;
}
protected override void ColorHook()
{
}
protected override void OnClick(EventArgs e)
{
this._Checked = !this._Checked;
CheckedChangedEventHandler checkedChangedEvent = this.CheckedChanged;
if (checkedChangedEvent != null)
{
checkedChangedEvent(this);
}
base.OnClick(e);
}
protected override void PaintHook()
{
Rectangle r = new Rectangle(1, 1, this.Height - 3, this.Height - 3);
base.G.Clear(this.BackColor);
this.DrawGradient(Color.FromArgb(0xff, 0x13, 6), Color.FromArgb(140, 7, 0), r, 45f);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.White)), 1, 1, this.Height - 2, this.Height / 2);
base.G.DrawRectangle(Pens.Maroon, r);
switch (this._Checked)
{
case true:
this.DrawGradient(Color.FromArgb(0xfc, 0x38, 0x2d), Color.FromArgb(0xd8, 14, 13), r, 45f);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.White)), 1, 1, this.Height - 2, this.Height / 2);
base.G.DrawRectangle(Pens.Red, r);
break;
}
this.DrawText(Brushes.Red, HorizontalAlignment.Left, 0x12, 1);
}
private bool _Checked
{
get
{
return this.__Checked;
}
set
{
this.__Checked = value;
}
}
public bool Checked
{
get
{
return this._Checked;
}
set
{
this._Checked = value;
}
}
public delegate void CheckedChangedEventHandler(object sender);
}
internal class VulcanGroupbox : ThemeContainer154
{
public VulcanGroupbox()
{
this.ControlMode = true;
this.Header = 0x12;
}
protected override void ColorHook()
{
}
protected override void PaintHook()
{
base.G.Clear(Color.FromArgb(30, 30, 30));
this.DrawBorders(Pens.Black);
base.G.FillRectangle(Brushes.Black, 2, 2, this.Width - 4, 0x12);
base.G.DrawLine(new Pen(Color.FromArgb(60, 60, 60)), 2, 0x12, this.Width - 2, 0x12);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.White)), 2, 2, this.Width - 4, 7);
this.DrawGradient(Color.Black, Color.FromArgb(30, 30, 30), 2, 0x13, this.Width - 4, 8);
this.DrawGradient(Color.FromArgb(30, 30, 30), Color.Black, 7, this.Height - 0x10, this.Width - 14, 8);
this.DrawGradient(Color.FromArgb(0, 0, 0), Color.FromArgb(0x39, 0x39, 0x3a), 0, this.Height - 8, this.Width / 2, this.Height - 4, 360f);
this.DrawGradient(Color.FromArgb(0, 0, 0), Color.FromArgb(0x39, 0x39, 0x3a), this.Width / 2, this.Height - 8, this.Width / 2, this.Height - 4, 180f);
base.G.DrawLine(new Pen(Color.FromArgb(0x39, 0x39, 0x3a)), this.Width / 2, this.Height - 8, this.Width / 2, this.Height);
this.DrawText(Brushes.Red, HorizontalAlignment.Left, 8, 1);
base.G.FillRectangle(Brushes.Black, 2, 0x13, 5, this.Height - 4);
base.G.DrawLine(new Pen(Color.FromArgb(60, 60, 60)), 5, 0x13, 5, this.Height - 2);
base.G.FillRectangle(Brushes.Black, this.Width - 6, 0x13, 10, this.Height - 4);
base.G.DrawLine(new Pen(Color.FromArgb(60, 60, 60)), this.Width - 6, 0x13, this.Width - 6, this.Height - 2);
this.DrawBorders(new Pen(Color.FromArgb(60, 60, 60)), 1);
}
}
internal class VulcanProgressbar : ThemeControl154
{
private int _Maximum = 100;
private int _Value;
protected override void ColorHook()
{
}
protected override void PaintHook()
{
this.DrawGradient(Color.Black, Color.FromArgb(40, 40, 40), 0, 0, this.Width, this.Height, 2f);
this.DrawGradient(Color.FromArgb(0xfc, 0x38, 0x2d), Color.FromArgb(0xd8, 14, 13), 0, 0, (int)Math.Round((double)(((((double)this._Value) / ((double)this._Maximum)) * this.Width) - 1.0)), this.Height);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(30, Color.White)), 0, 0, (int)Math.Round((double)(((((double)this._Value) / ((double)this._Maximum)) * this.Width) - 1.0)), this.Height / 2);
this.DrawBorders(Pens.Black);
this.DrawBorders(Pens.Black, 2);
this.DrawBorders(new Pen(Color.FromArgb(0x45, 0x47, 70)), 1);
this.DrawGradient(Color.White, Color.Black, 0, 0, this.Width / 4, 1, 360f);
this.DrawGradient(Color.White, Color.Black, 0, 0, 1, this.Height / 2);
}
public int Maximum
{
get
{
return this._Maximum;
}
set
{
if (value {
value = 1;
}
if (this._Value > value)
{
this._Value = value;
}
this._Maximum = value;
this.Invalidate();
}
}
public int Value
{
get
{
return this._Value;
}
set
{
if (value > this._Maximum)
{
value = this._Maximum;
}
if (value {
value = 0;
}
this._Value = value;
this.Invalidate();
}
}
}
[DefaultEvent("CheckedChanged")]
internal class VulcanRadiobutton : ThemeControl154
{
[CompilerGenerated]
private bool __Checked;
public event CheckedChangedEventHandler CheckedChanged;
public VulcanRadiobutton()
{
this._Checked = false;
this.Transparent = true;
this.BackColor = Color.Transparent;
this.LockHeight = 15;
}
protected override void ColorHook()
{
}
protected override void OnClick(EventArgs e)
{
this._Checked = !this._Checked;
CheckedChangedEventHandler checkedChangedEvent = this.CheckedChanged;//CheckedChangedEvent
if (checkedChangedEvent != null)
{
checkedChangedEvent(this);
}
base.OnClick(e);
}
protected override void PaintHook()
{
new GraphicsPath().AddEllipse(0, 0, this.Height - 1, this.Height - 1);
base.G.Clear(this.BackColor);
base.G.FillEllipse(Brushes.Maroon, 0, 0, this.Height - 1, this.Height - 1);
base.G.FillEllipse(new SolidBrush(Color.FromArgb(13, Color.White)), 0, 0, this.Height - 1, this.Height / 2);
base.G.DrawEllipse(Pens.Black, 0, 0, this.Height - 1, this.Height - 1);
Rectangle rect = new Rectangle(0, 0, this.Height - 1, this.Height - 1);
LinearGradientBrush brush = new LinearGradientBrush(rect, Color.Red, Color.DarkRed, 90f);
switch (this._Checked)
{
case true:
base.G.FillEllipse(brush, 0, 0, this.Height - 1, this.Height - 1);
base.G.FillEllipse(new SolidBrush(Color.FromArgb(30, Color.White)), 0, 0, this.Height - 1, this.Height / 2);
base.G.DrawEllipse(Pens.Black, 0, 0, this.Height - 1, this.Height - 1);
break;
}
this.DrawText(Brushes.Red, HorizontalAlignment.Left, 0x12, 1);
}
private bool _Checked
{
get
{
return this.__Checked;
}
set
{
this.__Checked = value;
}
}
public bool Checked
{
get
{
return this._Checked;
}
set
{
this._Checked = value;
}
}
public delegate void CheckedChangedEventHandler(object sender);
}
internal class VulcanSeperator : ThemeControl154
{
private System.Windows.Forms.Orientation _Orientation;
public VulcanSeperator()
{
this.Transparent = true;
this.BackColor = Color.Transparent;
this.LockHeight = 14;
}
protected override void ColorHook()
{
}
protected override void PaintHook()
{
base.G.Clear(this.BackColor);
ColorBlend blend = new ColorBlend();
ColorBlend blend2 = new ColorBlend();
blend.Positions = new float[] { 0f, 0.15f, 0.85f, 1f };
blend2.Positions = new float[] { 0f, 0.15f, 0.5f, 0.85f, 1f };
Color[] colorArray = new Color[] { Color.Transparent, Color.FromArgb(60, 60, 60), Color.FromArgb(60, 60, 60), Color.Transparent };
blend.Colors = colorArray;
colorArray = new Color[] { Color.Transparent, Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 0), Color.Transparent };
blend2.Colors = colorArray;
if (this._Orientation == System.Windows.Forms.Orientation.Vertical)
{
this.DrawGradient(blend, 6, 0, 1, this.Height);
this.DrawGradient(blend2, 7, 0, 1, this.Height);
}
else
{
this.DrawGradient(blend, 0, 6, this.Width, 1, 0f);
this.DrawGradient(blend2, 0, 7, this.Width, 1, 0f);
}
}
public System.Windows.Forms.Orientation Orientation
{
get
{
return this._Orientation;
}
set
{
this._Orientation = value;
if (value == System.Windows.Forms.Orientation.Vertical)
{
this.LockHeight = 0;
this.LockWidth = 14;
}
else
{
this.LockHeight = 14;
this.LockWidth = 0;
}
this.Invalidate();
}
}
}
internal class VulcanTopButton : ThemeControl154
{
public VulcanTopButton()
{
this.Transparent = true;
this.BackColor = Color.Transparent;
this.LockHeight = 0x19;
this.LockWidth = 0x1a;
}
protected override void ColorHook()
{
}
protected override void PaintHook()
{
base.G.Clear(Color.Black);
this.DrawBorders(Pens.Black);
this.DrawBorders(new Pen(Color.FromArgb(0x45, 0x47, 70)), 1);
this.DrawBorders(Pens.Black, 2);
this.DrawGradient(Color.White, Color.FromArgb(0x45, 0x47, 70), 1, 1, this.Width / 2, 1, 360f);
this.DrawGradient(Color.White, Color.FromArgb(0x45, 0x47, 70), 1, 1, 1, this.Height / 2);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.White)), 0, 0, this.Width, 13);
if (base.State == MouseState.Over)
{
this.DrawGradient(Color.FromArgb(0xff, 0x4e, 0x53), Color.Red, 0, 0, this.Width, this.Height);
this.DrawBorders(new Pen(Color.FromArgb(0xd7, 0, 0), 0f));
this.DrawBorders(new Pen(Color.FromArgb(0xff, 0x3f, 0x4a)), 1);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, this.Width / 2, 1, 360f);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, 1, this.Height / 2);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.White)), 0, 0, this.Width, 13);
this.DrawCorners(Color.Red, 1);
}
else if (base.State == MouseState.Down)
{
this.DrawGradient(Color.FromArgb(0xff, 0x26, 0x2c), Color.FromArgb(0xa6, 0, 0), 0, 0, this.Width, this.Height);
this.DrawBorders(new Pen(Color.FromArgb(0xd7, 0, 0), 0f));
this.DrawBorders(new Pen(Color.FromArgb(0xff, 0x3f, 0x4a)), 1);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, this.Width / 2, 1, 360f);
this.DrawGradient(Color.White, Color.FromArgb(0xff, 0x3f, 0x4a), 1, 1, 1, this.Height / 2);
base.G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.White)), 0, 0, this.Width, 13);
this.DrawCorners(Color.Red, 1);
}
base.G.FillRectangle(new SolidBrush(Color.FromArgb(13, Color.White)), 3, 3, this.Width - 6, 8);
this.DrawCorners(this.BackColor);
}
}
internal class VulcanUnderGroupbox : ThemeContainer154
{
public VulcanUnderGroupbox()
{
this.ControlMode = true;
this.Transparent = true;
this.BackColor = Color.Transparent;
}
protected override void ColorHook()
{
}
protected override void PaintHook()
{
base.G.Clear(Color.Black);
GraphicsPath path = new GraphicsPath();
path.AddLine(8, 8, this.Width / 2, 8);
path.AddLine(8, this.Height - 40, this.Width / 3, this.Height - 40);
path.AddLine(8, 8, 8, this.Height - 40);
path.AddLine(this.Width / 2, 8, this.Width / 3, this.Height - 40);
base.G.FillPath(new SolidBrush(Color.FromArgb(20, Color.White)), path);
this.DrawGradient(Color.FromArgb(0x2e, 0x30, 50), Color.Black, 0, 0, this.Width, 9, 360f);
this.DrawGradient(Color.FromArgb(0x2e, 0x30, 50), Color.Black, 0, 0, 9, this.Height - 0x1c);
base.G.DrawRectangle(new Pen(Color.FromArgb(0x2c, 0x2d, 0x30)), 8, 8, this.Width - 0x10, this.Height - 0x2e);
base.G.DrawRectangle(Pens.Black, 9, 9, this.Width - 0x12, this.Height - 0x30);
GraphicsPath path2 = new GraphicsPath();
path2.AddEllipse(0, this.Height - 30, this.Width, this.Height);
PathGradientBrush brush = new PathGradientBrush(path2);
brush.CenterColor = Color.Red;
brush.SurroundColors = new Color[] { this.BackColor };
base.G.FillPath(brush, path2);
base.G.DrawRectangle(new Pen(Color.FromArgb(0x27, 40, 40)), 2, this.Height - 0x19, this.Width - 5, this.Height - 3);
this.DrawBorders(Pens.Black, 1);
this.DrawBorders(Pens.Black);
base.G.DrawRectangle(new Pen(Color.FromArgb(0x1f, 0x21, 0x23)), 2, 2, this.Width - 5, this.Height - 30);
this.DrawGradient(Color.FromArgb(0x4f, 0x51, 0x51), Color.FromArgb(0x1f, 0x21, 0x23), 2, 2, 1, this.Height - 0x1f);
this.DrawGradient(Color.FromArgb(0x4f, 0x51, 0x51), Color.FromArgb(0x1f, 0x21, 0x23), 2, 2, this.Width - 4, 1, 360f);
this.DrawCorners(Color.Black, 2);
this.DrawCorners(this.BackColor);
this.DrawText(Brushes.Red, HorizontalAlignment.Center, 0, this.Height - 0x1c);
}
}
//Dependencies
internal enum MouseState : byte
{
Block = 3,
Down = 2,
None = 0,
Over = 1
}
[structLayout(LayoutKind.Sequential)]
internal struct Bloom
{
public string _Name;
private Color _Value;
public string Name
{
get
{
return this._Name;
}
}
public Color Value
{
get
{
return this._Value;
}
set
{
this._Value = value;
}
}
public string ValueHex
{
get
{
return ("#" + this._Value.R.ToString("X2", null) + this._Value.G.ToString("X2", null) + this._Value.B.ToString("X2", null));
}
set
{
try
{
this._Value = ColorTranslator.FromHtml(value);
}
catch
{
}
}
}
public Bloom(string name, Color value)
{
this = new Bloom();
this._Name = name;
this._Value = value;
}
}
internal class PrecisionTimer : IDisposable
{
private bool _Enabled;
private IntPtr Handle;
private TimerDelegate TimerCallback;
public void Create(uint dueTime, uint period, TimerDelegate callback)
{
if (!this._Enabled)
{
bool flag;
this.TimerCallback = callback;
if (!(flag = CreateTimerQueueTimer(ref this.Handle, IntPtr.Zero, this.TimerCallback, IntPtr.Zero, dueTime, period, 0)))
{
this.ThrowNewException("CreateTimerQueueTimer");
}
this._Enabled = flag;
}
}
[DllImport("kernel32.dll")]
private static extern bool CreateTimerQueueTimer(ref IntPtr handle, IntPtr queue, TimerDelegate callback, IntPtr state, uint dueTime, uint period, uint flags);
public void Delete()
{
if (this._Enabled)
{
bool flag;
if (!(flag = DeleteTimerQueueTimer(IntPtr.Zero, this.Handle, IntPtr.Zero)) && (Marshal.GetLastWin32Error() != 0x3e5))
{
this.ThrowNewException("DeleteTimerQueueTimer");
}
this._Enabled = !flag;
}
}
[DllImport("kernel32.dll")]
private static extern bool DeleteTimerQueueTimer(IntPtr queue, IntPtr handle, IntPtr callback);
public void Dispose()
{
this.Delete();
}
private void ThrowNewException(string name)
{
throw new Exception(string.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error()));
}
public bool Enabled
{
get
{
return this._Enabled;
}
}
public delegate void TimerDelegate(IntPtr r1, bool r2);
}
internal abstract class ThemeContainer154 : ContainerControl
{
private bool _BackColor;
private FormBorderStyle _BorderStyle;
private bool _ControlMode;
private string _Customization;
private int _Header = 0x18;
private System.Drawing.Image _Image;
private Size _ImageSize;
private bool _IsAnimated;
private bool _IsParentForm;
private int _LockHeight;
private int _LockWidth;
private bool _Movable = true;
private bool _NoRounding;
private bool _Sizable = true;
private bool _SmartBounds = true;
private FormStartPosition _StartPosition;
private Color _TransparencyKey;
private bool _Transparent;
protected Bitmap B;
private bool B1;
private bool B2;
private bool B3;
private bool B4;
private Point CenterReturn;
private GraphicsPath CreateRoundPath;
private Rectangle CreateRoundRectangle;
private int Current;
private bool DoneCreation;
private SolidBrush DrawCornersBrush;
private LinearGradientBrush DrawGradientBrush;
private Rectangle DrawGradientRectangle;
private Point DrawImagePoint;
private SolidBrush DrawPixelBrush;
private PathGradientBrush DrawRadialBrush1;
private LinearGradientBrush DrawRadialBrush2;
private GraphicsPath DrawRadialPath;
private Rectangle DrawRadialRectangle;
private Point DrawTextPoint;
private Size DrawTextSize;
private Rectangle Frame;
protected Graphics G;
private Point GetIndexPoint;
private bool HasShown;
private Dictionary Items = new Dictionary();
private Bitmap MeasureBitmap;
private Graphics MeasureGraphics;
private Message[] Messages = new Message[9];
private Point OffsetReturnPoint;
private Rectangle OffsetReturnRectangle;
private Size OffsetReturnSize;
private int Previous;
protected MouseState State;
private bool WM_LMBUTTONDOWN;
public ThemeContainer154()
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque | ControlStyles.UserPaint, true);
this._ImageSize = Size.Empty;
this.Font = new System.Drawing.Font("Verdana", 8f);
this.MeasureBitmap = new Bitmap(1, 1);
this.MeasureGraphics = Graphics.FromImage(this.MeasureBitmap);
this.DrawRadialPath = new GraphicsPath();
this.InvalidateCustimization();
}
protected Point Center(Rectangle child)
{
return this.Center(this.Width, this.Height, child.Width, child.Height);
}
protected Point Center(Size child)
{
return this.Center(this.Width, this.Height, child.Width, child.Height);
}
protected Point Center(Rectangle p, Rectangle c)
{
this.CenterReturn = new Point((((p.Width / 2) - (c.Width / 2)) + p.X) + c.X, (((p.Height / 2) - (c.Height / 2)) + p.Y) + c.Y);
return this.CenterReturn;
}
protected Point Center(Rectangle p, Size c)
{
this.CenterReturn = new Point(((p.Width / 2) - (c.Width / 2)) + p.X, ((p.Height / 2) - (c.Height / 2)) + p.Y);
return this.CenterReturn;
}
protected Point Center(Size p, Size c)
{
return this.Center(p.Width, p.Height, c.Width, c.Height);
}
protected Point Center(int childWidth, int childHeight)
{
return this.Center(this.Width, this.Height, childWidth, childHeight);
}
protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
{
this.CenterReturn = new Point((pWidth / 2) - (cWidth / 2), (pHeight / 2) - (cHeight / 2));
return this.CenterReturn;
}
protected abstract void ColorHook();
private void CorrectBounds(Rectangle bounds)
{
if (this.Parent.Width > bounds.Width)
{
this.Parent.Width = bounds.Width;
}
if (this.Parent.Height > bounds.Height)
{
this.Parent.Height = bounds.Height;
}
int x = this.Parent.Location.X;
Point location = this.Parent.Location;
int y = location.Y;
if (x {
x = bounds.X;
}
if (y {
y = bounds.Y;
}
int num3 = bounds.X + bounds.Width;
int num4 = bounds.Y + bounds.Height;
if ((x + this.Parent.Width) > num3)
{
x = num3 - this.Parent.Width;
}
if ((y + this.Parent.Height) > num4)
{
y = num4 - this.Parent.Height;
}
location = new Point(x, y);
this.Parent.Location = location;
}
public GraphicsPath CreateRound(Rectangle r, int slope)
{
this.CreateRoundPath = new GraphicsPath(FillMode.Winding);
this.CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
this.CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
this.CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
this.CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
this.CreateRoundPath.CloseFigure();
return this.CreateRoundPath;
}
public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
{
this.CreateRoundRectangle = new Rectangle(x, y, width, height);
return this.CreateRound(this.CreateRoundRectangle, slope);
}
private void DoAnimation(bool i)
{
this.OnAnimation();
if (i)
{
this.Invalidate();
}
}
protected void DrawBorders(Pen p1)
{
this.DrawBorders(p1, 0, 0, this.Width, this.Height);
}
protected void DrawBorders(Pen p1, Rectangle r)
{
this.DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
}
protected void DrawBorders(Pen p1, int offset)
{
this.DrawBorders(p1, 0, 0, this.Width, this.Height, offset);
}
protected void DrawBorders(Pen p1, Rectangle r, int offset)
{
this.DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
}
protected void DrawBorders(Pen p1, int x, int y, int width, int height)
{
this.G.DrawRectangle(p1, x, y, width - 1, height - 1);
}
protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
{
this.DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
}
protected void DrawCorners(Color c1)
{
this.DrawCorners(c1, 0, 0, this.Width, this.Height);
}
protected void DrawCorners(Color c1, Rectangle r1)
{
this.DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
}
protected void DrawCorners(Color c1, int offset)
{
this.DrawCorners(c1, 0, 0, this.Width, this.Height, offset);
}
protected void DrawCorners(Color c1, Rectangle r1, int offset)
{
this.DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
}
protected void DrawCorners(Color c1, int x, int y, int width, int height)
{
if (!this._NoRounding)
{
if (this._Transparent)
{
this.B.SetPixel(x, y, c1);
this.B.SetPixel(x + (width - 1), y, c1);
this.B.SetPixel(x, y + (height - 1), c1);
this.B.SetPixel(x + (width - 1), y + (height - 1), c1);
}
else
{
this.DrawCornersBrush = new SolidBrush(c1);
this.G.FillRectangle(this.DrawCornersBrush, x, y, 1, 1);
this.G.FillRectangle(this.DrawCornersBrush, x + (width - 1), y, 1, 1);
this.G.FillRectangle(this.DrawCornersBrush, x, y + (height - 1), 1, 1);
this.G.FillRectangle(this.DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
}
}
}
protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
{
this.DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
}
protected void DrawGradient(ColorBlend blend, Rectangle r)
{
this.DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
this.DrawGradientBrush.InterpolationColors = blend;
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(Color c1, Color c2, Rectangle r)
{
this.DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
{
this.DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
this.DrawGradientBrush.InterpolationColors = blend;
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
{
this.DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(blend, this.DrawGradientRectangle);
}
protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(c1, c2, this.DrawGradientRectangle);
}
protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(blend, this.DrawGradientRectangle, angle);
}
protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(c1, c2, this.DrawGradientRectangle, angle);
}
protected void DrawImage(Point p1)
{
this.DrawImage(this._Image, p1.X, p1.Y);
}
protected void DrawImage(System.Drawing.Image image, Point p1)
{
this.DrawImage(image, p1.X, p1.Y);
}
protected void DrawImage(int x, int y)
{
this.DrawImage(this._Image, x, y);
}
protected void DrawImage(System.Drawing.Image image, int x, int y)
{
if (image != null)
{
this.G.DrawImage(image, x, y, image.Width, image.Height);
}
}
protected void DrawImage(HorizontalAlignment a, int x, int y)
{
this.DrawImage(this._Image, a, x, y);
}
protected void DrawImage(System.Drawing.Image image, HorizontalAlignment a, int x, int y)
{
if (image != null)
{
this.DrawImagePoint = new Point((this.Width / 2) - (image.Width / 2), (this.Header / 2) - (image.Height / 2));
switch (a)
{
case HorizontalAlignment.Left:
this.G.DrawImage(image, x, this.DrawImagePoint.Y + y, image.Width, image.Height);
break;
case HorizontalAlignment.Right:
this.G.DrawImage(image, (this.Width - image.Width) - x, this.DrawImagePoint.Y + y, image.Width, image.Height);
break;
case HorizontalAlignment.Center:
this.G.DrawImage(image, this.DrawImagePoint.X + x, this.DrawImagePoint.Y + y, image.Width, image.Height);
break;
}
}
}
protected void DrawPixel(Color c1, int x, int y)
{
if (this._Transparent)
{
this.B.SetPixel(x, y, c1);
}
else
{
this.DrawPixelBrush = new SolidBrush(c1);
this.G.FillRectangle(this.DrawPixelBrush, x, y, 1, 1);
}
}
public void DrawRadial(ColorBlend blend, Rectangle r)
{
this.DrawRadial(blend, r, r.Width / 2, r.Height / 2);
}
protected void DrawRadial(Color c1, Color c2, Rectangle r)
{
this.DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
this.G.FillRectangle(this.DrawGradientBrush, r);
}
public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
{
this.DrawRadial(blend, r, center.X, center.Y);
}
protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
{
this.DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
this.G.FillEllipse(this.DrawGradientBrush, r);
}
public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
{
this.DrawRadialPath.Reset();
this.DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
this.DrawRadialBrush1 = new PathGradientBrush(this.DrawRadialPath);
Point point = new Point(r.X + cx, r.Y + cy);
this.DrawRadialBrush1.CenterPoint = (PointF)point;
this.DrawRadialBrush1.InterpolationColors = blend;
if (this.G.SmoothingMode == SmoothingMode.AntiAlias)
{
this.G.FillEllipse(this.DrawRadialBrush1, (int)(r.X + 1), (int)(r.Y + 1), (int)(r.Width - 3), (int)(r.Height - 3));
}
else
{
this.G.FillEllipse(this.DrawRadialBrush1, r);
}
}
public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(blend, this.DrawRadialRectangle, width / 2, height / 2);
}
protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(c1, c2, this.DrawGradientRectangle);
}
public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(blend, this.DrawRadialRectangle, center.X, center.Y);
}
protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(c1, c2, this.DrawGradientRectangle, angle);
}
public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(blend, this.DrawRadialRectangle, cx, cy);
}
protected void DrawText(Brush b1, Point p1)
{
if (this.Text.Length != 0)
{
this.G.DrawString(this.Text, this.Font, b1, (PointF)p1);
}
}
protected void DrawText(Brush b1, int x, int y)
{
if (this.Text.Length != 0)
{
this.G.DrawString(this.Text, this.Font, b1, (float)x, (float)y);
}
}
protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
{
this.DrawText(b1, this.Text, a, x, y);
}
protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
{
if (text.Length != 0)
{
this.DrawTextSize = this.Measure(text);
this.DrawTextPoint = new Point((this.Width / 2) - (this.DrawTextSize.Width / 2), (this.Header / 2) - (this.DrawTextSize.Height / 2));
switch (a)
{
case HorizontalAlignment.Left:
this.G.DrawString(text, this.Font, b1, (float)x, (float)(this.DrawTextPoint.Y + y));
break;
case HorizontalAlignment.Right:
this.G.DrawString(text, this.Font, b1, (float)((this.Width - this.DrawTextSize.Width) - x), (float)(this.DrawTextPoint.Y + y));
break;
case HorizontalAlignment.Center:
this.G.DrawString(text, this.Font, b1, (float)(this.DrawTextPoint.X + x), (float)(this.DrawTextPoint.Y + y));
break;
}
}
}
private void FormShown(object sender, EventArgs e)
{
if (!this._ControlMode && !this.HasShown)
{
if ((this._StartPosition == FormStartPosition.CenterParent) || (this._StartPosition == FormStartPosition.CenterScreen))
{
Rectangle bounds = Screen.PrimaryScreen.Bounds;
Rectangle rectangle2 = this.ParentForm.Bounds;
Point point = new Point((bounds.Width / 2) - (rectangle2.Width / 2), (bounds.Height / 2) - (rectangle2.Width / 2));
this.ParentForm.Location = point;
}
this.HasShown = true;
}
}
protected SolidBrush GetBrush(string name)
{
return new SolidBrush(this.Items[name]);
}
protected Color GetColor(string name)
{
return this.Items[name];
}
private int GetIndex()
{
this.GetIndexPoint = this.PointToClient(Control.MousePosition);
this.B1 = this.GetIndexPoint.X this.B2 = this.GetIndexPoint.X > (this.Width - 7);
this.B3 = this.GetIndexPoint.Y this.B4 = this.GetIndexPoint.Y > (this.Height - 7);
if (this.B1 && this.B3)
{
return 4;
}
if (this.B1 && this.B4)
{
return 7;
}
if (this.B2 && this.B3)
{
return 5;
}
if (this.B2 && this.B4)
{
return 8;
}
if (this.B1)
{
return 1;
}
if (this.B2)
{
return 2;
}
if (this.B3)
{
return 3;
}
if (this.B4)
{
return 6;
}
return 0;
}
protected Pen GetPen(string name)
{
return new Pen(this.Items[name]);
}
protected Pen GetPen(string name, float width)
{
return new Pen(this.Items[name], width);
}
private void InitializeMessages()
{
IntPtr wparam = new IntPtr(2);
this.Messages[0] = Message.Create(this.Parent.Handle, 0xa1, wparam, IntPtr.Zero);
int index = 1;
do
{
wparam = new IntPtr(index + 9);
this.Messages[index] = Message.Create(this.Parent.Handle, 0xa1, wparam, IntPtr.Zero);
index++;
}
while (index }
private void InvalidateBitmap()
{
if (this._Transparent && this._ControlMode)
{
if ((this.Width != 0) && (this.Height != 0))
{
this.B = new Bitmap(this.Width, this.Height, PixelFormat.Format32bppPArgb);
this.G = Graphics.FromImage(this.B);
}
}
else
{
this.G = null;
this.B = null;
}
}
private void InvalidateCustimization()
{
MemoryStream stream = new MemoryStream(this.Items.Count * 4);
foreach (Bloom bloom in this.Colors)
{
stream.Write(BitConverter.GetBytes(bloom.Value.ToArgb()), 0, 4);
}
stream.Close();
this._Customization = Convert.ToBase64String(stream.ToArray());
}
private void InvalidateMouse()
{
this.Current = this.GetIndex();
if (this.Current != this.Previous)
{
this.Previous = this.Current;
switch (this.Previous)
{
case 0:
this.Cursor = Cursors.Default;
break;
case 1:
case 2:
this.Cursor = Cursors.SizeWE;
break;
case 3:
case 6:
this.Cursor = Cursors.SizeNS;
break;
case 4:
case 8:
this.Cursor = Cursors.SizeNWSE;
break;
case 5:
case 7:
this.Cursor = Cursors.SizeNESW;
break;
}
}
}
private void InvalidateTimer()
{
if (!this.DesignMode && this.DoneCreation)
{
if (this._IsAnimated)
{
ThemeShare.AddAnimationCallback(new ThemeShare.AnimationDelegate(this.DoAnimation));
}
else
{
ThemeShare.RemoveAnimationCallback(new ThemeShare.AnimationDelegate(this.DoAnimation));
}
}
}
protected Size Measure()
{
Graphics measureGraphics = this.MeasureGraphics;
lock (measureGraphics)
{
return this.MeasureGraphics.MeasureString(this.Text, this.Font, this.Width).ToSize();
}
}
protected Size Measure(string text)
{
Graphics measureGraphics = this.MeasureGraphics;
lock (measureGraphics)
{
return this.MeasureGraphics.MeasureString(text, this.Font, this.Width).ToSize();
}
}
protected Point Offset(Point p, int amount)
{
this.OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
return this.OffsetReturnPoint;
}
protected Rectangle Offset(Rectangle r, int amount)
{
this.OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
return this.OffsetReturnRectangle;
}
protected Size Offset(Size s, int amount)
{
this.OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
return this.OffsetReturnSize;
}
protected virtual void OnAnimation()
{
}
protected virtual void OnCreation()
{
}
protected override void OnEnabledChanged(EventArgs e)
{
if (this.Enabled)
{
this.SetState(MouseState.None);
}
else
{
this.SetState(MouseState.Block);
}
base.OnEnabledChanged(e);
}
protected sealed override void OnHandleCreated(EventArgs e)
{
if (this.DoneCreation)
{
this.InitializeMessages();
}
this.InvalidateCustimization();
this.ColorHook();
if (this._LockWidth != 0)
{
this.Width = this._LockWidth;
}
if (this._LockHeight != 0)
{
this.Height = this._LockHeight;
}
if (!this._ControlMode)
{
base.Dock = DockStyle.Fill;
}
this.Transparent = this._Transparent;
if (this._Transparent && this._BackColor)
{
this.BackColor = Color.Transparent;
}
base.OnHandleCreated(e);
}
protected override void OnHandleDestroyed(EventArgs e)
{
ThemeShare.RemoveAnimationCallback(new ThemeShare.AnimationDelegate(this.DoAnimation));
base.OnHandleDestroyed(e);
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.SetState(MouseState.Down);
}
if ((!this._IsParentForm || (this.ParentForm.WindowState != FormWindowState.Maximized)) && !this._ControlMode)
{
if (this._Movable && this.Frame.Contains(e.Location))
{
this.Capture = false;
this.WM_LMBUTTONDOWN = true;
this.DefWndProc(ref this.Messages[0]);
}
else if (this._Sizable && (this.Previous != 0))
{
this.Capture = false;
this.WM_LMBUTTONDOWN = true;
this.DefWndProc(ref this.Messages[this.Previous]);
}
}
base.OnMouseDown(e);
}
protected override void OnMouseEnter(EventArgs e)
{
this.SetState(MouseState.Over);
base.OnMouseEnter(e);
}
protected override void OnMouseLeave(EventArgs e)
{
this.SetState(MouseState.None);
if (((this.GetChildAtPoint(this.PointToClient(Control.MousePosition)) != null) && this._Sizable) && !this._ControlMode)
{
this.Cursor = Cursors.Default;
this.Previous = 0;
}
base.OnMouseLeave(e);
}
protected override void OnMouseMove(MouseEventArgs e)
{
if ((!this._IsParentForm || (this.ParentForm.WindowState != FormWindowState.Maximized)) && (this._Sizable && !this._ControlMode))
{
this.InvalidateMouse();
}
base.OnMouseMove(e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
this.SetState(MouseState.Over);
base.OnMouseUp(e);
}
protected sealed override void OnPaint(PaintEventArgs e)
{
if ((this.Width != 0) && (this.Height != 0))
{
if (this._Transparent && this._ControlMode)
{
this.PaintHook();
e.Graphics.DrawImage(this.B, 0, 0);
}
else
{
this.G = e.Graphics;
this.PaintHook();
}
}
}
protected sealed override void OnParentChanged(EventArgs e)
{
base.OnParentChanged(e);
if (this.Parent != null)
{
this._IsParentForm = this.Parent is Form;
if (!this._ControlMode)
{
this.InitializeMessages();
if (this._IsParentForm)
{
this.ParentForm.FormBorderStyle = this._BorderStyle;
this.ParentForm.TransparencyKey = this._TransparencyKey;
if (!this.DesignMode)
{
this.ParentForm.Shown += new EventHandler(this.FormShown);
}
}
this.Parent.BackColor = this.BackColor;
}
this.OnCreation();
this.DoneCreation = true;
this.InvalidateTimer();
}
}
protected sealed override void OnSizeChanged(EventArgs e)
{
if (this._Movable && !this._ControlMode)
{
this.Frame = new Rectangle(7, 7, this.Width - 14, this._Header - 7);
}
this.InvalidateBitmap();
this.Invalidate();
base.OnSizeChanged(e);
}
protected abstract void PaintHook();
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
{
if (this._LockWidth != 0)
{
width = this._LockWidth;
}
if (this._LockHeight != 0)
{
height = this._LockHeight;
}
base.SetBoundsCore(x, y, width, height, specified);
}
protected void SetColor(string name, Color value)
{
if (this.Items.ContainsKey(name))
{
this.Items[name] = value;
}
else
{
this.Items.Add(name, value);
}
}
protected void SetColor(string name, byte a, Color value)
{
this.SetColor(name, Color.FromArgb(a, value));
}
protected void SetColor(string name, byte r, byte g, byte b)
{
this.SetColor(name, Color.FromArgb(r, g, b));
}
protected void SetColor(string name, byte a, byte r, byte g, byte b)
{
this.SetColor(name, Color.FromArgb(a, r, g, b));
}
private void SetState(MouseState current)
{
this.State = current;
this.Invalidate();
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (this.WM_LMBUTTONDOWN && (m.Msg == 0x201))
{
this.WM_LMBUTTONDOWN = false;
this.SetState(MouseState.Over);
if (this._SmartBounds)
{
if (this.IsParentMdi)
{
Rectangle bounds = new Rectangle(Point.Empty, this.Parent.Parent.Size);
this.CorrectBounds(bounds);
}
else
{
this.CorrectBounds(Screen.FromControl(this.Parent).WorkingArea);
}
}
}
}
[Category("Misc")]
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
if (value != base.BackColor)
{
if ((!this.IsHandleCreated && this._ControlMode) && (value == Color.Transparent))
{
this._BackColor = true;
}
else
{
base.BackColor = value;
if (this.Parent != null)
{
if (!this._ControlMode)
{
this.Parent.BackColor = value;
}
this.ColorHook();
}
}
}
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override System.Drawing.Image BackgroundImage
{
get
{
return null;
}
set
{
}
}
[EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
public override ImageLayout BackgroundImageLayout
{
get
{
return ImageLayout.None;
}
set
{
}
}
public FormBorderStyle BorderStyle
{
get
{
if (this._IsParentForm && !this._ControlMode)
{
return this.ParentForm.FormBorderStyle;
}
return this._BorderStyle;
}
set
{
this._BorderStyle = value;
if (this._IsParentForm && !this._ControlMode)
{
this.ParentForm.FormBorderStyle = value;
if (value != FormBorderStyle.None)
{
this.Movable = false;
this.Sizable = false;
}
}
}
}
public Bloom[] Colors
{
get
{
List list = new List();
Dictionary.Enumerator enumerator = this.Items.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair current = enumerator.Current;
KeyValuePair pair2 = enumerator.Current;
Bloom item = new Bloom(current.Key, pair2.Value);
list.Add(item);
}
return list.ToArray();
}
set
{
foreach (Bloom bloom in value)
{
if (this.Items.ContainsKey(bloom.Name))
{
this.Items[bloom.Name] = bloom.Value;
}
}
this.InvalidateCustimization();
this.ColorHook();
this.Invalidate();
}
}
protected bool ControlMode
{
get
{
return this._ControlMode;
}
set
{
this._ControlMode = value;
this.Transparent = this._Transparent;
if (this._Transparent && this._BackColor)
{
this.BackColor = Color.Transparent;
}
this.InvalidateBitmap();
this.Invalidate();
}
}
public string Customization
{
get
{
return this._Customization;
}
set
{
if (value != this._Customization)
{
Bloom[] colors = this.Colors;
try
{
byte[] buffer = Convert.FromBase64String(value);
int num = colors.Length - 1;
for (int i = 0; i {
colors[i].Value = Color.FromArgb(BitConverter.ToInt32(buffer, i * 4));
}
}
catch
{
}
this._Customization = value;
this.Colors = colors;
this.ColorHook();
this.Invalidate();
}
}
}
public override DockStyle Dock
{
get
{
return base.Dock;
}
set
{
if (this._ControlMode)
{
base.Dock = value;
}
}
}
public override System.Drawing.Font Font
{
get
{
return base.Font;
}
set
{
base.Font = value;
this.Invalidate();
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
public override Color ForeColor
{
get
{
return Color.Empty;
}
set
{
}
}
protected int Header
{
get
{
return this._Header;
}
set
{
this._Header = value;
if (!this._ControlMode)
{
this.Frame = new Rectangle(7, 7, this.Width - 14, value - 7);
this.Invalidate();
}
}
}
public System.Drawing.Image Image
{
get
{
return this._Image;
}
set
{
if (value == null)
{
this._ImageSize = Size.Empty;
}
else
{
this._ImageSize = value.Size;
}
this._Image = value;
this.Invalidate();
}
}
protected Size ImageSize
{
get
{
return this._ImageSize;
}
}
protected bool IsAnimated
{
get
{
return this._IsAnimated;
}
set
{
this._IsAnimated = value;
this.InvalidateTimer();
}
}
protected bool IsParentForm
{
get
{
return this._IsParentForm;
}
}
protected bool IsParentMdi
{
get
{
if (this.Parent == null)
{
return false;
}
return (this.Parent.Parent != null);
}
}
protected int LockHeight
{
get
{
return this._LockHeight;
}
set
{
this._LockHeight = value;
if ((this.LockHeight != 0) && this.IsHandleCreated)
{
this.Height = this.LockHeight;
}
}
}
protected int LockWidth
{
get
{
return this._LockWidth;
}
set
{
this._LockWidth = value;
if ((this.LockWidth != 0) && this.IsHandleCreated)
{
this.Width = this.LockWidth;
}
}
}
public override Size MaximumSize
{
get
{
return base.MaximumSize;
}
set
{
base.MaximumSize = value;
if (this.Parent != null)
{
this.Parent.MaximumSize = value;
}
}
}
public override Size MinimumSize
{
get
{
return base.MinimumSize;
}
set
{
base.MinimumSize = value;
if (this.Parent != null)
{
this.Parent.MinimumSize = value;
}
}
}
public bool Movable
{
get
{
return this._Movable;
}
set
{
this._Movable = value;
}
}
public bool NoRounding
{
get
{
return this._NoRounding;
}
set
{
this._NoRounding = value;
this.Invalidate();
}
}
public bool Sizable
{
get
{
return this._Sizable;
}
set
{
this._Sizable = value;
}
}
public bool SmartBounds
{
get
{
return this._SmartBounds;
}
set
{
this._SmartBounds = value;
}
}
public FormStartPosition StartPosition
{
get
{
if (this._IsParentForm && !this._ControlMode)
{
return this.ParentForm.StartPosition;
}
return this._StartPosition;
}
set
{
this._StartPosition = value;
if (this._IsParentForm && !this._ControlMode)
{
this.ParentForm.StartPosition = value;
}
}
}
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
this.Invalidate();
}
}
public Color TransparencyKey
{
get
{
if (this._IsParentForm && !this._ControlMode)
{
return this.ParentForm.TransparencyKey;
}
return this._TransparencyKey;
}
set
{
if (value != this._TransparencyKey)
{
this._TransparencyKey = value;
if (this._IsParentForm && !this._ControlMode)
{
this.ParentForm.TransparencyKey = value;
this.ColorHook();
}
}
}
}
public bool Transparent
{
get
{
return this._Transparent;
}
set
{
this._Transparent = value;
if (this.IsHandleCreated || this._ControlMode)
{
if (!value && (this.BackColor.A != 0xff))
{
throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
}
this.SetStyle(ControlStyles.Opaque, !value);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, value);
this.InvalidateBitmap();
this.Invalidate();
}
}
}
}
internal abstract class ThemeControl154 : Control
{
private bool _BackColor;
private string _Customization;
private System.Drawing.Image _Image;
private Size _ImageSize;
private bool _IsAnimated;
private int _LockHeight;
private int _LockWidth;
private bool _NoRounding;
private bool _Transparent;
protected Bitmap B;
private Point CenterReturn;
private GraphicsPath CreateRoundPath;
private Rectangle CreateRoundRectangle;
private bool DoneCreation;
private SolidBrush DrawCornersBrush;
private LinearGradientBrush DrawGradientBrush;
private Rectangle DrawGradientRectangle;
private Point DrawImagePoint;
private SolidBrush DrawPixelBrush;
private PathGradientBrush DrawRadialBrush1;
private LinearGradientBrush DrawRadialBrush2;
private GraphicsPath DrawRadialPath;
private Rectangle DrawRadialRectangle;
private Point DrawTextPoint;
private Size DrawTextSize;
protected Graphics G;
private bool InPosition;
private Dictionary Items = new Dictionary();
private Bitmap MeasureBitmap;
private Graphics MeasureGraphics;
private Point OffsetReturnPoint;
private Rectangle OffsetReturnRectangle;
private Size OffsetReturnSize;
protected MouseState State;
public ThemeControl154()
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque | ControlStyles.UserPaint, true);
this._ImageSize = Size.Empty;
this.Font = new System.Drawing.Font("Verdana", 8f);
this.MeasureBitmap = new Bitmap(1, 1);
this.MeasureGraphics = Graphics.FromImage(this.MeasureBitmap);
this.DrawRadialPath = new GraphicsPath();
this.InvalidateCustimization();
}
protected Point Center(Rectangle child)
{
return this.Center(this.Width, this.Height, child.Width, child.Height);
}
protected Point Center(Size child)
{
return this.Center(this.Width, this.Height, child.Width, child.Height);
}
protected Point Center(Rectangle p, Rectangle c)
{
this.CenterReturn = new Point((((p.Width / 2) - (c.Width / 2)) + p.X) + c.X, (((p.Height / 2) - (c.Height / 2)) + p.Y) + c.Y);
return this.CenterReturn;
}
protected Point Center(Rectangle p, Size c)
{
this.CenterReturn = new Point(((p.Width / 2) - (c.Width / 2)) + p.X, ((p.Height / 2) - (c.Height / 2)) + p.Y);
return this.CenterReturn;
}
protected Point Center(Size p, Size c)
{
return this.Center(p.Width, p.Height, c.Width, c.Height);
}
protected Point Center(int childWidth, int childHeight)
{
return this.Center(this.Width, this.Height, childWidth, childHeight);
}
protected Point Center(int pWidth, int pHeight, int cWidth, int cHeight)
{
this.CenterReturn = new Point((pWidth / 2) - (cWidth / 2), (pHeight / 2) - (cHeight / 2));
return this.CenterReturn;
}
protected abstract void ColorHook();
public GraphicsPath CreateRound(Rectangle r, int slope)
{
this.CreateRoundPath = new GraphicsPath(FillMode.Winding);
this.CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
this.CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
this.CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
this.CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
this.CreateRoundPath.CloseFigure();
return this.CreateRoundPath;
}
public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
{
this.CreateRoundRectangle = new Rectangle(x, y, width, height);
return this.CreateRound(this.CreateRoundRectangle, slope);
}
private void DoAnimation(bool i)
{
this.OnAnimation();
if (i)
{
this.Invalidate();
}
}
protected void DrawBorders(Pen p1)
{
this.DrawBorders(p1, 0, 0, this.Width, this.Height);
}
protected void DrawBorders(Pen p1, Rectangle r)
{
this.DrawBorders(p1, r.X, r.Y, r.Width, r.Height);
}
protected void DrawBorders(Pen p1, int offset)
{
this.DrawBorders(p1, 0, 0, this.Width, this.Height, offset);
}
protected void DrawBorders(Pen p1, Rectangle r, int offset)
{
this.DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset);
}
protected void DrawBorders(Pen p1, int x, int y, int width, int height)
{
this.G.DrawRectangle(p1, x, y, width - 1, height - 1);
}
protected void DrawBorders(Pen p1, int x, int y, int width, int height, int offset)
{
this.DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
}
protected void DrawCorners(Color c1)
{
this.DrawCorners(c1, 0, 0, this.Width, this.Height);
}
protected void DrawCorners(Color c1, Rectangle r1)
{
this.DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height);
}
protected void DrawCorners(Color c1, int offset)
{
this.DrawCorners(c1, 0, 0, this.Width, this.Height, offset);
}
protected void DrawCorners(Color c1, Rectangle r1, int offset)
{
this.DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset);
}
protected void DrawCorners(Color c1, int x, int y, int width, int height)
{
if (!this._NoRounding)
{
if (this._Transparent)
{
this.B.SetPixel(x, y, c1);
this.B.SetPixel(x + (width - 1), y, c1);
this.B.SetPixel(x, y + (height - 1), c1);
this.B.SetPixel(x + (width - 1), y + (height - 1), c1);
}
else
{
this.DrawCornersBrush = new SolidBrush(c1);
this.G.FillRectangle(this.DrawCornersBrush, x, y, 1, 1);
this.G.FillRectangle(this.DrawCornersBrush, x + (width - 1), y, 1, 1);
this.G.FillRectangle(this.DrawCornersBrush, x, y + (height - 1), 1, 1);
this.G.FillRectangle(this.DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1);
}
}
}
protected void DrawCorners(Color c1, int x, int y, int width, int height, int offset)
{
this.DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2));
}
protected void DrawGradient(ColorBlend blend, Rectangle r)
{
this.DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, 90f);
this.DrawGradientBrush.InterpolationColors = blend;
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(Color c1, Color c2, Rectangle r)
{
this.DrawGradientBrush = new LinearGradientBrush(r, c1, c2, 90f);
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(ColorBlend blend, Rectangle r, float angle)
{
this.DrawGradientBrush = new LinearGradientBrush(r, Color.Empty, Color.Empty, angle);
this.DrawGradientBrush.InterpolationColors = blend;
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(Color c1, Color c2, Rectangle r, float angle)
{
this.DrawGradientBrush = new LinearGradientBrush(r, c1, c2, angle);
this.G.FillRectangle(this.DrawGradientBrush, r);
}
protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(blend, this.DrawGradientRectangle);
}
protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(c1, c2, this.DrawGradientRectangle);
}
protected void DrawGradient(ColorBlend blend, int x, int y, int width, int height, float angle)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(blend, this.DrawGradientRectangle, angle);
}
protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
{
this.DrawGradientRectangle = new Rectangle(x, y, width, height);
this.DrawGradient(c1, c2, this.DrawGradientRectangle, angle);
}
protected void DrawImage(Point p1)
{
this.DrawImage(this._Image, p1.X, p1.Y);
}
protected void DrawImage(System.Drawing.Image image, Point p1)
{
this.DrawImage(image, p1.X, p1.Y);
}
protected void DrawImage(int x, int y)
{
this.DrawImage(this._Image, x, y);
}
protected void DrawImage(System.Drawing.Image image, int x, int y)
{
if (image != null)
{
this.G.DrawImage(image, x, y, image.Width, image.Height);
}
}
protected void DrawImage(HorizontalAlignment a, int x, int y)
{
this.DrawImage(this._Image, a, x, y);
}
protected void DrawImage(System.Drawing.Image image, HorizontalAlignment a, int x, int y)
{
if (image != null)
{
this.DrawImagePoint = this.Center(image.Size);
switch (a)
{
case HorizontalAlignment.Left:
this.G.DrawImage(image, x, this.DrawImagePoint.Y + y, image.Width, image.Height);
break;
case HorizontalAlignment.Right:
this.G.DrawImage(image, (this.Width - image.Width) - x, this.DrawImagePoint.Y + y, image.Width, image.Height);
break;
case HorizontalAlignment.Center:
this.G.DrawImage(image, this.DrawImagePoint.X + x, this.DrawImagePoint.Y + y, image.Width, image.Height);
break;
}
}
}
protected void DrawPixel(Color c1, int x, int y)
{
if (this._Transparent)
{
this.B.SetPixel(x, y, c1);
}
else
{
this.DrawPixelBrush = new SolidBrush(c1);
this.G.FillRectangle(this.DrawPixelBrush, x, y, 1, 1);
}
}
public void DrawRadial(ColorBlend blend, Rectangle r)
{
this.DrawRadial(blend, r, r.Width / 2, r.Height / 2);
}
protected void DrawRadial(Color c1, Color c2, Rectangle r)
{
this.DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, 90f);
this.G.FillEllipse(this.DrawRadialBrush2, r);
}
public void DrawRadial(ColorBlend blend, Rectangle r, Point center)
{
this.DrawRadial(blend, r, center.X, center.Y);
}
protected void DrawRadial(Color c1, Color c2, Rectangle r, float angle)
{
this.DrawRadialBrush2 = new LinearGradientBrush(r, c1, c2, angle);
this.G.FillEllipse(this.DrawRadialBrush2, r);
}
public void DrawRadial(ColorBlend blend, Rectangle r, int cx, int cy)
{
this.DrawRadialPath.Reset();
this.DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1);
this.DrawRadialBrush1 = new PathGradientBrush(this.DrawRadialPath);
Point point = new Point(r.X + cx, r.Y + cy);
this.DrawRadialBrush1.CenterPoint = (PointF)point;
this.DrawRadialBrush1.InterpolationColors = blend;
if (this.G.SmoothingMode == SmoothingMode.AntiAlias)
{
this.G.FillEllipse(this.DrawRadialBrush1, (int)(r.X + 1), (int)(r.Y + 1), (int)(r.Width - 3), (int)(r.Height - 3));
}
else
{
this.G.FillEllipse(this.DrawRadialBrush1, r);
}
}
public void DrawRadial(ColorBlend blend, int x, int y, int width, int height)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(blend, this.DrawRadialRectangle, width / 2, height / 2);
}
protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(c1, c2, this.DrawRadialRectangle);
}
public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, Point center)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(blend, this.DrawRadialRectangle, center.X, center.Y);
}
protected void DrawRadial(Color c1, Color c2, int x, int y, int width, int height, float angle)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(c1, c2, this.DrawRadialRectangle, angle);
}
public void DrawRadial(ColorBlend blend, int x, int y, int width, int height, int cx, int cy)
{
this.DrawRadialRectangle = new Rectangle(x, y, width, height);
this.DrawRadial(blend, this.DrawRadialRectangle, cx, cy);
}
protected void DrawText(Brush b1, Point p1)
{
if (this.Text.Length != 0)
{
this.G.DrawString(this.Text, this.Font, b1, (PointF)p1);
}
}
protected void DrawText(Brush b1, int x, int y)
{
if (this.Text.Length != 0)
{
this.G.DrawString(this.Text, this.Font, b1, (float)x, (float)y);
}
}
protected void DrawText(Brush b1, HorizontalAlignment a, int x, int y)
{
this.DrawText(b1, this.Text, a, x, y);
}
protected void DrawText(Brush b1, string text, HorizontalAlignment a, int x, int y)
{
if (text.Length != 0)
{
this.DrawTextSize = this.Measure(text);
this.DrawTextPoint = this.Center(this.DrawTextSize);
switch (a)
{
case HorizontalAlignment.Left:
this.G.DrawString(text, this.Font, b1, (float)x, (float)(this.DrawTextPoint.Y + y));
break;
case HorizontalAlignment.Right:
this.G.DrawString(text, this.Font, b1, (float)((this.Width - this.DrawTextSize.Width) - x), (float)(this.DrawTextPoint.Y + y));
break;
case HorizontalAlignment.Center:
this.G.DrawString(text, this.Font, b1, (float)(this.DrawTextPoint.X + x), (float)(this.DrawTextPoint.Y + y));
break;
}
}
}
protected SolidBrush GetBrush(string name)
{
return new SolidBrush(this.Items[name]);
}
protected Color GetColor(string name)
{
return this.Items[name];
}
protected Pen GetPen(string name)
{
return new Pen(this.Items[name]);
}
protected Pen GetPen(string name, float width)
{
return new Pen(this.Items[name], width);
}
private void InvalidateBitmap()
{
if ((this.Width != 0) && (this.Height != 0))
{
this.B = new Bitmap(this.Width, this.Height, PixelFormat.Format32bppPArgb);
this.G = Graphics.FromImage(this.B);
}
}
private void InvalidateCustimization()
{
MemoryStream stream = new MemoryStream(this.Items.Count * 4);
foreach (Bloom bloom in this.Colors)
{
stream.Write(BitConverter.GetBytes(bloom.Value.ToArgb()), 0, 4);
}
stream.Close();
this._Customization = Convert.ToBase64String(stream.ToArray());
}
private void InvalidateTimer()
{
if (!this.DesignMode && this.DoneCreation)
{
if (this._IsAnimated)
{
ThemeShare.AddAnimationCallback(new ThemeShare.AnimationDelegate(this.DoAnimation));
}
else
{
ThemeShare.RemoveAnimationCallback(new ThemeShare.AnimationDelegate(this.DoAnimation));
}
}
}
protected Size Measure()
{
return this.MeasureGraphics.MeasureString(this.Text, this.Font, this.Width).ToSize();
}
protected Size Measure(string text)
{
return this.MeasureGraphics.MeasureString(text, this.Font, this.Width).ToSize();
}
protected Point Offset(Point p, int amount)
{
this.OffsetReturnPoint = new Point(p.X + amount, p.Y + amount);
return this.OffsetReturnPoint;
}
protected Rectangle Offset(Rectangle r, int amount)
{
this.OffsetReturnRectangle = new Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2));
return this.OffsetReturnRectangle;
}
protected Size Offset(Size s, int amount)
{
this.OffsetReturnSize = new Size(s.Width + amount, s.Height + amount);
return this.OffsetReturnSize;
}
protected virtual void OnAnimation()
{
}
protected virtual void OnCreation()
{
}
protected override void OnEnabledChanged(EventArgs e)
{
if (this.Enabled)
{
this.SetState(MouseState.None);
}
else
{
this.SetState(MouseState.Block);
}
base.OnEnabledChanged(e);
}
protected sealed override void OnHandleCreated(EventArgs e)
{
this.InvalidateCustimization();
this.ColorHook();
if (this._LockWidth != 0)
{
this.Width = this._LockWidth;
}
if (this._LockHeight != 0)
{
this.Height = this._LockHeight;
}
this.Transparent = this._Transparent;
if (this._Transparent && this._BackColor)
{
this.BackColor = Color.Transparent;
}
base.OnHandleCreated(e);
}
protected override void OnHandleDestroyed(EventArgs e)
{
ThemeShare.RemoveAnimationCallback(new ThemeShare.AnimationDelegate(this.DoAnimation));
base.OnHandleDestroyed(e);
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.SetState(MouseState.Down);
}
base.OnMouseDown(e);
}
protected override void OnMouseEnter(EventArgs e)
{
this.InPosition = true;
this.SetState(MouseState.Over);
base.OnMouseEnter(e);
}
protected override void OnMouseLeave(EventArgs e)
{
this.InPosition = false;
this.SetState(MouseState.None);
base.OnMouseLeave(e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
if (this.InPosition)
{
this.SetState(MouseState.Over);
}
base.OnMouseUp(e);
}
protected sealed override void OnPaint(PaintEventArgs e)
{
if ((this.Width != 0) && (this.Height != 0))
{
if (this._Transparent)
{
this.PaintHook();
e.Graphics.DrawImage(this.B, 0, 0);
}
else
{
this.G = e.Graphics;
this.PaintHook();
}
}
}
protected sealed override void OnParentChanged(EventArgs e)
{
if (this.Parent != null)
{
this.OnCreation();
this.DoneCreation = true;
this.InvalidateTimer();
}
base.OnParentChanged(e);
}
protected sealed override void OnSizeChanged(EventArgs e)
{
if (this._Transparent)
{
this.InvalidateBitmap();
}
this.Invalidate();
base.OnSizeChanged(e);
}
protected abstract void PaintHook();
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
{
if (this._LockWidth != 0)
{
width = this._LockWidth;
}
if (this._LockHeight != 0)
{
height = this._LockHeight;
}
base.SetBoundsCore(x, y, width, height, specified);
}
protected void SetColor(string name, Color value)
{
if (this.Items.ContainsKey(name))
{
this.Items[name] = value;
}
else
{
this.Items.Add(name, value);
}
}
protected void SetColor(string name, byte a, Color value)
{
this.SetColor(name, Color.FromArgb(a, value));
}
protected void SetColor(string name, byte r, byte g, byte b)
{
this.SetColor(name, Color.FromArgb(r, g, b));
}
protected void SetColor(string name, byte a, byte r, byte g, byte b)
{
this.SetColor(name, Color.FromArgb(a, r, g, b));
}
private void SetState(MouseState current)
{
this.State = current;
this.Invalidate();
}
[Category("Misc")]
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
if (!this.IsHandleCreated && (value == Color.Transparent))
{
this._BackColor = true;
}
else
{
base.BackColor = value;
if (this.Parent != null)
{
this.ColorHook();
}
}
}
}
[browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public override System.Drawing.Image BackgroundImage
{
get
{
return null;
}
set
{
}
}
[browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
public override ImageLayout BackgroundImageLayout
{
get
{
return ImageLayout.None;
}
set
{
}
}
public Bloom[] Colors
{
get
{
List list = new List();
Dictionary.Enumerator enumerator = this.Items.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair current = enumerator.Current;
KeyValuePair pair2 = enumerator.Current;
Bloom item = new Bloom(current.Key, pair2.Value);
list.Add(item);
}
return list.ToArray();
}
set
{
foreach (Bloom bloom in value)
{
if (this.Items.ContainsKey(bloom.Name))
{
this.Items[bloom.Name] = bloom.Value;
}
}
this.InvalidateCustimization();
this.ColorHook();
this.Invalidate();
}
}
public string Customization
{
get
{
return this._Customization;
}
set
{
if (value != this._Customization)
{
Bloom[] colors = this.Colors;
try
{
byte[] buffer = Convert.FromBase64String(value);
int num = colors.Length - 1;
for (int i = 0; i {
colors[i].Value = Color.FromArgb(BitConverter.ToInt32(buffer, i * 4));
}
}
catch
{
}
this._Customization = value;
this.Colors = colors;
this.ColorHook();
this.Invalidate();
}
}
}
public override System.Drawing.Font Font
{
get
{
return base.Font;
}
set
{
base.Font = value;
this.Invalidate();
}
}
[EditorBrowsable(EditorBrowsableState.Never), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public override Color ForeColor
{
get
{
return Color.Empty;
}
set
{
}
}
public System.Drawing.Image Image
{
get
{
return this._Image;
}
set
{
if (value == null)
{
this._ImageSize = Size.Empty;
}
else
{
this._ImageSize = value.Size;
}
this._Image = value;
this.Invalidate();
}
}
protected Size ImageSize
{
get
{
return this._ImageSize;
}
}
protected bool IsAnimated
{
get
{
return this._IsAnimated;
}
set
{
this._IsAnimated = value;
this.InvalidateTimer();
}
}
protected int LockHeight
{
get
{
return this._LockHeight;
}
set
{
this._LockHeight = value;
if ((this.LockHeight != 0) && this.IsHandleCreated)
{
this.Height = this.LockHeight;
}
}
}
protected int LockWidth
{
get
{
return this._LockWidth;
}
set
{
this._LockWidth = value;
if ((this.LockWidth != 0) && this.IsHandleCreated)
{
this.Width = this.LockWidth;
}
}
}
public bool NoRounding
{
get
{
return this._NoRounding;
}
set
{
this._NoRounding = value;
this.Invalidate();
}
}
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
this.Invalidate();
}
}
public bool Transparent
{
get
{
return this._Transparent;
}
set
{
this._Transparent = value;
if (this.IsHandleCreated)
{
if (!value && (this.BackColor.A != 0xff))
{
throw new Exception("Unable to change value to false while a transparent BackColor is in use.");
}
this.SetStyle(ControlStyles.Opaque, !value);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, value);
if (value)
{
this.InvalidateBitmap();
}
else
{
this.B = null;
}
this.Invalidate();
}
}
}
}
internal sealed class ThemeShare
{
private static List Callbacks = new List();
private const int FPS = 50;
private static int Frames;
private static bool Invalidate;
private const int Rate = 10;
public static PrecisionTimer ThemeTimer = new PrecisionTimer();
public static void AddAnimationCallback(AnimationDelegate callback)
{
List callbacks = Callbacks;
lock (callbacks)
{
if (!Callbacks.Contains(callback))
{
Callbacks.Add(callback);
InvalidateThemeTimer();
}
}
}
private static void HandleCallbacks(IntPtr state, bool reserve)
{
Invalidate = Frames >= 50;
if (Invalidate)
{
Frames = 0;
}
List callbacks = Callbacks;
lock (callbacks)
{
int num2 = Callbacks.Count - 1;
for (int i = 0; i {
Callbacks[i](Invalidate);
}
}
Frames += 10;
}
private static void InvalidateThemeTimer()
{
if (Callbacks.Count == 0)
{
ThemeTimer.Delete();
}
else
{
ThemeTimer.Create(0, 10, new PrecisionTimer.TimerDelegate(ThemeShare.HandleCallbacks));
}
}
public static void RemoveAnimationCallback(AnimationDelegate callback)
{
List callbacks = Callbacks;
lock (callbacks)
{
if (Callbacks.Contains(callback))
{
Callbacks.Remove(callback);
InvalidateThemeTimer();
}
}
}
public delegate void AnimationDelegate(bool invalidate);
}