Advertisement
Astekk

MephobiaTheme c#

Dec 3rd, 2014
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.99 KB | None | 0 0
  1. // Theme by Mavaamarten
  2. // Theme Base 1.5.4
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Diagnostics;
  7. using System.Text;
  8. using System.Drawing;
  9. using System.Drawing.Drawing2D;
  10. using System.Windows.Forms;
  11. using System.Runtime.CompilerServices;
  12. using System.Collections;
  13.  
  14. namespace Theme
  15. {
  16. internal partial class MephobiaTheme : ThemeContainer154
  17. {
  18. // Fields
  19. private bool _ShowIcon;
  20. private Color Accent;
  21. private Color Border;
  22. private Color TextColor;
  23. private Color TitleBottom;
  24. private Color TitleTop;
  25.  
  26. // Methods
  27. public MephobiaTheme()
  28. {
  29. this.Header = 30;
  30. this.SetColor("Titlebar Gradient Top", 0x3f, 0x3f, 0x3f);
  31. this.SetColor("Titlebar Gradient Bottom", 20, 20, 20);
  32. this.SetColor("Text", 170, 170, 170);
  33. this.SetColor("Accent", 180, 0x1a, 0x20);
  34. this.SetColor("Border", Color.Black);
  35. this.TransparencyKey = Color.Fuchsia;
  36. this.BackColor = Color.FromArgb(30, 30, 30);
  37. this.Font = new Font("Segoe UI", 9f);
  38. }
  39.  
  40. protected override void ColorHook()
  41. {
  42. this.TitleTop = this.GetColor("Titlebar Gradient Top");
  43. this.TitleBottom = this.GetColor("Titlebar Gradient Bottom");
  44. this.TextColor = this.GetColor("Text");
  45. this.Accent = this.GetColor("Accent");
  46. this.Border = this.GetColor("Border");
  47. }
  48.  
  49. protected override void PaintHook()
  50. {
  51. base.G.Clear(this.Border);
  52. Rectangle rect = new Rectangle(1, 1, this.Width - 2, 0x23);
  53. LinearGradientBrush brush = new LinearGradientBrush(rect, this.TitleTop, this.TitleBottom, 90f);
  54. base.G.FillPath(brush, this.CreateRound(1, 1, this.Width - 2, 0x23, 7));
  55. base.G.DrawPath(new Pen(Color.FromArgb(15, Color.White), 1f), this.CreateRound(1, 1, this.Width - 3, 0x23, 7));
  56. base.G.FillPath(new SolidBrush(this.BackColor), this.CreateRound(1, 0x20, this.Width - 2, this.Height - 0x21, 7));
  57. base.G.DrawPath(new Pen(Color.FromArgb(15, Color.White), 1f), this.CreateRound(1, 0x20, this.Width - 3, this.Height - 0x22, 7));
  58. rect = new Rectangle(1, 0x20, this.Width - 2, 3);
  59. base.G.FillRectangle(new SolidBrush(this.Border), rect);
  60. Point point = new Point(1, 0x1f);
  61. Point point2 = new Point(this.Width - 2, 0x1f);
  62. base.G.DrawLine(new Pen(Color.FromArgb(15, Color.White)), point, point2);
  63. ColorBlend blend = new ColorBlend(3);
  64. blend.Colors = new Color[] { Color.Black, this.Accent, Color.Black };
  65. blend.Positions = new float[] { 0f, 0.5f, 1f };
  66. rect = new Rectangle(1, 0x21, this.Width - 2, 2);
  67. this.DrawGradient(blend, rect, 0f);
  68. point2 = new Point(1, 0x23);
  69. point = new Point(this.Width - 2, 0x23);
  70. base.G.DrawLine(new Pen(this.BackColor), point2, point);
  71. point2 = new Point(1, 0x23);
  72. point = new Point(this.Width - 2, 0x23);
  73. base.G.DrawLine(new Pen(Color.FromArgb(15, Color.White)), point2, point);
  74. if (this._ShowIcon)
  75. {
  76. rect = new Rectangle(11, 8, 0x10, 0x10);
  77. base.G.DrawIcon(this.FindForm().Icon, rect);
  78. point2 = new Point(0x20, 8);
  79. base.G.DrawString(this.FindForm().Text, this.Font, new SolidBrush(this.TextColor), (PointF)point2);
  80. }
  81. else
  82. {
  83. point2 = new Point(13, 8);
  84. base.G.DrawString(this.FindForm().Text, this.Font, new SolidBrush(this.TextColor), (PointF)point2);
  85. }
  86. this.DrawPixel(Color.Fuchsia, 0, 0);
  87. this.DrawPixel(Color.Fuchsia, 1, 0);
  88. this.DrawPixel(Color.Fuchsia, 2, 0);
  89. this.DrawPixel(Color.Fuchsia, 3, 0);
  90. this.DrawPixel(Color.Fuchsia, 0, 1);
  91. this.DrawPixel(Color.Fuchsia, 0, 2);
  92. this.DrawPixel(Color.Fuchsia, 0, 3);
  93. this.DrawPixel(Color.Fuchsia, 1, 1);
  94. this.DrawPixel(Color.Fuchsia, this.Width - 1, 0);
  95. this.DrawPixel(Color.Fuchsia, this.Width - 2, 0);
  96. this.DrawPixel(Color.Fuchsia, this.Width - 3, 0);
  97. this.DrawPixel(Color.Fuchsia, this.Width - 4, 0);
  98. this.DrawPixel(Color.Fuchsia, this.Width - 1, 1);
  99. this.DrawPixel(Color.Fuchsia, this.Width - 1, 2);
  100. this.DrawPixel(Color.Fuchsia, this.Width - 1, 3);
  101. this.DrawPixel(Color.Fuchsia, this.Width - 2, 1);
  102. this.DrawPixel(Color.Fuchsia, 0, this.Height);
  103. this.DrawPixel(Color.Fuchsia, 1, this.Height);
  104. this.DrawPixel(Color.Fuchsia, 2, this.Height);
  105. this.DrawPixel(Color.Fuchsia, 3, this.Height);
  106. this.DrawPixel(Color.Fuchsia, 0, this.Height - 1);
  107. this.DrawPixel(Color.Fuchsia, 0, this.Height - 2);
  108. this.DrawPixel(Color.Fuchsia, 0, this.Height - 3);
  109. this.DrawPixel(Color.Fuchsia, 1, this.Height - 1);
  110. this.DrawPixel(Color.Fuchsia, this.Width - 1, this.Height);
  111. this.DrawPixel(Color.Fuchsia, this.Width - 2, this.Height);
  112. this.DrawPixel(Color.Fuchsia, this.Width - 3, this.Height);
  113. this.DrawPixel(Color.Fuchsia, this.Width - 4, this.Height);
  114. this.DrawPixel(Color.Fuchsia, this.Width - 1, this.Height - 1);
  115. this.DrawPixel(Color.Fuchsia, this.Width - 1, this.Height - 2);
  116. this.DrawPixel(Color.Fuchsia, this.Width - 1, this.Height - 3);
  117. this.DrawPixel(Color.Fuchsia, this.Width - 2, this.Height - 1);
  118. }
  119.  
  120. // Properties
  121. public bool ShowIcon
  122. {
  123. get
  124. {
  125. return this._ShowIcon;
  126. }
  127. set
  128. {
  129. this._ShowIcon = value;
  130. this.Invalidate();
  131. }
  132. }
  133. }
  134.  
  135. internal class MephobiaButton : ThemeControl154
  136. {
  137. // Fields
  138. private Color G1;
  139. private Color G2;
  140. private Color TC;
  141.  
  142. // Methods
  143. public MephobiaButton()
  144. {
  145. this.SetColor("Gradient Top", 40, 40, 40);
  146. this.SetColor("Gradient Bottom", 20, 20, 20);
  147. this.SetColor("Text", 170, 170, 170);
  148. }
  149.  
  150. protected override void ColorHook()
  151. {
  152. this.G1 = this.GetColor("Gradient Top");
  153. this.G2 = this.GetColor("Gradient Bottom");
  154. this.TC = this.GetColor("Text");
  155. }
  156.  
  157. protected override void PaintHook()
  158. {
  159. Rectangle rectangle;
  160. base.G.Clear(this.BackColor);
  161. base.G.SmoothingMode = SmoothingMode.HighQuality;
  162. switch (base.State)
  163. {
  164. case MouseState.None:
  165. {
  166. rectangle = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
  167. LinearGradientBrush brush = new LinearGradientBrush(rectangle, this.G1, this.G2, 90f);
  168. base.G.FillPath(brush, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  169. base.G.DrawPath(Pens.Black, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  170. base.G.DrawPath(new Pen(Color.FromArgb(15, Color.White)), this.CreateRound(1, 1, this.Width - 3, this.Height - 3, 5));
  171. break;
  172. }
  173. case MouseState.Over:
  174. {
  175. rectangle = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
  176. LinearGradientBrush brush2 = new LinearGradientBrush(rectangle, this.G1, this.G2, 90f);
  177. base.G.FillPath(brush2, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  178. base.G.FillPath(new SolidBrush(Color.FromArgb(7, Color.White)), this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  179. base.G.DrawPath(Pens.Black, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  180. base.G.DrawPath(new Pen(Color.FromArgb(15, Color.White)), this.CreateRound(1, 1, this.Width - 3, this.Height - 3, 5));
  181. break;
  182. }
  183. case MouseState.Down:
  184. {
  185. rectangle = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
  186. LinearGradientBrush brush3 = new LinearGradientBrush(rectangle, this.G1, this.G2, 90f);
  187. base.G.FillPath(brush3, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  188. base.G.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  189. base.G.DrawPath(Pens.Black, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  190. base.G.DrawPath(new Pen(Color.FromArgb(15, Color.White)), this.CreateRound(1, 1, this.Width - 3, this.Height - 3, 5));
  191. break;
  192. }
  193. }
  194. rectangle = new Rectangle(0, 0, this.Width - 1, this.Height);
  195. StringFormat format = new StringFormat
  196. {
  197. Alignment = StringAlignment.Center,
  198. LineAlignment = StringAlignment.Center
  199. };
  200. base.G.DrawString(this.Text, this.Font, new SolidBrush(this.TC), rectangle, format);
  201. }
  202. }
  203.  
  204. [DefaultEvent("CheckedChanged")]
  205. internal class MephobiaCheckBox : ThemeControl154
  206. {
  207. // Fields
  208. private bool _Checked;
  209. private Color Border;
  210. private Color C1;
  211. private Color C2;
  212. private CheckedChangedEventHandler CheckedChangedEvent;
  213. private Color Glow;
  214. private Color TC;
  215. private Color UC1;
  216. private Color UC2;
  217. private int X;
  218.  
  219. // Events
  220. public event CheckedChangedEventHandler CheckedChanged;
  221.  
  222. // Methods
  223. public MephobiaCheckBox()
  224. {
  225. this.LockHeight = 0x10;
  226. this.SetColor("Border", Color.Black);
  227. this.SetColor("Checked1", 180, 0x1a, 0x20);
  228. this.SetColor("Checked2", 200, 180, 0x1a, 0x20);
  229. this.SetColor("Unchecked1", 30, 30, 30);
  230. this.SetColor("Unchecked2", 0x19, 0x19, 0x19);
  231. this.SetColor("Glow", 15, Color.White);
  232. this.SetColor("Text", 170, 170, 170);
  233. }
  234.  
  235.  
  236.  
  237. protected override void ColorHook()
  238. {
  239. this.C1 = this.GetColor("Checked1");
  240. this.C2 = this.GetColor("Checked2");
  241. this.UC1 = this.GetColor("Unchecked1");
  242. this.UC2 = this.GetColor("Unchecked2");
  243. this.Border = this.GetColor("Border");
  244. this.Glow = this.GetColor("Glow");
  245. this.TC = this.GetColor("Text");
  246. }
  247.  
  248. protected override void OnMouseDown(MouseEventArgs e)
  249. {
  250. this._Checked = !this._Checked;
  251. CheckedChangedEventHandler checkedChangedEvent = this.CheckedChangedEvent;
  252. if (checkedChangedEvent != null)
  253. {
  254. checkedChangedEvent(this);
  255. }
  256. base.OnMouseDown(e);
  257. }
  258.  
  259. protected override void OnMouseMove(MouseEventArgs e)
  260. {
  261. base.OnMouseMove(e);
  262. this.X = e.Location.X;
  263. this.Invalidate();
  264. }
  265.  
  266. protected override void PaintHook()
  267. {
  268. base.G.Clear(this.BackColor);
  269. if (this._Checked)
  270. {
  271. this.DrawGradient(this.C1, this.C2, 1, 1, 14, 14);
  272. Point point = new Point(-3, -1);
  273. base.G.DrawString("a", new Font("Marlett", 13f), Brushes.Black, (PointF)point);
  274. }
  275. else
  276. {
  277. this.DrawGradient(this.UC1, this.UC2, 1, 1, 14, 14, 90f);
  278. }
  279. if ((base.State == MouseState.Over) & (this.X < 0x10))
  280. {
  281. if (this._Checked)
  282. {
  283. base.G.FillRectangle(new SolidBrush(this.Glow), 1, 1, 14, 14);
  284. }
  285. else
  286. {
  287. base.G.FillRectangle(new SolidBrush(Color.FromArgb(10, this.Glow)), 1, 1, 14, 14);
  288. }
  289. }
  290. this.DrawBorders(new Pen(this.Border), 0, 0, 0x10, 0x10, 1);
  291. this.DrawText(new SolidBrush(this.TC), HorizontalAlignment.Left, 20, 0);
  292. }
  293.  
  294. // Properties
  295. public bool Checked
  296. {
  297. get
  298. {
  299. return this._Checked;
  300. }
  301. set
  302. {
  303. this._Checked = value;
  304. this.Invalidate();
  305. }
  306. }
  307.  
  308. // Nested Types
  309. public delegate void CheckedChangedEventHandler(object sender);
  310. }
  311.  
  312. internal class MephobiaComboBox : ComboBox
  313. {
  314. // Fields
  315. private GraphicsPath CreateRoundPath;
  316. private Rectangle CreateRoundRectangle;
  317. private int X;
  318.  
  319. // Methods
  320. public MephobiaComboBox()
  321. {
  322. base.DropDownClosed += new EventHandler(this.GhostComboBox_DropDownClosed);
  323. base.TextChanged += new EventHandler(this.GhostCombo_TextChanged);
  324. this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
  325. this.ForeColor = Color.FromArgb(170, 170, 170);
  326. this.BackColor = Color.FromArgb(30, 30, 30);
  327. this.DrawMode = DrawMode.OwnerDrawFixed;
  328. this.ItemHeight = 0x11;
  329. this.DropDownStyle = ComboBoxStyle.DropDownList;
  330. }
  331.  
  332.  
  333.  
  334. public GraphicsPath CreateRound(Rectangle r, int slope)
  335. {
  336. this.CreateRoundPath = new GraphicsPath(FillMode.Winding);
  337. this.CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
  338. this.CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
  339. this.CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
  340. this.CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
  341. this.CreateRoundPath.CloseFigure();
  342. return this.CreateRoundPath;
  343. }
  344.  
  345. public GraphicsPath CreateRound(int x, int y, int width, int height, int slope)
  346. {
  347. this.CreateRoundRectangle = new Rectangle(x, y, width, height);
  348. return this.CreateRound(this.CreateRoundRectangle, slope);
  349. }
  350.  
  351. private void GhostCombo_TextChanged(object sender, EventArgs e)
  352. {
  353. this.Invalidate();
  354. }
  355.  
  356. private void GhostComboBox_DropDownClosed(object sender, EventArgs e)
  357. {
  358. this.DropDownStyle = ComboBoxStyle.Simple;
  359. Application.DoEvents();
  360. this.DropDownStyle = ComboBoxStyle.DropDownList;
  361. }
  362.  
  363. protected override void OnDrawItem(DrawItemEventArgs e)
  364. {
  365. if (e.Index >= 0)
  366. {
  367. Rectangle rectangle = new Rectangle
  368. {
  369. X = e.Bounds.X,
  370. Y = e.Bounds.Y,
  371. Width = e.Bounds.Width - 1,
  372. Height = e.Bounds.Height - 1
  373. };
  374. e.DrawBackground();
  375. if ((e.State == (DrawItemState.NoFocusRect | DrawItemState.NoAccelerator | DrawItemState.Focus | DrawItemState.Selected)) | (e.State == (DrawItemState.Focus | DrawItemState.Selected)))
  376. {
  377. e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(70, 70, 70)), e.Bounds);
  378. e.Graphics.DrawString(this.Items[e.Index].ToString(), e.Font, Brushes.White, (float)e.Bounds.X, (float)e.Bounds.Y);
  379. }
  380. else
  381. {
  382. e.Graphics.FillRectangle(new SolidBrush(this.BackColor), e.Bounds);
  383. e.Graphics.DrawString(this.Items[e.Index].ToString(), e.Font, Brushes.White, (float)e.Bounds.X, (float)e.Bounds.Y);
  384. }
  385. base.OnDrawItem(e);
  386. }
  387. }
  388.  
  389. protected override void OnDropDownClosed(EventArgs e)
  390. {
  391. base.OnDropDownClosed(e);
  392. this.X = -1;
  393. this.Invalidate();
  394. }
  395.  
  396. protected override void OnMouseLeave(EventArgs e)
  397. {
  398. base.OnMouseLeave(e);
  399. this.X = -1;
  400. this.Invalidate();
  401. }
  402.  
  403. protected override void OnMouseMove(MouseEventArgs e)
  404. {
  405. base.OnMouseMove(e);
  406. this.X = e.Location.X;
  407. this.Invalidate();
  408. }
  409.  
  410. protected override void OnPaint(PaintEventArgs e)
  411. {
  412. if (this.DropDownStyle != ComboBoxStyle.DropDownList)
  413. {
  414. this.DropDownStyle = ComboBoxStyle.DropDownList;
  415. }
  416. Bitmap image = new Bitmap(this.Width, this.Height);
  417. Graphics graphics = Graphics.FromImage(image);
  418. graphics.Clear(this.BackColor);
  419. Rectangle rect = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
  420. LinearGradientBrush brush = new LinearGradientBrush(rect, Color.FromArgb(40, 40, 40), Color.FromArgb(20, 20, 20), 90f);
  421. graphics.FillPath(brush, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  422. if (this.X > (this.Width - 0x1a))
  423. {
  424. rect = new Rectangle(this.Width - 0x19, 2, 0x18, this.Height - 4);
  425. graphics.FillRectangle(new SolidBrush(Color.FromArgb(5, Color.White)), rect);
  426. }
  427. graphics.DrawPath(Pens.Black, this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 5));
  428. graphics.DrawPath(new Pen(Color.FromArgb(15, Color.White)), this.CreateRound(1, 1, this.Width - 3, this.Height - 3, 5));
  429. Point point = new Point(this.Width - 0x19, 0);
  430. Point point2 = new Point(this.Width - 0x19, this.Height);
  431. graphics.DrawLine(Pens.Black, point, point2);
  432. point2 = new Point(this.Width - 0x18, 2);
  433. point = new Point(this.Width - 0x18, this.Height - 3);
  434. graphics.DrawLine(new Pen(Color.FromArgb(15, Color.White)), point2, point);
  435. point2 = new Point(this.Width - 0x1a, 2);
  436. point = new Point(this.Width - 0x1a, this.Height - 3);
  437. graphics.DrawLine(new Pen(Color.FromArgb(15, Color.White)), point2, point);
  438. int num = (int)Math.Round((double)graphics.MeasureString(" ... ", this.Font).Height);
  439. if (this.SelectedIndex != -1)
  440. {
  441. graphics.DrawString((this.Items[this.SelectedIndex]).ToString(), this.Font, new SolidBrush(this.ForeColor), 4f, (float)((this.Height / 2) - (num / 2)));
  442. }
  443. else if ((this.Items != null) & (this.Items.Count > 0))
  444. {
  445. graphics.DrawString((this.Items[0]).ToString(), this.Font, new SolidBrush(this.ForeColor), 4f, (float)((this.Height / 2) - (num / 2)));
  446. }
  447. else
  448. {
  449. graphics.DrawString(" ... ", this.Font, new SolidBrush(this.ForeColor), 4f, (float)((this.Height / 2) - (num / 2)));
  450. }
  451. graphics.SmoothingMode = SmoothingMode.HighQuality;
  452. Point[] pointArray = new Point[3];
  453. point2 = new Point(this.Width - 0x12, 9);
  454. pointArray[0] = point2;
  455. point = new Point(this.Width - 10, 9);
  456. pointArray[1] = point;
  457. Point point3 = new Point(this.Width - 14, 14);
  458. pointArray[2] = point3;
  459. Point[] points = pointArray;
  460. graphics.FillPolygon(new SolidBrush(Color.FromArgb(170, 170, 170)), points);
  461. e.Graphics.DrawImage((Image)image.Clone(), 0, 0);
  462.  
  463. graphics.Dispose();
  464. image.Dispose();
  465. }
  466.  
  467. public Point[] Triangle(Point Location, Size Size)
  468. {
  469. return new Point[] { Location, new Point(Location.X + Size.Width, Location.Y), new Point(Location.X + (Size.Width / 2), Location.Y + Size.Height), Location };
  470. }
  471. }
  472.  
  473. internal class MephobiaControlBox_TwoButtons : ThemeControl154
  474. {
  475. // Fields
  476. private Color G1;
  477. private Color G2;
  478. private Color G3;
  479. private Color I;
  480. private Color O;
  481. private int X;
  482.  
  483. // Methods
  484. public MephobiaControlBox_TwoButtons()
  485. {
  486. this.SetColor("Gradient Top", 0x3e, 0x3e, 0x3e);
  487. this.SetColor("Gradient Middle", 0x2c, 0x2c, 0x2c);
  488. this.SetColor("Gradient Bottom", 0x1b, 0x1b, 0x1b);
  489. this.SetColor("Icons", 170, 170, 170);
  490. this.SetColor("Outline", 90, Color.Black);
  491. Size size = new Size(0x35, 0x1c);
  492. this.Size = size;
  493. this.Anchor = AnchorStyles.Right | AnchorStyles.Top;
  494. }
  495.  
  496. protected override void ColorHook()
  497. {
  498. this.G1 = this.GetColor("Gradient Top");
  499. this.G2 = this.GetColor("Gradient Middle");
  500. this.G3 = this.GetColor("Gradient Bottom");
  501. this.I = this.GetColor("Icons");
  502. this.O = this.GetColor("Outline");
  503. }
  504.  
  505. protected override void OnClick(EventArgs e)
  506. {
  507. base.OnClick(e);
  508. if (this.X < 30)
  509. {
  510. this.FindForm().WindowState = FormWindowState.Minimized;
  511. }
  512. else if (this.X > 30)
  513. {
  514. this.FindForm().Close();
  515. }
  516. }
  517.  
  518. protected override void OnLocationChanged(EventArgs e)
  519. {
  520. base.OnLocationChanged(e);
  521. this.Top = 2;
  522. }
  523.  
  524. protected override void OnMouseMove(MouseEventArgs e)
  525. {
  526. base.OnMouseMove(e);
  527. this.X = e.Location.X;
  528. this.Invalidate();
  529. }
  530.  
  531. protected override void PaintHook()
  532. {
  533. base.G.Clear(this.BackColor);
  534. Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
  535. LinearGradientBrush brush = new LinearGradientBrush(rect, this.G1, this.G2, 90f);
  536. ColorBlend blend = new ColorBlend(3);
  537. blend.Colors = new Color[] { this.G1, this.G2, this.G3 };
  538. blend.Positions = new float[] { 0f, 0.5f, 1f };
  539. brush.InterpolationColors = blend;
  540. rect = new Rectangle(0, 0, this.Width, this.Height);
  541. base.G.FillRectangle(brush, rect);
  542. base.G.SmoothingMode = SmoothingMode.HighQuality;
  543. if (base.State == MouseState.Over)
  544. {
  545. if (this.X < 30)
  546. {
  547. base.G.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), this.CreateRound(4, 4, 0x16, 0x12, 6));
  548. base.G.DrawPath(new Pen(this.O), this.CreateRound(4, 4, 0x16, 0x12, 6));
  549. }
  550. else if (this.X > 30)
  551. {
  552. base.G.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), this.CreateRound(0x1b, 4, 0x17, 0x12, 6));
  553. base.G.DrawPath(new Pen(this.O), this.CreateRound(0x1b, 4, 0x17, 0x12, 6));
  554. }
  555. }
  556. else if (base.State == MouseState.Down)
  557. {
  558. if (this.X < 30)
  559. {
  560. base.G.FillPath(new SolidBrush(Color.FromArgb(70, Color.Black)), this.CreateRound(4, 4, 0x16, 0x12, 6));
  561. base.G.DrawPath(new Pen(this.O), this.CreateRound(4, 4, 0x16, 0x12, 6));
  562. }
  563. else if (this.X > 30)
  564. {
  565. base.G.FillPath(new SolidBrush(Color.FromArgb(70, Color.Black)), this.CreateRound(0x1b, 4, 0x17, 0x12, 6));
  566. base.G.DrawPath(new Pen(this.O), this.CreateRound(0x1b, 4, 0x17, 0x12, 6));
  567. }
  568. }
  569. Point point = new Point(8, 7);
  570. base.G.DrawString("0", new Font("Marlett", 10f), new SolidBrush(this.I), (PointF)point);
  571. point = new Point(0x1f, 7);
  572. base.G.DrawString("r", new Font("Marlett", 10f), new SolidBrush(this.I), (PointF)point);
  573. }
  574. }
  575.  
  576. internal class MephobiaGroupBox : ThemeContainer154
  577. {
  578. // Fields
  579. private Color B;
  580. private Color G1;
  581. private Color G2;
  582. private Color TC;
  583.  
  584. // Methods
  585. public MephobiaGroupBox()
  586. {
  587. this.ControlMode = true;
  588. this.SetColor("Gradient Top", 40, 40, 40);
  589. this.SetColor("Gradient Bottom", 20, 20, 20);
  590. this.SetColor("Text", 170, 170, 170);
  591. this.SetColor("Border", Color.Black);
  592. }
  593.  
  594. protected override void ColorHook()
  595. {
  596. this.G1 = this.GetColor("Gradient Top");
  597. this.G2 = this.GetColor("Gradient Bottom");
  598. this.TC = this.GetColor("Text");
  599. this.B = this.GetColor("Border");
  600. }
  601.  
  602. protected override void PaintHook()
  603. {
  604. base.G.Clear(this.BackColor);
  605. base.G.SmoothingMode = SmoothingMode.HighQuality;
  606. base.G.DrawPath(new Pen(this.B), this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 7));
  607. Rectangle rect = new Rectangle(0, 0, this.Width - 1, 0x1b);
  608. LinearGradientBrush brush = new LinearGradientBrush(rect, this.G1, this.G2, 90f);
  609. base.G.FillPath(brush, this.CreateRound(0, 0, this.Width - 1, 0x1b, 7));
  610. base.G.DrawPath(new Pen(this.B), this.CreateRound(0, 0, this.Width - 1, 0x1b, 7));
  611. base.G.SmoothingMode = SmoothingMode.None;
  612. rect = new Rectangle(1, 0x18, this.Width - 2, 10);
  613. base.G.FillRectangle(new SolidBrush(this.BackColor), rect);
  614. Point point = new Point(0, 0x18);
  615. Point point2 = new Point(this.Width, 0x18);
  616. base.G.DrawLine(new Pen(this.B), point, point2);
  617. point2 = new Point(2, 0x17);
  618. point = new Point(this.Width - 3, 0x17);
  619. base.G.DrawLine(new Pen(Color.FromArgb(15, Color.White)), point2, point);
  620. point2 = new Point(7, 5);
  621. base.G.DrawString(this.Text, this.Font, new SolidBrush(this.TC), (PointF)point2);
  622. base.G.SmoothingMode = SmoothingMode.HighQuality;
  623. base.G.DrawPath(new Pen(Color.FromArgb(15, Color.White)), this.CreateRound(1, 1, this.Width - 3, this.Height - 3, 7));
  624. }
  625. }
  626.  
  627. internal class MephobiaListbox : ListBox
  628. {
  629. // Fields
  630.  
  631. // Methods
  632. public MephobiaListbox()
  633. {
  634. this.SetStyle(ControlStyles.DoubleBuffer, true);
  635. this.BorderStyle = BorderStyle.None;
  636. this.DrawMode = DrawMode.OwnerDrawFixed;
  637. this.ItemHeight = 20;
  638. this.ForeColor = Color.FromArgb(170, 170, 170);
  639. this.BackColor = Color.FromArgb(0x16, 0x16, 0x16);
  640. this.IntegralHeight = false;
  641. }
  642.  
  643.  
  644. public void CustomPaint()
  645. {
  646. Rectangle rect = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
  647. this.CreateGraphics().DrawRectangle(Pens.Black, rect);
  648. rect = new Rectangle(1, 1, this.Width - 3, this.Height - 3);
  649. this.CreateGraphics().DrawRectangle(new Pen(Color.FromArgb(0x2b, 0x2b, 0x2b)), rect);
  650. rect = new Rectangle(0, 0, 1, 1);
  651. this.CreateGraphics().FillRectangle(new SolidBrush(this.BackColor), rect);
  652. rect = new Rectangle(this.Width - 1, this.Height - 1, 1, 1);
  653. this.CreateGraphics().FillRectangle(new SolidBrush(this.BackColor), rect);
  654. rect = new Rectangle(0, this.Height - 1, 1, 1);
  655. this.CreateGraphics().FillRectangle(new SolidBrush(this.BackColor), rect);
  656. rect = new Rectangle(this.Width - 1, 0, 1, 1);
  657. this.CreateGraphics().FillRectangle(new SolidBrush(this.BackColor), rect);
  658. }
  659.  
  660. protected override void OnDrawItem(DrawItemEventArgs e)
  661. {
  662. try
  663. {
  664. if (e.Index >= 0)
  665. {
  666. Rectangle bounds;
  667. e.DrawBackground();
  668. Point location = new Point(e.Bounds.Left, e.Bounds.Top + 2);
  669. Size size = new Size(this.Bounds.Width, 0x10);
  670. Rectangle rectangle = new Rectangle(location, size);
  671. e.DrawFocusRectangle();
  672. if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
  673. {
  674. Point point2 = new Point(e.Bounds.Location.X + 2, e.Bounds.Location.Y);
  675. size = new Size(e.Bounds.Width - 4, e.Bounds.Height);
  676. Rectangle rect = new Rectangle(point2, size);
  677. LinearGradientBrush brush = new LinearGradientBrush(rect, Color.FromArgb(170, 15, 0x16), Color.FromArgb(130, 15, 0x16), 90f);
  678. e.Graphics.FillRectangle(new SolidBrush(this.BackColor), e.Bounds);
  679. e.Graphics.FillRectangle(brush, rect);
  680. brush.Dispose();
  681. bounds = e.Bounds;
  682. e.Graphics.DrawString(" " + this.Items[e.Index].ToString(), this.Font, Brushes.White, (float)e.Bounds.X, (float)(bounds.Y + 1));
  683. }
  684. else
  685. {
  686. bounds = e.Bounds;
  687. e.Graphics.DrawString(" " + this.Items[e.Index].ToString(), this.Font, new SolidBrush(this.ForeColor), (float)e.Bounds.X, (float)(bounds.Y + 1));
  688. }
  689. bounds = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
  690. e.Graphics.DrawRectangle(Pens.Black, bounds);
  691. bounds = new Rectangle(1, 1, this.Width - 3, this.Height - 3);
  692. e.Graphics.DrawRectangle(new Pen(Color.FromArgb(0x2b, 0x2b, 0x2b)), bounds);
  693. bounds = new Rectangle(0, 0, 1, 1);
  694. e.Graphics.FillRectangle(new SolidBrush(this.BackColor), bounds);
  695. bounds = new Rectangle(this.Width - 1, this.Height - 1, 1, 1);
  696. e.Graphics.FillRectangle(new SolidBrush(this.BackColor), bounds);
  697. bounds = new Rectangle(0, this.Height - 1, 1, 1);
  698. e.Graphics.FillRectangle(new SolidBrush(this.BackColor), bounds);
  699. bounds = new Rectangle(this.Width - 1, 0, 1, 1);
  700. e.Graphics.FillRectangle(new SolidBrush(this.BackColor), bounds);
  701. base.OnDrawItem(e);
  702. }
  703. }
  704. catch { }
  705. }
  706.  
  707. protected override void WndProc(ref Message m)
  708. {
  709. base.WndProc(ref m);
  710. if (m.Msg == 15)
  711. {
  712. this.CustomPaint();
  713. }
  714. }
  715. }
  716.  
  717. internal class MephobiaProgressBar : ThemeControl154
  718. {
  719. // Fields
  720. private int _Maximum = 100;
  721. private int _Minimum;
  722. private int _Value;
  723. private Color Edge;
  724. private Color G1;
  725. private double ROffset;
  726.  
  727. // Methods
  728. public MephobiaProgressBar()
  729. {
  730. this.SetColor("Color", 180, 0x1a, 0x20);
  731. this.SetColor("Edge", Color.Black);
  732. }
  733.  
  734. protected override void ColorHook()
  735. {
  736. this.G1 = this.GetColor("Color");
  737. this.Edge = this.GetColor("Edge");
  738. }
  739.  
  740. private void Increment(int amount)
  741. {
  742. this.Value += amount;
  743. }
  744.  
  745. protected override void OnAnimation()
  746. {
  747. base.OnAnimation();
  748. if (this.ROffset < 7.0)
  749. {
  750. this.ROffset += 0.2;
  751. }
  752. else
  753. {
  754. this.ROffset = 0.0;
  755. }
  756. this.Invalidate();
  757. }
  758.  
  759. protected override void PaintHook()
  760. {
  761. Point point;
  762. base.G.Clear(this.BackColor);
  763. Rectangle rect = new Rectangle(1, 1, (int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), this.Height - 2);
  764. LinearGradientBrush brush = new LinearGradientBrush(rect, Color.FromArgb(180, this.G1), this.G1, 0f);
  765. HatchBrush brush2 = new HatchBrush(HatchStyle.ForwardDiagonal, Color.FromArgb(20, Color.Black), Color.Transparent);
  766. if (this.Value > 1)
  767. {
  768. base.G.FillPath(Brushes.Black, this.CreateRound(1, 1, (int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), this.Height - 2, 5));
  769. base.G.FillPath(brush, this.CreateRound(1, 1, (int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), this.Height - 2, 5));
  770. point = new Point((int)Math.Round(-this.ROffset), 0);
  771. base.G.RenderingOrigin = point;
  772. base.G.FillPath(brush2, this.CreateRound(1, 1, (int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), this.Height - 2, 5));
  773. point = new Point((int)Math.Round((double)(-this.ROffset + 1.0)), 0);
  774. base.G.RenderingOrigin = point;
  775. base.G.FillPath(brush2, this.CreateRound(1, 1, (int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), this.Height - 2, 5));
  776. point = new Point((int)Math.Round((double)(-this.ROffset + 2.0)), 0);
  777. base.G.RenderingOrigin = point;
  778. base.G.FillPath(brush2, this.CreateRound(1, 1, (int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), this.Height - 2, 5));
  779. base.G.FillPath(new SolidBrush(Color.FromArgb(0x23, Color.Black)), this.CreateRound(1, (int)Math.Round((double)(((double)this.Height) / 2.0)), (int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), (int)Math.Round((double)(((double)this.Height) / 2.0)), 5));
  780. }
  781. point = new Point((int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), 2);
  782. Point point2 = new Point((int)Math.Round((double)(((((double)this.Width) / ((double)this.Maximum)) * this.Value) - 1.0)), this.Height - 2);
  783. base.G.DrawLine(new Pen(this.Edge), point, point2);
  784. base.G.SmoothingMode = SmoothingMode.HighQuality;
  785. base.G.DrawPath(new Pen(this.Edge), this.CreateRound(1, 1, this.Width - 2, this.Height - 2, 5));
  786. base.G.DrawPath(new Pen(Color.FromArgb(10, Color.White)), this.CreateRound(2, 2, this.Width - 4, this.Height - 4, 5));
  787. }
  788.  
  789. // Properties
  790. public bool Animated
  791. {
  792. get
  793. {
  794. return this.IsAnimated;
  795. }
  796. set
  797. {
  798. this.IsAnimated = value;
  799. this.Invalidate();
  800. }
  801. }
  802.  
  803. public int Maximum
  804. {
  805. get
  806. {
  807. return this._Maximum;
  808. }
  809. set
  810. {
  811. if (value < 0)
  812. {
  813. throw new Exception("Property value is not valid.");
  814. }
  815. this._Maximum = value;
  816. if (value < this._Value)
  817. {
  818. this._Value = value;
  819. }
  820. if (value < this._Minimum)
  821. {
  822. this._Minimum = value;
  823. }
  824. this.Invalidate();
  825. }
  826. }
  827.  
  828. public int Minimum
  829. {
  830. get
  831. {
  832. return this._Minimum;
  833. }
  834. set
  835. {
  836. if (value < 0)
  837. {
  838. throw new Exception("Property value is not valid.");
  839. }
  840. this._Minimum = value;
  841. if (value > this._Value)
  842. {
  843. this._Value = value;
  844. }
  845. if (value > this._Maximum)
  846. {
  847. this._Maximum = value;
  848. }
  849. this.Invalidate();
  850. }
  851. }
  852.  
  853. public int Value
  854. {
  855. get
  856. {
  857. return this._Value;
  858. }
  859. set
  860. {
  861. if ((value > this._Maximum) || (value < this._Minimum))
  862. {
  863. throw new Exception("Property value is not valid.");
  864. }
  865. this._Value = value;
  866. this.Invalidate();
  867. }
  868. }
  869. }
  870.  
  871. [DefaultEvent("CheckedChanged")]
  872. internal class MephobiaRadiobutton : ThemeControl154
  873. {
  874. // Fields
  875. private CheckedChangedEventHandler CheckedChangedEvent;
  876. private bool _Checked;
  877. private Color Border;
  878. private Color C1;
  879. private Color C2;
  880. private Color Glow;
  881. private Color TC;
  882. private Color UC1;
  883. private Color UC2;
  884. private int X;
  885.  
  886. // Events
  887. public event CheckedChangedEventHandler CheckedChanged;
  888.  
  889. // Methods
  890. public MephobiaRadiobutton()
  891. {
  892. this.LockHeight = 0x10;
  893. this.SetColor("Border", Color.Black);
  894. this.SetColor("Checked1", 180, 0x1a, 0x20);
  895. this.SetColor("Checked2", 200, 180, 0x1a, 0x20);
  896. this.SetColor("Unchecked1", 30, 30, 30);
  897. this.SetColor("Unchecked2", 0x19, 0x19, 0x19);
  898. this.SetColor("Glow", 15, Color.White);
  899. this.SetColor("Text", 170, 170, 170);
  900. }
  901.  
  902.  
  903.  
  904. protected override void ColorHook()
  905. {
  906. this.C1 = this.GetColor("Checked1");
  907. this.C2 = this.GetColor("Checked2");
  908. this.UC1 = this.GetColor("Unchecked1");
  909. this.UC2 = this.GetColor("Unchecked2");
  910. this.Border = this.GetColor("Border");
  911. this.Glow = this.GetColor("Glow");
  912. this.TC = this.GetColor("Text");
  913. }
  914.  
  915. private void InvalidateControls()
  916. {
  917. if (this.IsHandleCreated && this._Checked)
  918. {
  919. IEnumerator enumerator = null;
  920. try
  921. {
  922. enumerator = this.Parent.Controls.GetEnumerator();
  923. while (enumerator.MoveNext())
  924. {
  925. Control current = (Control)enumerator.Current;
  926. if ((((current == this) || !(current is MephobiaRadiobutton)) ? 0 : 1) != 0)
  927. {
  928. ((MephobiaRadiobutton)current).Checked = false;
  929. }
  930. }
  931. }
  932. finally
  933. {
  934. if (enumerator is IDisposable)
  935. {
  936. (enumerator as IDisposable).Dispose();
  937. }
  938. }
  939. }
  940. }
  941.  
  942. protected override void OnCreation()
  943. {
  944. this.InvalidateControls();
  945. }
  946.  
  947. protected override void OnMouseDown(MouseEventArgs e)
  948. {
  949. if (!this._Checked)
  950. {
  951. this.Checked = true;
  952. }
  953. base.OnMouseDown(e);
  954. }
  955.  
  956. protected override void OnMouseMove(MouseEventArgs e)
  957. {
  958. base.OnMouseMove(e);
  959. this.X = e.Location.X;
  960. this.Invalidate();
  961. }
  962.  
  963. protected override void PaintHook()
  964. {
  965. Rectangle rectangle;
  966. Rectangle rectangle2;
  967. base.G.Clear(this.BackColor);
  968. base.G.SmoothingMode = SmoothingMode.HighQuality;
  969. if (this._Checked)
  970. {
  971. rectangle = new Rectangle(0, 0, 15, 15);
  972. rectangle2 = new Rectangle(0, 0, 15, 15);
  973. base.G.FillEllipse(new LinearGradientBrush(rectangle, this.C1, this.C2, 90f), rectangle2);
  974. }
  975. else
  976. {
  977. rectangle2 = new Rectangle(0, 0, 15, 15);
  978. rectangle = new Rectangle(0, 0, 15, 15);
  979. base.G.FillEllipse(new LinearGradientBrush(rectangle2, this.UC1, this.UC2, 90f), rectangle);
  980. }
  981. if ((base.State == MouseState.Over) & (this.X < 0x10))
  982. {
  983. if (this.Checked)
  984. {
  985. base.G.FillEllipse(new SolidBrush(this.Glow), 0, 0, 15, 15);
  986. }
  987. else
  988. {
  989. base.G.FillEllipse(new SolidBrush(Color.FromArgb(10, this.Glow)), 0, 0, 15, 15);
  990. }
  991. }
  992. rectangle2 = new Rectangle(0, 0, 15, 15);
  993. base.G.DrawEllipse(new Pen(this.Border), rectangle2);
  994. this.DrawText(new SolidBrush(this.TC), HorizontalAlignment.Left, 20, 0);
  995. }
  996.  
  997. // Properties
  998. public bool Checked
  999. {
  1000. get
  1001. {
  1002. return this._Checked;
  1003. }
  1004. set
  1005. {
  1006. this._Checked = value;
  1007. this.InvalidateControls();
  1008. CheckedChangedEventHandler checkedChangedEvent = this.CheckedChangedEvent;
  1009. if (checkedChangedEvent != null)
  1010. {
  1011. checkedChangedEvent(this);
  1012. }
  1013. this.Invalidate();
  1014. }
  1015. }
  1016.  
  1017. // Nested Types
  1018. public delegate void CheckedChangedEventHandler(object sender);
  1019. }
  1020.  
  1021. internal class MephobiaSeparator : ThemeControl154
  1022. {
  1023. // Fields
  1024. private Color Accent;
  1025. private Color Border;
  1026.  
  1027. // Methods
  1028. public MephobiaSeparator()
  1029. {
  1030. this.SetColor("Border", Color.Black);
  1031. this.SetColor("Accent", 180, 0x1a, 0x20);
  1032. this.LockHeight = 5;
  1033. }
  1034.  
  1035. protected override void ColorHook()
  1036. {
  1037. this.Border = this.GetColor("Border");
  1038. this.Accent = this.GetColor("Accent");
  1039. }
  1040.  
  1041. protected override void PaintHook()
  1042. {
  1043. base.G.Clear(this.BackColor);
  1044. Point point = new Point(0, 0);
  1045. Point point2 = new Point(this.Width, 0);
  1046. base.G.DrawLine(new Pen(Color.FromArgb(10, Color.White)), point, point2);
  1047. point2 = new Point(0, 1);
  1048. point = new Point(this.Width, 1);
  1049. base.G.DrawLine(new Pen(this.Border), point2, point);
  1050. ColorBlend blend = new ColorBlend(3);
  1051. blend.Colors = new Color[] { Color.Black, this.Accent, Color.Black };
  1052. blend.Positions = new float[] { 0f, 0.5f, 1f };
  1053. Rectangle r = new Rectangle(1, 2, this.Width - 2, 2);
  1054. this.DrawGradient(blend, r, 0f);
  1055. point2 = new Point(0, 4);
  1056. point = new Point(this.Width, 4);
  1057. base.G.DrawLine(new Pen(Color.FromArgb(10, Color.White)), point2, point);
  1058. }
  1059. }
  1060.  
  1061. internal class MephobiaTabcontrol : TabControl
  1062. {
  1063. // Fields
  1064. private Pen Border;
  1065.  
  1066. // Methods
  1067. public MephobiaTabcontrol()
  1068. {
  1069. this.Border = Pens.Black;
  1070. this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
  1071. this.DoubleBuffered = true;
  1072. this.SizeMode = TabSizeMode.Fixed;
  1073. Size size = new Size(0x2c, 0x88);
  1074. this.ItemSize = size;
  1075. }
  1076.  
  1077.  
  1078. protected override void CreateHandle()
  1079. {
  1080. base.CreateHandle();
  1081. this.Alignment = TabAlignment.Left;
  1082. }
  1083.  
  1084. protected override void OnPaint(PaintEventArgs e)
  1085. {
  1086. Rectangle tabRect;
  1087. Point point4;
  1088. Point point5;
  1089. Size size3;
  1090. StringFormat format;
  1091. Bitmap image = new Bitmap(this.Width, this.Height);
  1092. Graphics graphics = Graphics.FromImage(image);
  1093. try
  1094. {
  1095. this.SelectedTab.BackColor = Color.FromArgb(30, 30, 30);
  1096. }
  1097. catch { }
  1098. graphics.Clear(Color.FromArgb(30, 30, 30));
  1099. Point point = new Point(this.ItemSize.Height + 3, 0);
  1100. Point location = new Point(this.ItemSize.Height + 3, 0x3e7);
  1101. graphics.DrawLine(this.Border, point, location);
  1102. Size itemSize = this.ItemSize;
  1103. location = new Point(itemSize.Height + 2, 0);
  1104. point = new Point(this.ItemSize.Height + 2, 0x3e7);
  1105. graphics.DrawLine(new Pen(Color.FromArgb(15, Color.White)), location, point);
  1106. Rectangle rect = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
  1107. graphics.DrawRectangle(this.Border, rect);
  1108. rect = new Rectangle(1, 1, this.Width - 3, this.Height - 3);
  1109. graphics.DrawRectangle(new Pen(Color.FromArgb(15, Color.White)), rect);
  1110. int num = this.TabCount - 1;
  1111. int index = 0;
  1112. Label_0147:
  1113. if (index > num)
  1114. {
  1115. e.Graphics.DrawImage((Image)image.Clone(), 0, 0);
  1116. graphics.Dispose();
  1117. image.Dispose();
  1118. return;
  1119. }
  1120. if (index == this.SelectedIndex)
  1121. {
  1122. Rectangle rectangle2;
  1123. Point point3;
  1124. if (index == -1)
  1125. {
  1126. point = this.GetTabRect(index).Location;
  1127. point3 = new Point(this.GetTabRect(index).Location.X - 2, point.Y - 2);
  1128. itemSize = new Size(this.GetTabRect(index).Width + 3, this.GetTabRect(index).Height + 1);
  1129. rectangle2 = new Rectangle(point3, itemSize);
  1130. }
  1131. else
  1132. {
  1133. tabRect = this.GetTabRect(index);
  1134. point = new Point(tabRect.Location.X - 2, this.GetTabRect(index).Location.Y - 2);
  1135. itemSize = new Size(this.GetTabRect(index).Width + 3, this.GetTabRect(index).Height);
  1136. rectangle2 = new Rectangle(point, itemSize);
  1137. }
  1138. ColorBlend blend = new ColorBlend();
  1139. blend.Colors = new Color[] { Color.FromArgb(40, 40, 40), Color.FromArgb(30, 30, 30), Color.FromArgb(20, 20, 20) };
  1140. blend.Positions = new float[] { 0f, 0.5f, 1f };
  1141. LinearGradientBrush brush = new LinearGradientBrush(rectangle2, Color.Black, Color.Black, 90f)
  1142. {
  1143. InterpolationColors = blend
  1144. };
  1145. graphics.FillRectangle(brush, rectangle2);
  1146. graphics.DrawRectangle(this.Border, rectangle2);
  1147. tabRect = new Rectangle(rectangle2.Location.X + 1, rectangle2.Location.Y + 1, rectangle2.Width - 2, rectangle2.Height - 2);
  1148. graphics.DrawRectangle(new Pen(Color.FromArgb(15, Color.White)), tabRect);
  1149. location = this.GetTabRect(index).Location;
  1150. point = new Point(this.GetTabRect(index).Location.X - 2, location.Y - 2);
  1151. itemSize = new Size(this.GetTabRect(index).Width + 3, this.GetTabRect(index).Height + 1);
  1152. rectangle2 = new Rectangle(point, itemSize);
  1153. graphics.SmoothingMode = SmoothingMode.HighQuality;
  1154. Point[] pointArray = new Point[3];
  1155. itemSize = this.ItemSize;
  1156. tabRect = this.GetTabRect(index);
  1157. point3 = tabRect.Location;
  1158. location = new Point(itemSize.Height - 3, point3.Y + 20);
  1159. pointArray[0] = location;
  1160. point = this.GetTabRect(index).Location;
  1161. point4 = new Point(this.ItemSize.Height + 4, point.Y + 14);
  1162. pointArray[1] = point4;
  1163. size3 = this.ItemSize;
  1164. point5 = new Point(size3.Height + 4, this.GetTabRect(index).Location.Y + 0x1b);
  1165. pointArray[2] = point5;
  1166. Point[] points = pointArray;
  1167. graphics.DrawPolygon(new Pen(Color.FromArgb(15, Color.White), 3f), points);
  1168. graphics.FillPolygon(new SolidBrush(Color.FromArgb(30, 30, 30)), points);
  1169. graphics.DrawPolygon(this.Border, points);
  1170. if (this.ImageList != null)
  1171. {
  1172. try
  1173. {
  1174. if (this.ImageList.Images[this.TabPages[index].ImageIndex] != null)
  1175. {
  1176. point5 = rectangle2.Location;
  1177. point4 = new Point(point5.X + 8, rectangle2.Location.Y + 6);
  1178. graphics.DrawImage(this.ImageList.Images[this.TabPages[index].ImageIndex], point4);
  1179. format = new StringFormat
  1180. {
  1181. LineAlignment = StringAlignment.Center,
  1182. Alignment = StringAlignment.Center
  1183. };
  1184. graphics.DrawString(" " + this.TabPages[index].Text, this.Font, Brushes.DimGray, rectangle2, format);
  1185. }
  1186. else
  1187. {
  1188. format = new StringFormat
  1189. {
  1190. LineAlignment = StringAlignment.Center,
  1191. Alignment = StringAlignment.Center
  1192. };
  1193. graphics.DrawString(this.TabPages[index].Text, this.Font, Brushes.White, rectangle2, format);
  1194. }
  1195. goto Label_09D5;
  1196. }
  1197. catch
  1198. {
  1199. format = new StringFormat
  1200. {
  1201. LineAlignment = StringAlignment.Center,
  1202. Alignment = StringAlignment.Center
  1203. };
  1204. graphics.DrawString(this.TabPages[index].Text, this.Font, Brushes.White, rectangle2, format);
  1205. goto Label_09D5;
  1206. }
  1207. }
  1208. format = new StringFormat
  1209. {
  1210. LineAlignment = StringAlignment.Center,
  1211. Alignment = StringAlignment.Center
  1212. };
  1213. graphics.DrawString(this.TabPages[index].Text, this.Font, Brushes.White, rectangle2, format);
  1214. }
  1215. else
  1216. {
  1217. tabRect = this.GetTabRect(index);
  1218. point5 = tabRect.Location;
  1219. Point point6 = this.GetTabRect(index).Location;
  1220. point4 = new Point(point5.X - 1, point6.Y - 1);
  1221. size3 = new Size(this.GetTabRect(index).Width + 2, this.GetTabRect(index).Height);
  1222. Rectangle layoutRectangle = new Rectangle(point4, size3);
  1223. point5 = new Point(layoutRectangle.Right, layoutRectangle.Top);
  1224. point6 = new Point(layoutRectangle.Right, layoutRectangle.Bottom);
  1225. graphics.DrawLine(this.Border, point5, point6);
  1226. point5 = new Point(layoutRectangle.Right - 1, layoutRectangle.Top);
  1227. point6 = new Point(layoutRectangle.Right - 1, layoutRectangle.Bottom);
  1228. graphics.DrawLine(new Pen(Color.FromArgb(0x2b, 0x2b, 0x2b)), point5, point6);
  1229. if (this.ImageList != null)
  1230. {
  1231. try
  1232. {
  1233. if (this.ImageList.Images[this.TabPages[index].ImageIndex] != null)
  1234. {
  1235. point5 = layoutRectangle.Location;
  1236. point4 = new Point(point5.X + 8, layoutRectangle.Location.Y + 6);
  1237. graphics.DrawImage(this.ImageList.Images[this.TabPages[index].ImageIndex], point4);
  1238. format = new StringFormat
  1239. {
  1240. LineAlignment = StringAlignment.Center,
  1241. Alignment = StringAlignment.Center
  1242. };
  1243. graphics.DrawString(" " + this.TabPages[index].Text, this.Font, new SolidBrush(Color.FromArgb(170, 170, 170)), layoutRectangle, format);
  1244. }
  1245. else
  1246. {
  1247. format = new StringFormat
  1248. {
  1249. LineAlignment = StringAlignment.Center,
  1250. Alignment = StringAlignment.Center
  1251. };
  1252. graphics.DrawString(this.TabPages[index].Text, this.Font, new SolidBrush(Color.FromArgb(170, 170, 170)), layoutRectangle, format);
  1253. }
  1254. goto Label_09D5;
  1255. }
  1256. catch
  1257. {
  1258. format = new StringFormat
  1259. {
  1260. LineAlignment = StringAlignment.Center,
  1261. Alignment = StringAlignment.Center
  1262. };
  1263. graphics.DrawString(this.TabPages[index].Text, this.Font, new SolidBrush(Color.FromArgb(170, 170, 170)), layoutRectangle, format);
  1264. goto Label_09D5;
  1265. }
  1266. }
  1267. format = new StringFormat
  1268. {
  1269. LineAlignment = StringAlignment.Center,
  1270. Alignment = StringAlignment.Center
  1271. };
  1272. graphics.DrawString(this.TabPages[index].Text, this.Font, new SolidBrush(Color.FromArgb(170, 170, 170)), layoutRectangle, format);
  1273. }
  1274. Label_09D5:
  1275. index++;
  1276. goto Label_0147;
  1277. }
  1278.  
  1279. public Brush ToBrush(Color color)
  1280. {
  1281. return new SolidBrush(color);
  1282. }
  1283.  
  1284. public Pen ToPen(Color color)
  1285. {
  1286. return new Pen(color);
  1287. }
  1288. }
  1289.  
  1290. [DefaultEvent("TextChanged")]
  1291. internal class MephobiaTextBox : ThemeControl154
  1292. {
  1293. // Fields
  1294. private int _MaxLength = 0x7fff;
  1295. private bool _Multiline;
  1296. private bool _ReadOnly;
  1297. private HorizontalAlignment _TextAlign = HorizontalAlignment.Left;
  1298. private bool _UseSystemPasswordChar;
  1299. private Color Background;
  1300. private TextBox Base = new TextBox();
  1301. private Color Border;
  1302.  
  1303. // Methods
  1304. public MephobiaTextBox()
  1305. {
  1306. this.Base.Font = this.Font;
  1307. this.Base.Text = this.Text;
  1308. this.Base.MaxLength = this._MaxLength;
  1309. this.Base.Multiline = this._Multiline;
  1310. this.Base.ReadOnly = this._ReadOnly;
  1311. this.Base.UseSystemPasswordChar = this._UseSystemPasswordChar;
  1312. this.Base.BorderStyle = BorderStyle.None;
  1313. Point point = new Point(4, 4);
  1314. this.Base.Location = point;
  1315. this.Base.Width = this.Width - 10;
  1316. if (this._Multiline)
  1317. {
  1318. this.Base.Height = this.Height - 11;
  1319. }
  1320. else
  1321. {
  1322. this.LockHeight = this.Base.Height + 11;
  1323. }
  1324. this.Base.TextChanged += new EventHandler(this.OnBaseTextChanged);
  1325. this.Base.KeyDown += new KeyEventHandler(this.OnBaseKeyDown);
  1326. this.SetColor("Text", 170, 170, 170);
  1327. this.SetColor("Background", 0x16, 0x16, 0x16);
  1328. this.SetColor("Border", 0, 0, 0);
  1329. }
  1330.  
  1331. protected override void ColorHook()
  1332. {
  1333. this.Background = this.GetColor("Background");
  1334. this.Border = this.GetColor("Border");
  1335. this.Base.ForeColor = this.GetColor("Text");
  1336. this.Base.BackColor = this.Background;
  1337. }
  1338.  
  1339. private void OnBaseKeyDown(object sender, KeyEventArgs e)
  1340. {
  1341. if (((!e.Control || (e.KeyCode != Keys.A)) ? 0 : 1) != 0)
  1342. {
  1343. this.Base.SelectAll();
  1344. e.SuppressKeyPress = true;
  1345. }
  1346. }
  1347.  
  1348. private void OnBaseTextChanged(object sender, EventArgs e)
  1349. {
  1350. this.Text = this.Base.Text;
  1351. }
  1352.  
  1353. protected override void OnCreation()
  1354. {
  1355. if (!this.Controls.Contains(this.Base))
  1356. {
  1357. this.Controls.Add(this.Base);
  1358. }
  1359. }
  1360.  
  1361. protected override void OnResize(EventArgs e)
  1362. {
  1363. Point point = new Point(5, 5);
  1364. this.Base.Location = point;
  1365. this.Base.Width = this.Width - 10;
  1366. if (this._Multiline)
  1367. {
  1368. this.Base.Height = this.Height - 5;
  1369. }
  1370. base.OnResize(e);
  1371. }
  1372.  
  1373. protected override void PaintHook()
  1374. {
  1375. base.G.Clear(this.BackColor);
  1376. base.G.SmoothingMode = SmoothingMode.HighQuality;
  1377. base.G.FillPath(new SolidBrush(this.Background), this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 6));
  1378. base.G.DrawPath(new Pen(Color.FromArgb(15, Color.White)), this.CreateRound(1, 1, this.Width - 3, this.Height - 3, 6));
  1379. base.G.DrawPath(new Pen(this.Border), this.CreateRound(0, 0, this.Width - 1, this.Height - 1, 6));
  1380. }
  1381.  
  1382. // Properties
  1383. public override Font Font
  1384. {
  1385. get
  1386. {
  1387. return base.Font;
  1388. }
  1389. set
  1390. {
  1391. base.Font = value;
  1392. if (this.Base != null)
  1393. {
  1394. this.Base.Font = value;
  1395. Point point = new Point(3, 5);
  1396. this.Base.Location = point;
  1397. this.Base.Width = this.Width - 6;
  1398. if (!this._Multiline)
  1399. {
  1400. this.LockHeight = this.Base.Height + 11;
  1401. }
  1402. }
  1403. }
  1404. }
  1405.  
  1406. public int MaxLength
  1407. {
  1408. get
  1409. {
  1410. return this._MaxLength;
  1411. }
  1412. set
  1413. {
  1414. this._MaxLength = value;
  1415. if (this.Base != null)
  1416. {
  1417. this.Base.MaxLength = value;
  1418. }
  1419. }
  1420. }
  1421.  
  1422. public bool Multiline
  1423. {
  1424. get
  1425. {
  1426. return this._Multiline;
  1427. }
  1428. set
  1429. {
  1430. this._Multiline = value;
  1431. if (this.Base != null)
  1432. {
  1433. this.Base.Multiline = value;
  1434. if (value)
  1435. {
  1436. this.LockHeight = 0;
  1437. this.Base.Height = this.Height - 11;
  1438. }
  1439. else
  1440. {
  1441. this.LockHeight = this.Base.Height + 11;
  1442. }
  1443. }
  1444. }
  1445. }
  1446.  
  1447. public string PasswordChar
  1448. {
  1449. get
  1450. {
  1451. return this.Base.PasswordChar.ToString();
  1452. }
  1453. set
  1454. {
  1455. this.Base.PasswordChar = (value).ToCharArray()[0];
  1456. }
  1457. }
  1458.  
  1459. public bool ReadOnly
  1460. {
  1461. get
  1462. {
  1463. return this._ReadOnly;
  1464. }
  1465. set
  1466. {
  1467. this._ReadOnly = value;
  1468. if (this.Base != null)
  1469. {
  1470. this.Base.ReadOnly = value;
  1471. }
  1472. }
  1473. }
  1474.  
  1475. public override string Text
  1476. {
  1477. get
  1478. {
  1479. return base.Text;
  1480. }
  1481. set
  1482. {
  1483. base.Text = value;
  1484. if (this.Base != null)
  1485. {
  1486. this.Base.Text = value;
  1487. }
  1488. }
  1489. }
  1490.  
  1491. public HorizontalAlignment TextAlign
  1492. {
  1493. get
  1494. {
  1495. return this._TextAlign;
  1496. }
  1497. set
  1498. {
  1499. this._TextAlign = value;
  1500. if (this.Base != null)
  1501. {
  1502. this.Base.TextAlign = value;
  1503. }
  1504. }
  1505. }
  1506.  
  1507. public bool UseSystemPasswordChar
  1508. {
  1509. get
  1510. {
  1511. return this._UseSystemPasswordChar;
  1512. }
  1513. set
  1514. {
  1515. this._UseSystemPasswordChar = value;
  1516. if (this.Base != null)
  1517. {
  1518. this.Base.UseSystemPasswordChar = value;
  1519. }
  1520. }
  1521. }
  1522. }
  1523. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement