Advertisement
DocteurOtc

MonoFlat Made By DocXi

Jul 2nd, 2015
1,059
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 93.41 KB | None | 0 0
  1. #region Imports
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7. using System.Drawing.Drawing2D;
  8. using System.ComponentModel;
  9. using System.Diagnostics;
  10. using System.Runtime.CompilerServices;
  11. using System.Threading;
  12.  
  13. #endregion
  14.  
  15. //|------DO-NOT-REMOVE------|
  16. //
  17. // Creator: HazelDev
  18. // Site : HazelDev.com
  19. // Moded By : DocXi Team
  20. // Version: 1.2.1
  21. //
  22. //|------DO-NOT-REMOVE------|
  23.  
  24. namespace MonoFlat
  25. {
  26.  
  27. #region RoundRectangle
  28.  
  29. public sealed class RoundRectangle
  30. {
  31. public static GraphicsPath RoundRect(Rectangle Rectangle, int Curve)
  32. {
  33. GraphicsPath P = new GraphicsPath();
  34. int ArcRectangleWidth = Curve * 2;
  35. P.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90);
  36. P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90);
  37. P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90);
  38. P.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90);
  39. P.AddLine(new Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
  40. return P;
  41. }
  42. }
  43.  
  44. #endregion
  45.  
  46. #region ThemeContainer
  47. [ToolboxBitmap(typeof(Form))]
  48. public class ThemeContainer : ContainerControl
  49. {
  50.  
  51. #region Enums
  52.  
  53. public enum MouseState
  54. {
  55. None = 0,
  56. Over = 1,
  57. Down = 2,
  58. Block = 3
  59. }
  60.  
  61. #endregion
  62. #region Variables
  63. private void prevente (Graphics G/*,string text*/,int W,int H)
  64. {
  65. SizeF L = G.MeasureString("Made By DocXi", new Font("Arial", 8F));
  66. G.DrawString("Made By DocXi", new Font("Arial", 8F), Brushes.White, new Rectangle(W - (int)L.Width - 7, H - (int)L.Height - 4, W, H));
  67. }
  68. private Rectangle HeaderRect;
  69. protected MouseState State;
  70. private int MoveHeight;
  71. private Point MouseP = new Point(0, 0);
  72. private bool Cap = false;
  73. private bool HasShown;
  74.  
  75. #endregion
  76. #region Properties
  77.  
  78. /*private string preventext_ = "toto";
  79. public string preventeText
  80. {
  81. get {return preventext_; }
  82. set { preventext_ = value;Invalidate(); }
  83.  
  84.  
  85. }*/
  86. private Color BG_ = Color.FromArgb(181, 41, 42);
  87. [DefaultValue(typeof(Color), "181, 41, 42"),DisplayName("Top Color")]
  88. public Color BG
  89. {
  90. get
  91. {
  92. return BG_;
  93. }
  94. set { BG_ = value;Invalidate(); }
  95.  
  96. }
  97. /*private Color BGG_ = Color.FromArgb(181, 41, 42);
  98. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("BackGround Color")]
  99. public Color BGG
  100. {
  101. get
  102. {
  103. return BGG_;
  104. }
  105. set { BGG_ = value; Invalidate(); }
  106.  
  107. }*/
  108. private bool _Sizable = true;
  109. public bool Sizable
  110. {
  111. get
  112. {
  113. return _Sizable;
  114. }
  115. set
  116. {
  117. _Sizable = value;
  118. }
  119. }
  120.  
  121. private bool _SmartBounds = true;
  122. public bool SmartBounds
  123. {
  124. get
  125. {
  126. return _SmartBounds;
  127. }
  128. set
  129. {
  130. _SmartBounds = value;
  131. }
  132. }
  133.  
  134. private bool _RoundCorners = true;
  135. public bool RoundCorners
  136. {
  137. get
  138. {
  139. return _RoundCorners;
  140. }
  141. set
  142. {
  143. _RoundCorners = value;
  144. Invalidate();
  145. }
  146. }
  147.  
  148. private bool _IsParentForm;
  149. protected bool IsParentForm
  150. {
  151. get
  152. {
  153. return _IsParentForm;
  154. }
  155. }
  156.  
  157. protected bool IsParentMdi
  158. {
  159. get
  160. {
  161. if (Parent == null)
  162. {
  163. return false;
  164. }
  165. return Parent.Parent != null;
  166. }
  167. }
  168.  
  169. private bool _ControlMode;
  170. protected bool ControlMode
  171. {
  172. get
  173. {
  174. return _ControlMode;
  175. }
  176. set
  177. {
  178. _ControlMode = value;
  179. Invalidate();
  180. }
  181. }
  182.  
  183. private FormStartPosition _StartPosition;
  184. public FormStartPosition StartPosition
  185. {
  186. get
  187. {
  188. if (_IsParentForm && !_ControlMode)
  189. {
  190. return ParentForm.StartPosition;
  191. }
  192. else
  193. {
  194. return _StartPosition;
  195. }
  196. }
  197. set
  198. {
  199. _StartPosition = value;
  200.  
  201. if (_IsParentForm && !_ControlMode)
  202. {
  203. ParentForm.StartPosition = value;
  204. }
  205. }
  206. }
  207.  
  208. #endregion
  209. #region EventArgs
  210.  
  211. protected sealed override void OnParentChanged(EventArgs e)
  212. {
  213. base.OnParentChanged(e);
  214.  
  215. if (Parent == null)
  216. {
  217. return;
  218. }
  219. _IsParentForm = Parent is Form;
  220.  
  221. if (!_ControlMode)
  222. {
  223. InitializeMessages();
  224.  
  225. if (_IsParentForm)
  226. {
  227. this.ParentForm.FormBorderStyle = FormBorderStyle.None;
  228. this.ParentForm.TransparencyKey = Color.Fuchsia;
  229.  
  230. if (!DesignMode)
  231. {
  232. ParentForm.Shown += FormShown;
  233. }
  234. }
  235. Parent.BackColor = BackColor;
  236. // Parent.MinimumSize = New Size(261, 65)
  237. }
  238. }
  239.  
  240. protected sealed override void OnSizeChanged(EventArgs e)
  241. {
  242. base.OnSizeChanged(e);
  243. if (!_ControlMode)
  244. {
  245. HeaderRect = new Rectangle(0, 0, Width - 14, MoveHeight - 7);
  246. }
  247. Invalidate();
  248. }
  249.  
  250. protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  251. {
  252. base.OnMouseDown(e);
  253. Focus();
  254. if (e.Button == MouseButtons.Left)
  255. {
  256. SetState(MouseState.Down);
  257. }
  258. if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized || _ControlMode))
  259. {
  260. if (HeaderRect.Contains(e.Location))
  261. {
  262. Capture = false;
  263. WM_LMBUTTONDOWN = true;
  264. DefWndProc(ref Messages[0]);
  265. }
  266. else if (_Sizable && !(Previous == 0))
  267. {
  268. Capture = false;
  269. WM_LMBUTTONDOWN = true;
  270. DefWndProc(ref Messages[Previous]);
  271. }
  272. }
  273. }
  274.  
  275. protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  276. {
  277. base.OnMouseUp(e);
  278. Cap = false;
  279. }
  280.  
  281. protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  282. {
  283. base.OnMouseMove(e);
  284. if (!(_IsParentForm && ParentForm.WindowState == FormWindowState.Maximized))
  285. {
  286. if (_Sizable && !_ControlMode)
  287. {
  288. InvalidateMouse();
  289. }
  290. }
  291. if (Cap)
  292. {
  293. Parent.Location = (System.Drawing.Point)((object)(System.Convert.ToDouble(MousePosition) - System.Convert.ToDouble(MouseP)));
  294. }
  295. }
  296.  
  297. protected override void OnInvalidated(System.Windows.Forms.InvalidateEventArgs e)
  298. {
  299. base.OnInvalidated(e);
  300. ParentForm.Text = Text;
  301. }
  302.  
  303. protected override void OnPaintBackground(PaintEventArgs e)
  304. {
  305. base.OnPaintBackground(e);
  306. }
  307.  
  308. protected override void OnTextChanged(System.EventArgs e)
  309. {
  310. base.OnTextChanged(e);
  311. Invalidate();
  312. }
  313.  
  314. private void FormShown(object sender, EventArgs e)
  315. {
  316. if (_ControlMode || HasShown)
  317. {
  318. return;
  319. }
  320.  
  321. if (_StartPosition == FormStartPosition.CenterParent || _StartPosition == FormStartPosition.CenterScreen)
  322. {
  323. Rectangle SB = Screen.PrimaryScreen.Bounds;
  324. Rectangle CB = ParentForm.Bounds;
  325. ParentForm.Location = new Point(SB.Width / 2 - CB.Width / 2, SB.Height / 2 - CB.Width / 2);
  326. }
  327. HasShown = true;
  328. }
  329.  
  330. #endregion
  331. #region Mouse & Size
  332.  
  333. private void SetState(MouseState current)
  334. {
  335. State = current;
  336. Invalidate();
  337. }
  338.  
  339. private Point GetIndexPoint;
  340. private bool B1x;
  341. private bool B2x;
  342. private bool B3;
  343. private bool B4;
  344. private int GetIndex()
  345. {
  346. GetIndexPoint = PointToClient(MousePosition);
  347. B1x = GetIndexPoint.X < 7;
  348. B2x = GetIndexPoint.X > Width - 7;
  349. B3 = GetIndexPoint.Y < 7;
  350. B4 = GetIndexPoint.Y > Height - 7;
  351.  
  352. if (B1x && B3)
  353. {
  354. return 4;
  355. }
  356. if (B1x && B4)
  357. {
  358. return 7;
  359. }
  360. if (B2x && B3)
  361. {
  362. return 5;
  363. }
  364. if (B2x && B4)
  365. {
  366. return 8;
  367. }
  368. if (B1x)
  369. {
  370. return 1;
  371. }
  372. if (B2x)
  373. {
  374. return 2;
  375. }
  376. if (B3)
  377. {
  378. return 3;
  379. }
  380. if (B4)
  381. {
  382. return 6;
  383. }
  384. return 0;
  385. }
  386.  
  387. private int Current;
  388. private int Previous;
  389. private void InvalidateMouse()
  390. {
  391. Current = GetIndex();
  392. if (Current == Previous)
  393. {
  394. return;
  395. }
  396.  
  397. Previous = Current;
  398. switch (Previous)
  399. {
  400. case 0:
  401. Cursor = Cursors.Default;
  402. break;
  403. case 6:
  404. Cursor = Cursors.SizeNS;
  405. break;
  406. case 8:
  407. Cursor = Cursors.SizeNWSE;
  408. break;
  409. case 7:
  410. Cursor = Cursors.SizeNESW;
  411. break;
  412. }
  413. }
  414.  
  415. private Message[] Messages = new Message[9];
  416. private void InitializeMessages()
  417. {
  418. Messages[0] = Message.Create(Parent.Handle, 161, new IntPtr(2), IntPtr.Zero);
  419. for (int I = 1; I <= 8; I++)
  420. {
  421. Messages[I] = Message.Create(Parent.Handle, 161, new IntPtr(I + 9), IntPtr.Zero);
  422. }
  423. }
  424.  
  425. private void CorrectBounds(Rectangle bounds)
  426. {
  427. if (Parent.Width > bounds.Width)
  428. {
  429. Parent.Width = bounds.Width;
  430. }
  431. if (Parent.Height > bounds.Height)
  432. {
  433. Parent.Height = bounds.Height;
  434. }
  435.  
  436. int X = Parent.Location.X;
  437. int Y = Parent.Location.Y;
  438.  
  439. if (X < bounds.X)
  440. {
  441. X = bounds.X;
  442. }
  443. if (Y < bounds.Y)
  444. {
  445. Y = bounds.Y;
  446. }
  447.  
  448. int Width = bounds.X + bounds.Width;
  449. int Height = bounds.Y + bounds.Height;
  450.  
  451. if (X + Parent.Width > Width)
  452. {
  453. X = Width - Parent.Width;
  454. }
  455. if (Y + Parent.Height > Height)
  456. {
  457. Y = Height - Parent.Height;
  458. }
  459.  
  460. Parent.Location = new Point(X, Y);
  461. }
  462.  
  463. private bool WM_LMBUTTONDOWN;
  464. protected override void WndProc(ref Message m)
  465. {
  466. base.WndProc(ref m);
  467.  
  468. if (WM_LMBUTTONDOWN && m.Msg == 513)
  469. {
  470. WM_LMBUTTONDOWN = false;
  471.  
  472. SetState(MouseState.Over);
  473. if (!_SmartBounds)
  474. {
  475. return;
  476. }
  477.  
  478. if (IsParentMdi)
  479. {
  480. CorrectBounds(new Rectangle(Point.Empty, Parent.Parent.Size));
  481. }
  482. else
  483. {
  484. CorrectBounds(Screen.FromControl(Parent).WorkingArea);
  485. }
  486. }
  487. }
  488.  
  489. #endregion
  490.  
  491. protected override void CreateHandle()
  492. {
  493. base.CreateHandle();
  494. }
  495.  
  496. public ThemeContainer()
  497. {
  498. SetStyle((ControlStyles)(139270), true);
  499. BackColor = Color.FromArgb(32, 41, 50);
  500. Padding = new Padding(10, 70, 10, 9);
  501. DoubleBuffered = true;
  502. Dock = DockStyle.Fill;
  503. MoveHeight = 66;
  504. Font = new Font("Segoe UI", 9);
  505. }
  506.  
  507. protected override void OnPaint(PaintEventArgs e)
  508. {
  509. base.OnPaint(e);
  510. Graphics G = e.Graphics;
  511.  
  512. G.Clear(Color.FromArgb(32, 41, 50));
  513. G.FillRectangle(new SolidBrush(BG), new Rectangle(0, 0, Width, 60));
  514.  
  515. if (_RoundCorners == true)
  516. {
  517. // Draw Left upper corner
  518. G.FillRectangle(Brushes.Fuchsia, 0, 0, 1, 1);
  519. G.FillRectangle(Brushes.Fuchsia, 1, 0, 1, 1);
  520. G.FillRectangle(Brushes.Fuchsia, 2, 0, 1, 1);
  521. G.FillRectangle(Brushes.Fuchsia, 3, 0, 1, 1);
  522. G.FillRectangle(Brushes.Fuchsia, 0, 1, 1, 1);
  523. G.FillRectangle(Brushes.Fuchsia, 0, 2, 1, 1);
  524. G.FillRectangle(Brushes.Fuchsia, 0, 3, 1, 1);
  525. G.FillRectangle(Brushes.Fuchsia, 1, 1, 1, 1);
  526.  
  527. G.FillRectangle(new SolidBrush(BG), 1, 3, 1, 1);
  528. G.FillRectangle(new SolidBrush(BG), 1, 2, 1, 1);
  529. G.FillRectangle(new SolidBrush(BG), 2, 1, 1, 1);
  530. G.FillRectangle(new SolidBrush(BG), 3, 1, 1, 1);
  531.  
  532. // Draw right upper corner
  533. G.FillRectangle(Brushes.Fuchsia, Width - 1, 0, 1, 1);
  534. G.FillRectangle(Brushes.Fuchsia, Width - 2, 0, 1, 1);
  535. G.FillRectangle(Brushes.Fuchsia, Width - 3, 0, 1, 1);
  536. G.FillRectangle(Brushes.Fuchsia, Width - 4, 0, 1, 1);
  537. G.FillRectangle(Brushes.Fuchsia, Width - 1, 1, 1, 1);
  538. G.FillRectangle(Brushes.Fuchsia, Width - 1, 2, 1, 1);
  539. G.FillRectangle(Brushes.Fuchsia, Width - 1, 3, 1, 1);
  540. G.FillRectangle(Brushes.Fuchsia, Width - 2, 1, 1, 1);
  541.  
  542. G.FillRectangle(new SolidBrush(BG), Width - 2, 3, 1, 1);
  543. G.FillRectangle(new SolidBrush(BG), Width - 2, 2, 1, 1);
  544. G.FillRectangle(new SolidBrush(BG), Width - 3, 1, 1, 1);
  545. G.FillRectangle(new SolidBrush(BG), Width - 4, 1, 1, 1);
  546.  
  547. // Draw Left bottom corner
  548. G.FillRectangle(Brushes.Fuchsia, 0, Height - 1, 1, 1);
  549. G.FillRectangle(Brushes.Fuchsia, 0, Height - 2, 1, 1);
  550. G.FillRectangle(Brushes.Fuchsia, 0, Height - 3, 1, 1);
  551. G.FillRectangle(Brushes.Fuchsia, 0, Height - 4, 1, 1);
  552. G.FillRectangle(Brushes.Fuchsia, 1, Height - 1, 1, 1);
  553. G.FillRectangle(Brushes.Fuchsia, 2, Height - 1, 1, 1);
  554. G.FillRectangle(Brushes.Fuchsia, 3, Height - 1, 1, 1);
  555. G.FillRectangle(Brushes.Fuchsia, 1, Height - 1, 1, 1);
  556. G.FillRectangle(Brushes.Fuchsia, 1, Height - 2, 1, 1);
  557.  
  558. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), 1, Height - 3, 1, 1);
  559. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), 1, Height - 4, 1, 1);
  560. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), 3, Height - 2, 1, 1);
  561. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), 2, Height - 2, 1, 1);
  562.  
  563. // Draw right bottom corner
  564. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height, 1, 1);
  565. G.FillRectangle(Brushes.Fuchsia, Width - 2, Height, 1, 1);
  566. G.FillRectangle(Brushes.Fuchsia, Width - 3, Height, 1, 1);
  567. G.FillRectangle(Brushes.Fuchsia, Width - 4, Height, 1, 1);
  568. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 1, 1, 1);
  569. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 2, 1, 1);
  570. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 3, 1, 1);
  571. G.FillRectangle(Brushes.Fuchsia, Width - 2, Height - 1, 1, 1);
  572. G.FillRectangle(Brushes.Fuchsia, Width - 3, Height - 1, 1, 1);
  573. G.FillRectangle(Brushes.Fuchsia, Width - 4, Height - 1, 1, 1);
  574. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 4, 1, 1);
  575. G.FillRectangle(Brushes.Fuchsia, Width - 2, Height - 2, 1, 1);
  576.  
  577. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), Width - 2, Height - 3, 1, 1);
  578. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), Width - 2, Height - 4, 1, 1);
  579. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), Width - 4, Height - 2, 1, 1);
  580. G.FillRectangle(new SolidBrush(Color.FromArgb(32, 41, 50)), Width - 3, Height - 2, 1, 1);
  581. }
  582.  
  583. G.DrawString(Text, new Font("Microsoft Sans Serif", 12, FontStyle.Bold), new SolidBrush(Color.FromArgb(255, 254, 255)), new Rectangle(20, 20, Width - 1, Height), new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Near });
  584. prevente(G,/*preventeText,*/Width,Height);
  585. }
  586. }
  587.  
  588. #endregion
  589. #region ControlBox
  590.  
  591. public class ControlBox : Control
  592. {
  593.  
  594. #region Enums
  595.  
  596. public enum ButtonHoverState
  597. {
  598. Minimize,
  599. Maximize,
  600. Close,
  601. None
  602. }
  603.  
  604. #endregion
  605. #region Variables
  606.  
  607. private ButtonHoverState ButtonHState = ButtonHoverState.None;
  608.  
  609. #endregion
  610. #region Properties
  611. private Color BG_ = Color.FromArgb(181, 41, 42);
  612. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Top Color")]
  613. public Color BG
  614. {
  615. get
  616. {
  617. return BG_;
  618. }
  619. set { BG_ = value; Invalidate(); }
  620.  
  621. }
  622.  
  623. private bool _EnableMaximize = true;
  624. public bool EnableMaximizeButton
  625. {
  626. get { return _EnableMaximize; }
  627. set
  628. {
  629. _EnableMaximize = value;
  630. Invalidate();
  631. }
  632. }
  633.  
  634. private bool _EnableMinimize = true;
  635. public bool EnableMinimizeButton
  636. {
  637. get { return _EnableMinimize; }
  638. set
  639. {
  640. _EnableMinimize = value;
  641. Invalidate();
  642. }
  643. }
  644.  
  645. private bool _EnableHoverHighlight = false;
  646. public bool EnableHoverHighlight
  647. {
  648. get { return _EnableHoverHighlight; }
  649. set
  650. {
  651. _EnableHoverHighlight = value;
  652. Invalidate();
  653. }
  654. }
  655.  
  656. #endregion
  657. #region EventArgs
  658.  
  659. protected override void OnResize(EventArgs e)
  660. {
  661. base.OnResize(e);
  662. Size = new Size(100, 25);
  663. }
  664.  
  665. protected override void OnMouseMove(MouseEventArgs e)
  666. {
  667. base.OnMouseMove(e);
  668. int X = e.Location.X;
  669. int Y = e.Location.Y;
  670. if (Y > 0 && Y < (Height - 2))
  671. {
  672. if (X > 0 && X < 34)
  673. {
  674. ButtonHState = ButtonHoverState.Minimize;
  675. }
  676. else if (X > 33 && X < 65)
  677. {
  678. ButtonHState = ButtonHoverState.Maximize;
  679. }
  680. else if (X > 64 && X < Width)
  681. {
  682. ButtonHState = ButtonHoverState.Close;
  683. }
  684. else
  685. {
  686. ButtonHState = ButtonHoverState.None;
  687. }
  688. }
  689. else
  690. {
  691. ButtonHState = ButtonHoverState.None;
  692. }
  693. Invalidate();
  694. }
  695.  
  696. protected override void OnMouseUp(MouseEventArgs e)
  697. {
  698. base.OnMouseDown(e);
  699. switch (ButtonHState)
  700. {
  701. case ButtonHoverState.Close:
  702. Parent.FindForm().Close();
  703. break;
  704. case ButtonHoverState.Minimize:
  705. if (_EnableMinimize == true)
  706. {
  707. Parent.FindForm().WindowState = FormWindowState.Minimized;
  708. }
  709. break;
  710. case ButtonHoverState.Maximize:
  711. if (_EnableMaximize == true)
  712. {
  713. if (Parent.FindForm().WindowState == FormWindowState.Normal)
  714. {
  715. Parent.FindForm().WindowState = FormWindowState.Maximized;
  716. }
  717. else
  718. {
  719. Parent.FindForm().WindowState = FormWindowState.Normal;
  720. }
  721. }
  722. break;
  723. }
  724. }
  725. protected override void OnMouseLeave(EventArgs e)
  726. {
  727. base.OnMouseLeave(e);
  728. ButtonHState = ButtonHoverState.None;
  729. Invalidate();
  730. }
  731.  
  732. protected override void OnMouseDown(MouseEventArgs e)
  733. {
  734. base.OnMouseDown(e);
  735. Focus();
  736. }
  737.  
  738. #endregion
  739.  
  740. public ControlBox()
  741. : base()
  742. {
  743. DoubleBuffered = true;
  744. Anchor = AnchorStyles.Top | AnchorStyles.Right;
  745. }
  746.  
  747. protected override void OnCreateControl()
  748. {
  749. base.OnCreateControl();
  750. try
  751. {
  752. Location = new Point(Parent.Width - 112, 15);
  753. }
  754. catch (Exception)
  755. {
  756. }
  757. }
  758.  
  759. protected override void OnPaint(PaintEventArgs e)
  760. {
  761. base.OnPaint(e);
  762. Graphics G = e.Graphics;
  763. G.Clear(BG);
  764.  
  765. if (_EnableHoverHighlight == true)
  766. {
  767. switch (ButtonHState)
  768. {
  769. case ButtonHoverState.None:
  770. G.Clear(BG);
  771. break;
  772. case ButtonHoverState.Minimize:
  773. if (_EnableMinimize == true)
  774. {
  775. G.FillRectangle(new SolidBrush(BG), new Rectangle(3, 0, 30, Height));
  776. }
  777. break;
  778. case ButtonHoverState.Maximize:
  779. if (_EnableMaximize == true)
  780. {
  781. G.FillRectangle(new SolidBrush(BG), new Rectangle(35, 0, 30, Height));
  782. }
  783. break;
  784. case ButtonHoverState.Close:
  785. G.FillRectangle(new SolidBrush(BG), new Rectangle(66, 0, 35, Height));
  786. break;
  787. }
  788. }
  789.  
  790. //Close
  791. G.DrawString("r", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(255, 254, 255)), new Point(Width - 16, 8), new StringFormat { Alignment = StringAlignment.Center });
  792.  
  793. //Maximize
  794. switch (Parent.FindForm().WindowState)
  795. {
  796. case FormWindowState.Maximized:
  797. if (_EnableMaximize == true)
  798. {
  799. G.DrawString("2", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(255, 254, 255)), new Point(51, 7), new StringFormat { Alignment = StringAlignment.Center });
  800. }
  801. else
  802. {
  803. G.DrawString("2", new Font("Marlett", 12), new SolidBrush(Color.LightGray), new Point(51, 7), new StringFormat { Alignment = StringAlignment.Center });
  804. }
  805. break;
  806. case FormWindowState.Normal:
  807. if (_EnableMaximize == true)
  808. {
  809. G.DrawString("1", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(255, 254, 255)), new Point(51, 7), new StringFormat { Alignment = StringAlignment.Center });
  810. }
  811. else
  812. {
  813. G.DrawString("1", new Font("Marlett", 12), new SolidBrush(Color.LightGray), new Point(51, 7), new StringFormat { Alignment = StringAlignment.Center });
  814. }
  815. break;
  816. }
  817.  
  818. //Minimize
  819. if (_EnableMinimize == true)
  820. {
  821. G.DrawString("0", new Font("Marlett", 12), new SolidBrush(Color.FromArgb(255, 254, 255)), new Point(20, 7), new StringFormat { Alignment = StringAlignment.Center });
  822. }
  823. else
  824. {
  825. G.DrawString("0", new Font("Marlett", 12), new SolidBrush(Color.LightGray), new Point(20, 7), new StringFormat { Alignment = StringAlignment.Center });
  826. }
  827. }
  828. }
  829.  
  830. #endregion
  831. #region Button
  832.  
  833. public class Button : Control
  834. {
  835.  
  836. #region Variables
  837. private Color BG_ = Color.FromArgb(181, 41, 42);
  838. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Button Color")]
  839. public Color BG
  840. {
  841. get
  842. {
  843. return BG_;
  844. }
  845. set { BG_ = value; Invalidate(); }
  846.  
  847. }
  848.  
  849. private int MouseState;
  850. private GraphicsPath Shape;
  851. private LinearGradientBrush InactiveGB;
  852. private LinearGradientBrush PressedGB;
  853. private Rectangle R1;
  854. private Pen P1;
  855. private Pen P3;
  856. private Image _Image;
  857. private Size _ImageSize;
  858. private StringAlignment _TextAlignment = StringAlignment.Center;
  859. private Color _TextColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
  860. private ContentAlignment _ImageAlign = ContentAlignment.MiddleLeft;
  861.  
  862. #endregion
  863. #region Image Designer
  864.  
  865. private static PointF ImageLocation(StringFormat SF, SizeF Area, SizeF ImageArea)
  866. {
  867. PointF MyPoint = new PointF();
  868. switch (SF.Alignment)
  869. {
  870. case StringAlignment.Center:
  871. MyPoint.X = (float)((Area.Width - ImageArea.Width) / 2);
  872. break;
  873. case StringAlignment.Near:
  874. MyPoint.X = 2;
  875. break;
  876. case StringAlignment.Far:
  877. MyPoint.X = Area.Width - ImageArea.Width - 2;
  878. break;
  879.  
  880. }
  881.  
  882. switch (SF.LineAlignment)
  883. {
  884. case StringAlignment.Center:
  885. MyPoint.Y = (float)((Area.Height - ImageArea.Height) / 2);
  886. break;
  887. case StringAlignment.Near:
  888. MyPoint.Y = 2;
  889. break;
  890. case StringAlignment.Far:
  891. MyPoint.Y = Area.Height - ImageArea.Height - 2;
  892. break;
  893. }
  894. return MyPoint;
  895. }
  896.  
  897. private StringFormat GetStringFormat(ContentAlignment _ContentAlignment)
  898. {
  899. StringFormat SF = new StringFormat();
  900. switch (_ContentAlignment)
  901. {
  902. case ContentAlignment.MiddleCenter:
  903. SF.LineAlignment = StringAlignment.Center;
  904. SF.Alignment = StringAlignment.Center;
  905. break;
  906. case ContentAlignment.MiddleLeft:
  907. SF.LineAlignment = StringAlignment.Center;
  908. SF.Alignment = StringAlignment.Near;
  909. break;
  910. case ContentAlignment.MiddleRight:
  911. SF.LineAlignment = StringAlignment.Center;
  912. SF.Alignment = StringAlignment.Far;
  913. break;
  914. case ContentAlignment.TopCenter:
  915. SF.LineAlignment = StringAlignment.Near;
  916. SF.Alignment = StringAlignment.Center;
  917. break;
  918. case ContentAlignment.TopLeft:
  919. SF.LineAlignment = StringAlignment.Near;
  920. SF.Alignment = StringAlignment.Near;
  921. break;
  922. case ContentAlignment.TopRight:
  923. SF.LineAlignment = StringAlignment.Near;
  924. SF.Alignment = StringAlignment.Far;
  925. break;
  926. case ContentAlignment.BottomCenter:
  927. SF.LineAlignment = StringAlignment.Far;
  928. SF.Alignment = StringAlignment.Center;
  929. break;
  930. case ContentAlignment.BottomLeft:
  931. SF.LineAlignment = StringAlignment.Far;
  932. SF.Alignment = StringAlignment.Near;
  933. break;
  934. case ContentAlignment.BottomRight:
  935. SF.LineAlignment = StringAlignment.Far;
  936. SF.Alignment = StringAlignment.Far;
  937. break;
  938. }
  939. return SF;
  940. }
  941.  
  942. #endregion
  943. #region Properties
  944.  
  945. public Image Image
  946. {
  947. get
  948. {
  949. return _Image;
  950. }
  951. set
  952. {
  953. if (value == null)
  954. {
  955. _ImageSize = Size.Empty;
  956. }
  957. else
  958. {
  959. _ImageSize = value.Size;
  960. }
  961.  
  962. _Image = value;
  963. Invalidate();
  964. }
  965. }
  966.  
  967. protected Size ImageSize
  968. {
  969. get
  970. {
  971. return _ImageSize;
  972. }
  973. }
  974.  
  975. public ContentAlignment ImageAlign
  976. {
  977. get
  978. {
  979. return _ImageAlign;
  980. }
  981. set
  982. {
  983. _ImageAlign = value;
  984. Invalidate();
  985. }
  986. }
  987.  
  988. public StringAlignment TextAlignment
  989. {
  990. get
  991. {
  992. return this._TextAlignment;
  993. }
  994. set
  995. {
  996. this._TextAlignment = value;
  997. this.Invalidate();
  998. }
  999. }
  1000.  
  1001. public override Color ForeColor
  1002. {
  1003. get
  1004. {
  1005. return this._TextColor;
  1006. }
  1007. set
  1008. {
  1009. this._TextColor = value;
  1010. this.Invalidate();
  1011. }
  1012. }
  1013.  
  1014. #endregion
  1015. #region EventArgs
  1016.  
  1017. protected override void OnMouseUp(MouseEventArgs e)
  1018. {
  1019. MouseState = 0;
  1020. Invalidate();
  1021. base.OnMouseUp(e);
  1022. }
  1023. protected override void OnMouseDown(MouseEventArgs e)
  1024. {
  1025. MouseState = 1;
  1026. Focus();
  1027. Invalidate();
  1028. base.OnMouseDown(e);
  1029. }
  1030.  
  1031. protected override void OnMouseLeave(EventArgs e)
  1032. {
  1033. MouseState = 0;
  1034. Invalidate();
  1035. base.OnMouseLeave(e);
  1036. }
  1037.  
  1038. protected override void OnTextChanged(System.EventArgs e)
  1039. {
  1040. Invalidate();
  1041. base.OnTextChanged(e);
  1042. }
  1043.  
  1044. #endregion
  1045.  
  1046. public Button()
  1047. {
  1048. SetStyle((System.Windows.Forms.ControlStyles)(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint), true);
  1049.  
  1050. BackColor = Color.Transparent;
  1051. DoubleBuffered = true;
  1052. Font = new Font("Segoe UI", 12);
  1053. ForeColor = Color.FromArgb(255, 255, 255);
  1054. Size = new Size(146, 41);
  1055. _TextAlignment = StringAlignment.Center;
  1056. P1 = new Pen(BG); // P1 = Border color
  1057. P3 = new Pen(Color.FromArgb(40, 0, 0, 0)); // P3 = Border color when pressed
  1058. }
  1059.  
  1060. protected override void OnResize(System.EventArgs e)
  1061. {
  1062. base.OnResize(e);
  1063. if (Width > 0 && Height > 0)
  1064. {
  1065.  
  1066. Shape = new GraphicsPath();
  1067. R1 = new Rectangle(0, 0, Width, Height);
  1068.  
  1069.  
  1070. }
  1071.  
  1072. Shape.AddArc(0, 0, 10, 10, 180, 90);
  1073. Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  1074. Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  1075. Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  1076. Shape.CloseAllFigures();
  1077. Invalidate();
  1078. }
  1079.  
  1080. protected override void OnPaint(PaintEventArgs e)
  1081. {
  1082.  
  1083. var G = e.Graphics;
  1084. G.SmoothingMode = SmoothingMode.HighQuality;
  1085. PointF ipt = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize);
  1086. InactiveGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), BG, BG, 90.0F);
  1087. PressedGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(40, 0, 0, 0), Color.FromArgb(40, 0, 0, 0), 90.0F);
  1088. switch (MouseState)
  1089. {
  1090. case 0:
  1091. //Inactive
  1092. G.FillPath(InactiveGB, Shape);
  1093. // Fill button body with InactiveGB color gradient
  1094. G.DrawPath(new Pen(BG), Shape);
  1095. // Draw button border [InactiveGB]
  1096. if ((Image == null))
  1097. {
  1098. G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1099. {
  1100. Alignment = _TextAlignment,
  1101. LineAlignment = StringAlignment.Center
  1102. });
  1103. }
  1104. else
  1105. {
  1106. G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1107. G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1108. {
  1109. Alignment = _TextAlignment,
  1110. LineAlignment = StringAlignment.Center
  1111. });
  1112. }
  1113. break;
  1114. case 1:
  1115. //Pressed
  1116. G.FillPath(PressedGB, Shape);
  1117. // Fill button body with PressedGB color gradient
  1118. G.DrawPath(P3, Shape);
  1119. // Draw button border [PressedGB]
  1120.  
  1121. if ((Image == null))
  1122. {
  1123. G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1124. {
  1125. Alignment = _TextAlignment,
  1126. LineAlignment = StringAlignment.Center
  1127. });
  1128. }
  1129. else
  1130. {
  1131. G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1132. G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1133. {
  1134. Alignment = _TextAlignment,
  1135. LineAlignment = StringAlignment.Center
  1136. });
  1137. }
  1138. break;
  1139. }
  1140. base.OnPaint(e);
  1141. }
  1142. }
  1143.  
  1144. #endregion
  1145. #region Social Button
  1146.  
  1147. public class SocialButton : Control
  1148. {
  1149.  
  1150. #region Variables
  1151.  
  1152. private Image _Image;
  1153. private Size _ImageSize;
  1154. private Color EllipseColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
  1155.  
  1156. #endregion
  1157. #region Properties
  1158. private Color BG_ = Color.FromArgb(181, 41, 42);
  1159. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Top Color")]
  1160. public Color BG
  1161. {
  1162. get
  1163. {
  1164. return BG_;
  1165. }
  1166. set { BG_ = value; Invalidate(); }
  1167.  
  1168. }
  1169. public Image Image
  1170. {
  1171. get
  1172. {
  1173. return _Image;
  1174. }
  1175. set
  1176. {
  1177. if (value == null)
  1178. {
  1179. _ImageSize = Size.Empty;
  1180. }
  1181. else
  1182. {
  1183. _ImageSize = value.Size;
  1184. }
  1185.  
  1186. _Image = value;
  1187. Invalidate();
  1188. }
  1189. }
  1190.  
  1191. protected Size ImageSize
  1192. {
  1193. get
  1194. {
  1195. return _ImageSize;
  1196. }
  1197. }
  1198.  
  1199. #endregion
  1200. #region EventArgs
  1201.  
  1202. protected override void OnResize(EventArgs e)
  1203. {
  1204. base.OnResize(e);
  1205. this.Size = new Size(54, 54);
  1206. }
  1207.  
  1208. protected override void OnMouseEnter(EventArgs e)
  1209. {
  1210. base.OnMouseEnter(e);
  1211. EllipseColor = BG;
  1212. Refresh();
  1213. }
  1214. protected override void OnMouseLeave(EventArgs e)
  1215. {
  1216. base.OnMouseLeave(e);
  1217. EllipseColor = Color.FromArgb(66, 76, 85);
  1218. Refresh();
  1219. }
  1220.  
  1221. protected override void OnMouseDown(MouseEventArgs e)
  1222. {
  1223. base.OnMouseDown(e);
  1224. EllipseColor = Color.FromArgb(40,0,0,0);
  1225. Focus();
  1226. Refresh();
  1227. }
  1228. protected override void OnMouseUp(MouseEventArgs e)
  1229. {
  1230. base.OnMouseUp(e);
  1231. EllipseColor = BG;
  1232. Refresh();
  1233. }
  1234.  
  1235. #endregion
  1236. #region Image Designer
  1237.  
  1238. private static PointF ImageLocation(StringFormat SF, SizeF Area, SizeF ImageArea)
  1239. {
  1240. PointF MyPoint = new PointF();
  1241. switch (SF.Alignment)
  1242. {
  1243. case StringAlignment.Center:
  1244. MyPoint.X = (float)((Area.Width - ImageArea.Width) / 2);
  1245. break;
  1246. }
  1247.  
  1248. switch (SF.LineAlignment)
  1249. {
  1250. case StringAlignment.Center:
  1251. MyPoint.Y = (float)((Area.Height - ImageArea.Height) / 2);
  1252. break;
  1253. }
  1254. return MyPoint;
  1255. }
  1256.  
  1257. private StringFormat GetStringFormat(ContentAlignment _ContentAlignment)
  1258. {
  1259. StringFormat SF = new StringFormat();
  1260. switch (_ContentAlignment)
  1261. {
  1262. case ContentAlignment.MiddleCenter:
  1263. SF.LineAlignment = StringAlignment.Center;
  1264. SF.Alignment = StringAlignment.Center;
  1265. break;
  1266. }
  1267. return SF;
  1268. }
  1269.  
  1270. #endregion
  1271.  
  1272. public SocialButton()
  1273. {
  1274. DoubleBuffered = true;
  1275. EllipseColor = Color.FromArgb(66, 76, 85);
  1276. }
  1277.  
  1278. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  1279. {
  1280. Graphics G = e.Graphics;
  1281. G.Clear(Parent.BackColor);
  1282. G.SmoothingMode = SmoothingMode.HighQuality;
  1283.  
  1284. PointF ImgPoint = ImageLocation(GetStringFormat(ContentAlignment.MiddleCenter), Size, ImageSize);
  1285. G.FillEllipse(new SolidBrush(EllipseColor), new Rectangle(0, 0, 53, 53));
  1286.  
  1287. // HINTS:
  1288. // The best size for the drawn image is 32x32\
  1289. // The best matching color of drawn image is (RGB: 31, 40, 49)
  1290. if (Image != null)
  1291. {
  1292. G.DrawImage(_Image, (int)ImgPoint.X, (int)ImgPoint.Y, ImageSize.Width, ImageSize.Height);
  1293. }
  1294. }
  1295. }
  1296.  
  1297. #endregion
  1298. #region Label
  1299.  
  1300. public class t_Label : Label
  1301. {
  1302.  
  1303. public t_Label()
  1304. {
  1305. Font = new Font("Segoe UI", 9);
  1306. ForeColor = Color.FromArgb(116, 125, 132);
  1307. BackColor = Color.Transparent;
  1308. }
  1309. }
  1310.  
  1311. #endregion
  1312. #region Link Label
  1313. public class t_LinkLabel : LinkLabel
  1314. {
  1315.  
  1316. public t_LinkLabel()
  1317. {
  1318. Font = new Font("Segoe UI", 9, FontStyle.Regular);
  1319. BackColor = Color.Transparent;
  1320. LinkColor = Color.FromArgb(181, 41, 42);
  1321. ActiveLinkColor = Color.FromArgb(153, 34, 34);
  1322. VisitedLinkColor = Color.FromArgb(181, 41, 42);
  1323. LinkBehavior = LinkBehavior.NeverUnderline;
  1324. }
  1325. }
  1326.  
  1327. #endregion
  1328. #region Header Label
  1329.  
  1330. public class HeaderLabel : Label
  1331. {
  1332.  
  1333. public HeaderLabel()
  1334. {
  1335. Font = new Font("Segoe UI", 11, FontStyle.Bold);
  1336. ForeColor = Color.FromArgb(255, 255, 255);
  1337. BackColor = Color.Transparent;
  1338. }
  1339. }
  1340.  
  1341. #endregion
  1342. #region Toggle Button
  1343.  
  1344. [DefaultEvent("ToggledChanged")]
  1345. public class Toggle_button : Control
  1346. {
  1347.  
  1348. #region Enums
  1349.  
  1350. public enum _Type
  1351. {
  1352. CheckMark,
  1353. OnOff,
  1354. YesNo,
  1355. IO
  1356. }
  1357.  
  1358. #endregion
  1359. #region Variables
  1360.  
  1361. public delegate void ToggledChangedEventHandler();
  1362. private ToggledChangedEventHandler ToggledChangedEvent;
  1363.  
  1364. public event ToggledChangedEventHandler ToggledChanged
  1365. {
  1366. add
  1367. {
  1368. ToggledChangedEvent = (ToggledChangedEventHandler)System.Delegate.Combine(ToggledChangedEvent, value);
  1369. }
  1370. remove
  1371. {
  1372. ToggledChangedEvent = (ToggledChangedEventHandler)System.Delegate.Remove(ToggledChangedEvent, value);
  1373. }
  1374. }
  1375.  
  1376. private bool _Toggled;
  1377. private _Type ToggleType;
  1378. private Rectangle Bar;
  1379. private int _Width;
  1380. private int _Height;
  1381.  
  1382. #endregion
  1383. #region Properties
  1384. private Color BG_ = Color.FromArgb(181, 41, 42);
  1385. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Top Color")]
  1386. public Color BG
  1387. {
  1388. get
  1389. {
  1390. return BG_;
  1391. }
  1392. set { BG_ = value; Invalidate(); }
  1393.  
  1394. }
  1395. public bool Toggled
  1396. {
  1397. get
  1398. {
  1399. return _Toggled;
  1400. }
  1401. set
  1402. {
  1403. _Toggled = value;
  1404. Invalidate();
  1405. if (ToggledChangedEvent != null)
  1406. ToggledChangedEvent();
  1407. }
  1408. }
  1409.  
  1410. public _Type Type
  1411. {
  1412. get
  1413. {
  1414. return ToggleType;
  1415. }
  1416. set
  1417. {
  1418. ToggleType = value;
  1419. Invalidate();
  1420. }
  1421. }
  1422.  
  1423. #endregion
  1424. #region EventArgs
  1425.  
  1426. protected override void OnResize(EventArgs e)
  1427. {
  1428. base.OnResize(e);
  1429. this.Size = new Size(76, 33);
  1430. }
  1431.  
  1432. protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  1433. {
  1434. base.OnMouseUp(e);
  1435. Toggled = !Toggled;
  1436. Focus();
  1437. }
  1438.  
  1439. #endregion
  1440.  
  1441. public Toggle_button()
  1442. {
  1443. SetStyle((System.Windows.Forms.ControlStyles)(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint), true);
  1444. }
  1445.  
  1446. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  1447. {
  1448. base.OnPaint(e);
  1449. System.Drawing.Graphics G = e.Graphics;
  1450.  
  1451. G.SmoothingMode = SmoothingMode.HighQuality;
  1452. G.Clear(Parent.BackColor);
  1453. _Width = Width - 1;
  1454. _Height = Height - 1;
  1455.  
  1456. GraphicsPath GP = default(GraphicsPath);
  1457. GraphicsPath GP2 = new GraphicsPath();
  1458. Rectangle BaseRect = new Rectangle(0, 0, _Width, _Height);
  1459. Rectangle ThumbRect = new Rectangle(_Width / 2, 0, 38, _Height);
  1460.  
  1461. G.SmoothingMode = (System.Drawing.Drawing2D.SmoothingMode)2;
  1462. G.PixelOffsetMode = (System.Drawing.Drawing2D.PixelOffsetMode)2;
  1463. G.TextRenderingHint = (System.Drawing.Text.TextRenderingHint)5;
  1464. G.Clear(BackColor);
  1465.  
  1466. GP = RoundRectangle.RoundRect(BaseRect, 4);
  1467. ThumbRect = new Rectangle(4, 4, 36, _Height - 8);
  1468. GP2 = RoundRectangle.RoundRect(ThumbRect, 4);
  1469. G.FillPath(new SolidBrush(Color.FromArgb(66, 76, 85)), GP);
  1470. G.FillPath(new SolidBrush(Color.FromArgb(32, 41, 50)), GP2);
  1471.  
  1472. if (_Toggled)
  1473. {
  1474. GP = RoundRectangle.RoundRect(BaseRect, 4);
  1475. ThumbRect = new Rectangle((_Width / 2) - 2, 4, 36, _Height - 8);
  1476. GP2 = RoundRectangle.RoundRect(ThumbRect, 4);
  1477. G.FillPath(new SolidBrush(BG), GP);
  1478. G.FillPath(new SolidBrush(Color.FromArgb(32, 41, 50)), GP2);
  1479. }
  1480.  
  1481. // Draw string
  1482. switch (ToggleType)
  1483. {
  1484. case _Type.CheckMark:
  1485. if (Toggled)
  1486. {
  1487. G.DrawString("ü", new Font("Wingdings", 18, FontStyle.Regular), Brushes.WhiteSmoke, Bar.X + 18, Bar.Y + 19, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1488. }
  1489. else
  1490. {
  1491. G.DrawString("r", new Font("Marlett", 14, FontStyle.Regular), Brushes.DimGray, Bar.X + 59, Bar.Y + 18, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1492. }
  1493. break;
  1494. case _Type.OnOff:
  1495. if (Toggled)
  1496. {
  1497. G.DrawString("ON", new Font("Segoe UI", 12, FontStyle.Regular), Brushes.WhiteSmoke, Bar.X + 18, Bar.Y + 16, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1498. }
  1499. else
  1500. {
  1501. G.DrawString("OFF", new Font("Segoe UI", 12, FontStyle.Regular), Brushes.DimGray, Bar.X + 57, Bar.Y + 16, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1502. }
  1503. break;
  1504. case _Type.YesNo:
  1505. if (Toggled)
  1506. {
  1507. G.DrawString("YES", new Font("Segoe UI", 12, FontStyle.Regular), Brushes.WhiteSmoke, Bar.X + 19, Bar.Y + 16, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1508. }
  1509. else
  1510. {
  1511. G.DrawString("NO", new Font("Segoe UI", 12, FontStyle.Regular), Brushes.DimGray, Bar.X + 56, Bar.Y + 16, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1512. }
  1513. break;
  1514. case _Type.IO:
  1515. if (Toggled)
  1516. {
  1517. G.DrawString("I", new Font("Segoe UI", 12, FontStyle.Regular), Brushes.WhiteSmoke, Bar.X + 18, Bar.Y + 16, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1518. }
  1519. else
  1520. {
  1521. G.DrawString("O", new Font("Segoe UI", 12, FontStyle.Regular), Brushes.DimGray, Bar.X + 57, Bar.Y + 16, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  1522. }
  1523. break;
  1524. }
  1525. }
  1526. }
  1527.  
  1528. #endregion
  1529. #region CheckBox
  1530.  
  1531. [DefaultEvent("CheckedChanged")]
  1532. public class CheckBox : Control
  1533. {
  1534.  
  1535. #region Variables
  1536.  
  1537. private int X;
  1538. private bool _Checked = false;
  1539. private GraphicsPath Shape;
  1540.  
  1541. #endregion
  1542. #region Properties
  1543. private Color BG_ = Color.FromArgb(181, 41, 42);
  1544. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Cheked Color")]
  1545. public Color BG
  1546. {
  1547. get
  1548. {
  1549. return BG_;
  1550. }
  1551. set { BG_ = value; Invalidate(); }
  1552.  
  1553. }
  1554. public bool Checked
  1555. {
  1556. get
  1557. {
  1558. return _Checked;
  1559. }
  1560. set
  1561. {
  1562. _Checked = value;
  1563. Invalidate();
  1564. }
  1565. }
  1566.  
  1567. #endregion
  1568. #region EventArgs
  1569.  
  1570. public delegate void CheckedChangedEventHandler(object sender);
  1571. private CheckedChangedEventHandler CheckedChangedEvent;
  1572.  
  1573. public event CheckedChangedEventHandler CheckedChanged
  1574. {
  1575. add
  1576. {
  1577. CheckedChangedEvent = (CheckedChangedEventHandler)System.Delegate.Combine(CheckedChangedEvent, value);
  1578. }
  1579. remove
  1580. {
  1581. CheckedChangedEvent = (CheckedChangedEventHandler)System.Delegate.Remove(CheckedChangedEvent, value);
  1582. }
  1583. }
  1584.  
  1585.  
  1586. protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  1587. {
  1588. base.OnMouseMove(e);
  1589. X = e.Location.X;
  1590. Invalidate();
  1591. }
  1592. protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  1593. {
  1594. _Checked = !_Checked;
  1595. Focus();
  1596. if (CheckedChangedEvent != null)
  1597. CheckedChangedEvent(this);
  1598. base.OnMouseDown(e);
  1599. }
  1600.  
  1601. protected override void OnResize(EventArgs e)
  1602. {
  1603. base.OnResize(e);
  1604.  
  1605. this.Height = 16;
  1606.  
  1607. Shape = new GraphicsPath();
  1608. Shape.AddArc(0, 0, 10, 10, 180, 90);
  1609. Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  1610. Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  1611. Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  1612. Shape.CloseAllFigures();
  1613. Invalidate();
  1614. }
  1615.  
  1616. #endregion
  1617.  
  1618. public CheckBox()
  1619. {
  1620. Width = 148;
  1621. Height = 16;
  1622. Font = new Font("Microsoft Sans Serif", 9);
  1623. DoubleBuffered = true;
  1624. }
  1625.  
  1626. protected override void OnPaint(PaintEventArgs e)
  1627. {
  1628. base.OnPaint(e);
  1629. Graphics G = e.Graphics;
  1630. G.Clear(Parent.BackColor);
  1631.  
  1632. if (_Checked)
  1633. {
  1634. G.FillRectangle(new SolidBrush(Color.FromArgb(66, 76, 85)), new Rectangle(0, 0, 16, 16));
  1635. G.FillRectangle(new SolidBrush(Color.FromArgb(66, 76, 85)), new Rectangle(1, 1, 16 - 2, 16 - 2));
  1636. }
  1637. else
  1638. {
  1639. G.FillRectangle(new SolidBrush(Color.FromArgb(66, 76, 85)), new Rectangle(0, 0, 16, 16));
  1640. G.FillRectangle(new SolidBrush(Color.FromArgb(66, 76, 85)), new Rectangle(1, 1, 16 - 2, 16 - 2));
  1641. }
  1642.  
  1643. if (Enabled == true)
  1644. {
  1645. if (_Checked)
  1646. {
  1647. G.DrawString("a", new Font("Marlett", 16), new SolidBrush(BG), new Point(-5, -3));
  1648. }
  1649. }
  1650. else
  1651. {
  1652. if (_Checked)
  1653. {
  1654. G.DrawString("a", new Font("Marlett", 16), new SolidBrush(Color.Gray), new Point(-5, -3));
  1655. }
  1656. }
  1657.  
  1658. G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(116, 125, 132)), new Point(20, 0));
  1659. }
  1660. }
  1661. #endregion
  1662. #region Radio Button
  1663.  
  1664. [DefaultEvent("CheckedChanged")]
  1665. public class RadioButton : Control
  1666. {
  1667.  
  1668. #region Variables
  1669.  
  1670. private int X;
  1671. private bool _Checked;
  1672.  
  1673. #endregion
  1674. #region Properties
  1675. private Color BG_ = Color.FromArgb(181, 41, 42);
  1676. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Checked Color")]
  1677. public Color BG
  1678. {
  1679. get
  1680. {
  1681. return BG_;
  1682. }
  1683. set { BG_ = value; Invalidate(); }
  1684.  
  1685. }
  1686. public bool Checked
  1687. {
  1688. get
  1689. {
  1690. return _Checked;
  1691. }
  1692. set
  1693. {
  1694. _Checked = value;
  1695. InvalidateControls();
  1696. if (CheckedChangedEvent != null)
  1697. CheckedChangedEvent(this);
  1698. Invalidate();
  1699. }
  1700. }
  1701.  
  1702. #endregion
  1703. #region EventArgs
  1704.  
  1705. public delegate void CheckedChangedEventHandler(object sender);
  1706. private CheckedChangedEventHandler CheckedChangedEvent;
  1707.  
  1708. public event CheckedChangedEventHandler CheckedChanged
  1709. {
  1710. add
  1711. {
  1712. CheckedChangedEvent = (CheckedChangedEventHandler)System.Delegate.Combine(CheckedChangedEvent, value);
  1713. }
  1714. remove
  1715. {
  1716. CheckedChangedEvent = (CheckedChangedEventHandler)System.Delegate.Remove(CheckedChangedEvent, value);
  1717. }
  1718. }
  1719.  
  1720.  
  1721. protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  1722. {
  1723. if (!_Checked)
  1724. {
  1725. @Checked = true;
  1726. }
  1727. Focus();
  1728. base.OnMouseDown(e);
  1729. }
  1730. protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  1731. {
  1732. base.OnMouseMove(e);
  1733. X = e.X;
  1734. Invalidate();
  1735. }
  1736. protected override void OnTextChanged(System.EventArgs e)
  1737. {
  1738. base.OnTextChanged(e);
  1739. int textSize = 0;
  1740. textSize = (int)(this.CreateGraphics().MeasureString(Text, Font).Width);
  1741. this.Width = 28 + textSize;
  1742. }
  1743.  
  1744. protected override void OnResize(EventArgs e)
  1745. {
  1746. base.OnResize(e);
  1747. this.Height = 17;
  1748. }
  1749.  
  1750. #endregion
  1751.  
  1752. public RadioButton()
  1753. {
  1754. Width = 159;
  1755. Height = 17;
  1756. DoubleBuffered = true;
  1757. }
  1758.  
  1759. private void InvalidateControls()
  1760. {
  1761. if (!IsHandleCreated || !_Checked)
  1762. {
  1763. return;
  1764. }
  1765.  
  1766. foreach (Control _Control in Parent.Controls)
  1767. {
  1768. if (_Control != this && _Control is RadioButton)
  1769. {
  1770. ((RadioButton)_Control).Checked = false;
  1771. }
  1772. }
  1773. }
  1774.  
  1775. protected override void OnPaint(PaintEventArgs e)
  1776. {
  1777. base.OnPaint(e);
  1778. Graphics G = e.Graphics;
  1779. G.Clear(Parent.BackColor);
  1780. G.SmoothingMode = SmoothingMode.HighQuality;
  1781.  
  1782. G.FillEllipse(new SolidBrush(Color.FromArgb(66, 76, 85)), new Rectangle(0, 0, 16, 16));
  1783.  
  1784. if (_Checked)
  1785. {
  1786. G.DrawString("a", new Font("Marlett", 15), new SolidBrush(BG), new Point(-3, -2));
  1787. }
  1788.  
  1789. G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(116, 125, 132)), new Point(20, 0));
  1790. }
  1791. }
  1792.  
  1793. #endregion
  1794. #region TextBox
  1795.  
  1796. [DefaultEvent("TextChanged")]
  1797. public class t_TextBox : Control
  1798. {
  1799.  
  1800. #region Variables
  1801.  
  1802. public TextBox MonoFlatTB = new TextBox();
  1803. private int _maxchars = 32767;
  1804. private bool _ReadOnly;
  1805. private bool _Multiline;
  1806. private Image _Image;
  1807. private Size _ImageSize;
  1808. private HorizontalAlignment ALNType;
  1809. private bool isPasswordMasked = false;
  1810. private Pen P1;
  1811. private SolidBrush B1;
  1812. private GraphicsPath Shape;
  1813.  
  1814. #endregion
  1815. #region Properties
  1816.  
  1817. public HorizontalAlignment TextAlignment
  1818. {
  1819. get
  1820. {
  1821. return ALNType;
  1822. }
  1823. set
  1824. {
  1825. ALNType = value;
  1826. Invalidate();
  1827. }
  1828. }
  1829. public int MaxLength
  1830. {
  1831. get
  1832. {
  1833. return _maxchars;
  1834. }
  1835. set
  1836. {
  1837. _maxchars = value;
  1838. MonoFlatTB.MaxLength = MaxLength;
  1839. Invalidate();
  1840. }
  1841. }
  1842.  
  1843. public bool UseSystemPasswordChar
  1844. {
  1845. get
  1846. {
  1847. return isPasswordMasked;
  1848. }
  1849. set
  1850. {
  1851. MonoFlatTB.UseSystemPasswordChar = UseSystemPasswordChar;
  1852. isPasswordMasked = value;
  1853. Invalidate();
  1854. }
  1855. }
  1856. public bool ReadOnly
  1857. {
  1858. get
  1859. {
  1860. return _ReadOnly;
  1861. }
  1862. set
  1863. {
  1864. _ReadOnly = value;
  1865. if (MonoFlatTB != null)
  1866. {
  1867. MonoFlatTB.ReadOnly = value;
  1868. }
  1869. }
  1870. }
  1871. public bool Multiline
  1872. {
  1873. get
  1874. {
  1875. return _Multiline;
  1876. }
  1877. set
  1878. {
  1879. _Multiline = value;
  1880. if (MonoFlatTB != null)
  1881. {
  1882. MonoFlatTB.Multiline = value;
  1883.  
  1884. if (value)
  1885. {
  1886. MonoFlatTB.Height = Height - 23;
  1887. }
  1888. else
  1889. {
  1890. Height = MonoFlatTB.Height + 23;
  1891. }
  1892.  
  1893. }
  1894. Invalidate();
  1895. }
  1896. }
  1897.  
  1898. public Image Image
  1899. {
  1900. get
  1901. {
  1902. return _Image;
  1903. }
  1904. set
  1905. {
  1906. if (value == null)
  1907. {
  1908. _ImageSize = Size.Empty;
  1909. }
  1910. else
  1911. {
  1912. _ImageSize = value.Size;
  1913. }
  1914.  
  1915. _Image = value;
  1916.  
  1917. if (Image == null)
  1918. {
  1919. MonoFlatTB.Location = new Point(8, 10);
  1920. }
  1921. else
  1922. {
  1923. MonoFlatTB.Location = new Point(35, 11);
  1924. }
  1925. Invalidate();
  1926. }
  1927. }
  1928.  
  1929. protected Size ImageSize
  1930. {
  1931. get
  1932. {
  1933. return _ImageSize;
  1934. }
  1935. }
  1936.  
  1937. #endregion
  1938. #region EventArgs
  1939.  
  1940. private void _Enter(object Obj, EventArgs e)
  1941. {
  1942. P1 = new Pen(Color.FromArgb(181, 41, 42));
  1943. Refresh();
  1944. }
  1945.  
  1946. private void _Leave(object Obj, EventArgs e)
  1947. {
  1948. P1 = new Pen(Color.FromArgb(32, 41, 50));
  1949. Refresh();
  1950. }
  1951.  
  1952. private void OnBaseTextChanged(object s, EventArgs e)
  1953. {
  1954. Text = MonoFlatTB.Text;
  1955. }
  1956.  
  1957. protected override void OnTextChanged(System.EventArgs e)
  1958. {
  1959. base.OnTextChanged(e);
  1960. MonoFlatTB.Text = Text;
  1961. Invalidate();
  1962. }
  1963.  
  1964. protected override void OnForeColorChanged(System.EventArgs e)
  1965. {
  1966. base.OnForeColorChanged(e);
  1967. MonoFlatTB.ForeColor = ForeColor;
  1968. Invalidate();
  1969. }
  1970.  
  1971. protected override void OnFontChanged(System.EventArgs e)
  1972. {
  1973. base.OnFontChanged(e);
  1974. MonoFlatTB.Font = Font;
  1975. }
  1976.  
  1977. protected override void OnPaintBackground(PaintEventArgs e)
  1978. {
  1979. base.OnPaintBackground(e);
  1980. }
  1981.  
  1982. private void _OnKeyDown(object Obj, KeyEventArgs e)
  1983. {
  1984. if (e.Control && e.KeyCode == Keys.A)
  1985. {
  1986. MonoFlatTB.SelectAll();
  1987. e.SuppressKeyPress = true;
  1988. }
  1989. if (e.Control && e.KeyCode == Keys.C)
  1990. {
  1991. MonoFlatTB.Copy();
  1992. e.SuppressKeyPress = true;
  1993. }
  1994. }
  1995.  
  1996. protected override void OnResize(System.EventArgs e)
  1997. {
  1998. base.OnResize(e);
  1999. if (_Multiline)
  2000. {
  2001. MonoFlatTB.Height = Height - 23;
  2002. }
  2003. else
  2004. {
  2005. //Height = MonoFlatTB.Height + 23;
  2006. }
  2007.  
  2008. Shape = new GraphicsPath();
  2009. Shape.AddArc(0, 0, 10, 10, 180, 90);
  2010. Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2011. Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2012. Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  2013. Shape.CloseAllFigures();
  2014. }
  2015.  
  2016. protected override void OnGotFocus(System.EventArgs e)
  2017. {
  2018. base.OnGotFocus(e);
  2019. MonoFlatTB.Focus();
  2020. }
  2021.  
  2022. public void _TextChanged(System.Object sender, System.EventArgs e)
  2023. {
  2024. Text = MonoFlatTB.Text;
  2025. }
  2026.  
  2027. public void _BaseTextChanged(System.Object sender, System.EventArgs e)
  2028. {
  2029. MonoFlatTB.Text = Text;
  2030. }
  2031.  
  2032. #endregion
  2033.  
  2034. public void AddTextBox()
  2035. {
  2036. MonoFlatTB.Location = new Point(8, 10);
  2037. MonoFlatTB.Text = String.Empty;
  2038. MonoFlatTB.BorderStyle = BorderStyle.None;
  2039. MonoFlatTB.TextAlign = HorizontalAlignment.Left;
  2040. MonoFlatTB.Font = new Font("Tahoma", 11);
  2041. MonoFlatTB.UseSystemPasswordChar = UseSystemPasswordChar;
  2042. MonoFlatTB.Multiline = false;
  2043. MonoFlatTB.BackColor = Color.FromArgb(66, 76, 85);
  2044. MonoFlatTB.ScrollBars = ScrollBars.None;
  2045. MonoFlatTB.KeyDown += _OnKeyDown;
  2046. MonoFlatTB.Enter += _Enter;
  2047. MonoFlatTB.Leave += _Leave;
  2048. MonoFlatTB.TextChanged += OnBaseTextChanged;
  2049. }
  2050.  
  2051. public t_TextBox()
  2052. {
  2053. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2054. SetStyle(ControlStyles.UserPaint, true);
  2055.  
  2056. AddTextBox();
  2057. Controls.Add(MonoFlatTB);
  2058.  
  2059. P1 = new Pen(Color.FromArgb(32, 41, 50));
  2060. B1 = new SolidBrush(Color.FromArgb(66, 76, 85));
  2061. BackColor = Color.Transparent;
  2062. ForeColor = Color.FromArgb(176, 183, 191);
  2063.  
  2064. Text = null;
  2065. Font = new Font("Tahoma", 11);
  2066. Size = new Size(135, 43);
  2067. DoubleBuffered = true;
  2068. }
  2069.  
  2070. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2071. {
  2072. base.OnPaint(e);
  2073. Bitmap B = new Bitmap(Width, Height);
  2074. Graphics G = Graphics.FromImage(B);
  2075.  
  2076. G.SmoothingMode = SmoothingMode.AntiAlias;
  2077.  
  2078.  
  2079. if (Image == null)
  2080. {
  2081. MonoFlatTB.Width = Width - 18;
  2082. }
  2083. else
  2084. {
  2085. MonoFlatTB.Width = Width - 45;
  2086. }
  2087.  
  2088. MonoFlatTB.TextAlign = TextAlignment;
  2089. MonoFlatTB.UseSystemPasswordChar = UseSystemPasswordChar;
  2090.  
  2091. G.Clear(Color.Transparent);
  2092.  
  2093. G.FillPath(B1, Shape);
  2094. G.DrawPath(P1, Shape);
  2095.  
  2096. if (Image != null)
  2097. {
  2098. G.DrawImage(_Image, 5, 8, 24, 24);
  2099. // 24x24 is the perfect size of the image
  2100. }
  2101.  
  2102. e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  2103. G.Dispose();
  2104. B.Dispose();
  2105. }
  2106. }
  2107.  
  2108. #endregion
  2109. #region Panel
  2110.  
  2111. public class Panel : ContainerControl
  2112. {
  2113.  
  2114. private GraphicsPath Shape;
  2115.  
  2116. public Panel()
  2117. {
  2118. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2119. SetStyle(ControlStyles.UserPaint, true);
  2120.  
  2121. BackColor = Color.FromArgb(39, 51, 63);
  2122. this.Size = new Size(187, 117);
  2123. Padding = new Padding(5, 5, 5, 5);
  2124. DoubleBuffered = true;
  2125. }
  2126.  
  2127. protected override void OnResize(System.EventArgs e)
  2128. {
  2129. base.OnResize(e);
  2130.  
  2131. Shape = new GraphicsPath();
  2132. Shape.AddArc(0, 0, 10, 10, 180, 90);
  2133. Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2134. Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2135. Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  2136. Shape.CloseAllFigures();
  2137. }
  2138.  
  2139. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2140. {
  2141. base.OnPaint(e);
  2142. Bitmap B = new Bitmap(Width, Height);
  2143. var G = Graphics.FromImage(B);
  2144.  
  2145. G.SmoothingMode = SmoothingMode.HighQuality;
  2146.  
  2147. G.Clear(Color.FromArgb(32, 41, 50)); // Set control background to transparent
  2148. G.FillPath(new SolidBrush(Color.FromArgb(39, 51, 63)), Shape); // Draw RTB background
  2149. G.DrawPath(new Pen(Color.FromArgb(39, 51, 63)), Shape); // Draw border
  2150.  
  2151. G.Dispose();
  2152. e.Graphics.DrawImage((Image)(B.Clone()), 0, 0);
  2153. B.Dispose();
  2154. }
  2155. }
  2156.  
  2157. #endregion
  2158. #region Separator
  2159.  
  2160. public class Separator : Control
  2161. {
  2162.  
  2163. public Separator()
  2164. {
  2165. SetStyle(ControlStyles.ResizeRedraw, true);
  2166. this.Size = (System.Drawing.Size)(new Point(120, 10));
  2167. }
  2168. private Color BG_ = Color.FromArgb(181, 41, 42);
  2169. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Top Color")]
  2170. public Color BG
  2171. {
  2172. get
  2173. {
  2174. return BG_;
  2175. }
  2176. set { BG_ = value; Invalidate(); }
  2177.  
  2178. }
  2179. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2180. {
  2181. base.OnPaint(e);
  2182. e.Graphics.DrawLine(new Pen(BG), 0, 5, Width, 5);
  2183. }
  2184. }
  2185.  
  2186. #endregion
  2187. #region TrackBar
  2188.  
  2189. [DefaultEvent("ValueChanged")]
  2190. public class TrackBar : Control
  2191. {
  2192.  
  2193. #region Enums
  2194.  
  2195. public enum ValueDivisor
  2196. {
  2197. By1 = 1,
  2198. By10 = 10,
  2199. By100 = 100,
  2200. By1000 = 1000
  2201. }
  2202.  
  2203. #endregion
  2204. #region Variables
  2205.  
  2206. private Rectangle FillValue;
  2207. private Rectangle PipeBorder;
  2208. private Rectangle TrackBarHandleRect;
  2209. private bool Cap;
  2210. private int ValueDrawer;
  2211.  
  2212. private Size ThumbSize = new Size(14, 14);
  2213. private Rectangle TrackThumb;
  2214.  
  2215. private int _Minimum = 0;
  2216. private int _Maximum = 10;
  2217. private int _Value = 0;
  2218.  
  2219. private bool _JumpToMouse = false;
  2220. private ValueDivisor DividedValue = ValueDivisor.By1;
  2221.  
  2222. #endregion
  2223. #region Properties
  2224. private Color BG_ = Color.FromArgb(181, 41, 42);
  2225. [DefaultValue(typeof(Color), "181, 41, 42"), DisplayName("Top Color")]
  2226. public Color BG
  2227. {
  2228. get
  2229. {
  2230. return BG_;
  2231. }
  2232. set { BG_ = value; Invalidate(); }
  2233.  
  2234. }
  2235. public int Minimum
  2236. {
  2237. get
  2238. {
  2239. return _Minimum;
  2240. }
  2241. set
  2242. {
  2243.  
  2244. if (value >= _Maximum)
  2245. {
  2246. value = _Maximum - 10;
  2247. }
  2248. if (_Value < value)
  2249. {
  2250. _Value = value;
  2251. }
  2252.  
  2253. _Minimum = value;
  2254. Invalidate();
  2255. }
  2256. }
  2257.  
  2258. public int Maximum
  2259. {
  2260. get
  2261. {
  2262. return _Maximum;
  2263. }
  2264. set
  2265. {
  2266.  
  2267. if (value <= _Minimum)
  2268. {
  2269. value = _Minimum + 10;
  2270. }
  2271. if (_Value > value)
  2272. {
  2273. _Value = value;
  2274. }
  2275.  
  2276. _Maximum = value;
  2277. Invalidate();
  2278. }
  2279. }
  2280.  
  2281. public delegate void ValueChangedEventHandler();
  2282. private ValueChangedEventHandler ValueChangedEvent;
  2283.  
  2284. public event ValueChangedEventHandler ValueChanged
  2285. {
  2286. add
  2287. {
  2288. ValueChangedEvent = (ValueChangedEventHandler)System.Delegate.Combine(ValueChangedEvent, value);
  2289. }
  2290. remove
  2291. {
  2292. ValueChangedEvent = (ValueChangedEventHandler)System.Delegate.Remove(ValueChangedEvent, value);
  2293. }
  2294. }
  2295.  
  2296. public int Value
  2297. {
  2298. get
  2299. {
  2300. return _Value;
  2301. }
  2302. set
  2303. {
  2304. if (_Value != value)
  2305. {
  2306. if (value < _Minimum)
  2307. {
  2308. _Value = _Minimum;
  2309. }
  2310. else
  2311. {
  2312. if (value > _Maximum)
  2313. {
  2314. _Value = _Maximum;
  2315. }
  2316. else
  2317. {
  2318. _Value = value;
  2319. }
  2320. }
  2321. Invalidate();
  2322. if (ValueChangedEvent != null)
  2323. ValueChangedEvent();
  2324. }
  2325. }
  2326. }
  2327.  
  2328. public ValueDivisor ValueDivison
  2329. {
  2330. get
  2331. {
  2332. return DividedValue;
  2333. }
  2334. set
  2335. {
  2336. DividedValue = value;
  2337. Invalidate();
  2338. }
  2339. }
  2340.  
  2341. [Browsable(false)]
  2342. public float ValueToSet
  2343. {
  2344. get
  2345. {
  2346. return _Value / (int)DividedValue;
  2347. }
  2348. set
  2349. {
  2350. Value = (int)(value * (int)DividedValue);
  2351. }
  2352. }
  2353.  
  2354. public bool JumpToMouse
  2355. {
  2356. get
  2357. {
  2358. return _JumpToMouse;
  2359. }
  2360. set
  2361. {
  2362. _JumpToMouse = value;
  2363. Invalidate();
  2364. }
  2365. }
  2366.  
  2367. #endregion
  2368. #region EventArgs
  2369.  
  2370. protected override void OnMouseMove(MouseEventArgs e)
  2371. {
  2372. base.OnMouseMove(e);
  2373. checked
  2374. {
  2375. bool flag = this.Cap && e.X > -1 && e.X < this.Width + 1;
  2376. if (flag)
  2377. {
  2378. this.Value = this._Minimum + (int)Math.Round((double)(this._Maximum - this._Minimum) * ((double)e.X / (double)this.Width));
  2379. }
  2380. }
  2381. }
  2382.  
  2383. protected override void OnMouseDown(MouseEventArgs e)
  2384. {
  2385. base.OnMouseDown(e);
  2386. if (e.Button == MouseButtons.Left)
  2387. {
  2388. this.ValueDrawer = (int)Math.Round(((double)(this._Value - this._Minimum) / (double)(this._Maximum - this._Minimum)) * (double)(this.Width - 11));
  2389. TrackBarHandleRect = new Rectangle(ValueDrawer, 0, 25, 25);
  2390. Cap = TrackBarHandleRect.Contains(e.Location);
  2391. Focus();
  2392. if (_JumpToMouse)
  2393. {
  2394. this.Value = this._Minimum + (int)Math.Round((double)(this._Maximum - this._Minimum) * ((double)e.X / (double)this.Width));
  2395. }
  2396. }
  2397. }
  2398.  
  2399. protected override void OnMouseUp(MouseEventArgs e)
  2400. {
  2401. base.OnMouseUp(e);
  2402. Cap = false;
  2403. }
  2404.  
  2405. #endregion
  2406.  
  2407. public TrackBar()
  2408. {
  2409. SetStyle((System.Windows.Forms.ControlStyles)(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer), true);
  2410.  
  2411. Size = new Size(80, 22);
  2412. MinimumSize = new Size(47, 22);
  2413. }
  2414.  
  2415. protected override void OnResize(EventArgs e)
  2416. {
  2417. base.OnResize(e);
  2418. Height = 22;
  2419. }
  2420.  
  2421. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2422. {
  2423. base.OnPaint(e);
  2424. Graphics G = e.Graphics;
  2425.  
  2426. G.Clear(Parent.BackColor);
  2427. G.SmoothingMode = SmoothingMode.AntiAlias;
  2428. TrackThumb = new Rectangle(7, 10, Width - 16, 2);
  2429. PipeBorder = new Rectangle(1, 10, Width - 3, 2);
  2430.  
  2431. try
  2432. {
  2433. this.ValueDrawer = (int)Math.Round(((double)(this._Value - this._Minimum) / (double)(this._Maximum - this._Minimum)) * (double)(this.Width));
  2434. }
  2435. catch (Exception)
  2436. {
  2437. }
  2438.  
  2439. TrackBarHandleRect = new Rectangle(ValueDrawer, 0, 3, 20);
  2440.  
  2441. G.FillRectangle(new SolidBrush(Color.FromArgb(124, 131, 137)), PipeBorder);
  2442. FillValue = new Rectangle(0, 10, TrackBarHandleRect.X + TrackBarHandleRect.Width - 4, 3);
  2443.  
  2444. G.ResetClip();
  2445.  
  2446. G.SmoothingMode = SmoothingMode.Default;
  2447. G.DrawRectangle(new Pen(Color.FromArgb(124, 131, 137)), PipeBorder); // Draw pipe border
  2448. G.FillRectangle(new SolidBrush(BG), FillValue);
  2449.  
  2450. G.ResetClip();
  2451.  
  2452. G.SmoothingMode = SmoothingMode.HighQuality;
  2453.  
  2454. G.FillEllipse(new SolidBrush(BG), this.TrackThumb.X + (int)Math.Round(unchecked((double)this.TrackThumb.Width * ((double)this.Value / (double)this.Maximum))) - (int)Math.Round((double)this.ThumbSize.Width / 2.0), this.TrackThumb.Y + (int)Math.Round((double)this.TrackThumb.Height / 2.0) - (int)Math.Round((double)this.ThumbSize.Height / 2.0), this.ThumbSize.Width, this.ThumbSize.Height);
  2455. G.DrawEllipse(new Pen(BG), this.TrackThumb.X + (int)Math.Round(unchecked((double)this.TrackThumb.Width * ((double)this.Value / (double)this.Maximum))) - (int)Math.Round((double)this.ThumbSize.Width / 2.0), this.TrackThumb.Y + (int)Math.Round((double)this.TrackThumb.Height / 2.0) - (int)Math.Round((double)this.ThumbSize.Height / 2.0), this.ThumbSize.Width, this.ThumbSize.Height);
  2456. }
  2457. }
  2458.  
  2459. #endregion
  2460. #region NotificationBox
  2461.  
  2462. public class NotificationBox : Control
  2463. {
  2464.  
  2465. #region Variables
  2466.  
  2467. private Point CloseCoordinates;
  2468. private bool IsOverClose;
  2469. private int _BorderCurve = 8;
  2470. private GraphicsPath CreateRoundPath;
  2471. private string NotificationText = null;
  2472. private Type _NotificationType;
  2473. private bool _RoundedCorners;
  2474. private bool _ShowCloseButton;
  2475. private Image _Image;
  2476. private Size _ImageSize;
  2477.  
  2478. #endregion
  2479. #region Enums
  2480.  
  2481. // Create a list of Notification Types
  2482. public enum Type
  2483. {
  2484. @Notice,
  2485. @Success,
  2486. @Warning,
  2487. @Error
  2488. }
  2489.  
  2490. #endregion
  2491. #region Custom Properties
  2492. private Color BG_ = Color.FromArgb(111, 177, 199);
  2493. [DefaultValue(typeof(Color), "111, 177, 199"), DisplayName("Notif Color")]
  2494. public Color BG
  2495. {
  2496. get
  2497. {
  2498. return BG_;
  2499. }
  2500. set { BG_ = value; Invalidate(); }
  2501.  
  2502. }
  2503.  
  2504. // Create a NotificationType property and add the Type enum to it
  2505. public Type NotificationType
  2506. {
  2507. get
  2508. {
  2509. return _NotificationType;
  2510. }
  2511. set
  2512. {
  2513. _NotificationType = value;
  2514. Invalidate();
  2515. }
  2516. }
  2517. // Boolean value to determine whether the control should use border radius
  2518. public bool RoundCorners
  2519. {
  2520. get
  2521. {
  2522. return _RoundedCorners;
  2523. }
  2524. set
  2525. {
  2526. _RoundedCorners = value;
  2527. Invalidate();
  2528. }
  2529. }
  2530. // Boolean value to determine whether the control should draw the close button
  2531. public bool ShowCloseButton
  2532. {
  2533. get
  2534. {
  2535. return _ShowCloseButton;
  2536. }
  2537. set
  2538. {
  2539. _ShowCloseButton = value;
  2540. Invalidate();
  2541. }
  2542. }
  2543. // Integer value to determine the curve level of the borders
  2544. public int BorderCurve
  2545. {
  2546. get
  2547. {
  2548. return _BorderCurve;
  2549. }
  2550. set
  2551. {
  2552. _BorderCurve = value;
  2553. Invalidate();
  2554. }
  2555. }
  2556. // Image value to determine whether the control should draw an image before the header
  2557. public Image Image
  2558. {
  2559. get
  2560. {
  2561. return _Image;
  2562. }
  2563. set
  2564. {
  2565. if (value == null)
  2566. {
  2567. _ImageSize = Size.Empty;
  2568. }
  2569. else
  2570. {
  2571. _ImageSize = value.Size;
  2572. }
  2573.  
  2574. _Image = value;
  2575. Invalidate();
  2576. }
  2577. }
  2578. // Size value - returns the image size
  2579. protected Size ImageSize
  2580. {
  2581. get
  2582. {
  2583. return _ImageSize;
  2584. }
  2585. }
  2586.  
  2587. #endregion
  2588. #region EventArgs
  2589.  
  2590. protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  2591. {
  2592. base.OnMouseMove(e);
  2593.  
  2594. // Decides the location of the drawn ellipse. If mouse is over the correct coordinates, "IsOverClose" boolean will be triggered to draw the ellipse
  2595. if (e.X >= Width - 19 && e.X <= Width - 10 && e.Y > CloseCoordinates.Y && e.Y < CloseCoordinates.Y + 12)
  2596. {
  2597. IsOverClose = true;
  2598. }
  2599. else
  2600. {
  2601. IsOverClose = false;
  2602. }
  2603. // Updates the control
  2604. Invalidate();
  2605. }
  2606. protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  2607. {
  2608. base.OnMouseDown(e);
  2609.  
  2610. // Disposes the control when the close button is clicked
  2611. if (_ShowCloseButton == true)
  2612. {
  2613. if (IsOverClose)
  2614. {
  2615. Dispose();
  2616. }
  2617. }
  2618. }
  2619.  
  2620. #endregion
  2621.  
  2622. internal GraphicsPath CreateRoundRect(Rectangle r, int curve)
  2623. {
  2624. // Draw a border radius
  2625. try
  2626. {
  2627. CreateRoundPath = new GraphicsPath(FillMode.Winding);
  2628. CreateRoundPath.AddArc(r.X, r.Y, curve, curve, 180.0F, 90.0F);
  2629. CreateRoundPath.AddArc(r.Right - curve, r.Y, curve, curve, 270.0F, 90.0F);
  2630. CreateRoundPath.AddArc(r.Right - curve, r.Bottom - curve, curve, curve, 0.0F, 90.0F);
  2631. CreateRoundPath.AddArc(r.X, r.Bottom - curve, curve, curve, 90.0F, 90.0F);
  2632. CreateRoundPath.CloseFigure();
  2633. }
  2634. catch (Exception ex)
  2635. {
  2636. MessageBox.Show(ex.Message + Environment.NewLine + Environment.NewLine + "Value must be either \'1\' or higher", "Invalid Integer", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  2637. // Return to the default border curve if the parameter is less than "1"
  2638. _BorderCurve = 8;
  2639. BorderCurve = 8;
  2640. }
  2641. return CreateRoundPath;
  2642. }
  2643.  
  2644. public NotificationBox()
  2645. {
  2646. SetStyle((System.Windows.Forms.ControlStyles)(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw), true);
  2647.  
  2648. Font = new Font("Tahoma", 9);
  2649. this.MinimumSize = new Size(100, 40);
  2650. RoundCorners = false;
  2651. ShowCloseButton = true;
  2652. }
  2653.  
  2654. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2655. {
  2656. base.OnPaint(e);
  2657.  
  2658. // Declare Graphics to draw the control
  2659. Graphics GFX = e.Graphics;
  2660. // Declare Color to paint the control's Text, Background and Border
  2661. Color ForeColor = new Color();
  2662. Color BackgroundColor = new Color();
  2663. Color BorderColor = new Color();
  2664. // Determine the header Notification Type font
  2665. Font TypeFont = new Font(Font.FontFamily, Font.Size, FontStyle.Bold);
  2666. // Decalre a new rectangle to draw the control inside it
  2667. Rectangle MainRectangle = new Rectangle(0, 0, Width - 1, Height - 1);
  2668. // Declare a GraphicsPath to create a border radius
  2669. GraphicsPath CrvBorderPath = CreateRoundRect(MainRectangle, _BorderCurve);
  2670.  
  2671. GFX.SmoothingMode = SmoothingMode.HighQuality;
  2672. GFX.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  2673. GFX.Clear(Parent.BackColor);
  2674.  
  2675. switch (_NotificationType)
  2676. {
  2677. case Type.Notice:
  2678. BackgroundColor = BG;
  2679. BorderColor = BG;
  2680. ForeColor = Color.White;
  2681. break;
  2682. case Type.Success:
  2683. BackgroundColor = Color.FromArgb(91, 195, 162);
  2684. BorderColor = Color.FromArgb(91, 195, 162);
  2685. ForeColor = Color.White;
  2686. break;
  2687. case Type.Warning:
  2688. BackgroundColor = Color.FromArgb(254, 209, 108);
  2689. BorderColor = Color.FromArgb(254, 209, 108);
  2690. ForeColor = Color.DimGray;
  2691. break;
  2692. case Type.Error:
  2693. BackgroundColor = Color.FromArgb(217, 103, 93);
  2694. BorderColor = Color.FromArgb(217, 103, 93);
  2695. ForeColor = Color.White;
  2696. break;
  2697. }
  2698.  
  2699. if (_RoundedCorners == true)
  2700. {
  2701. GFX.FillPath(new SolidBrush(BackgroundColor), CrvBorderPath);
  2702. GFX.DrawPath(new Pen(BorderColor), CrvBorderPath);
  2703. }
  2704. else
  2705. {
  2706. GFX.FillRectangle(new SolidBrush(BackgroundColor), MainRectangle);
  2707. GFX.DrawRectangle(new Pen(BorderColor), MainRectangle);
  2708. }
  2709.  
  2710. switch (_NotificationType)
  2711. {
  2712. case Type.Notice:
  2713. NotificationText = "NOTICE";
  2714. break;
  2715. case Type.Success:
  2716. NotificationText = "SUCCESS";
  2717. break;
  2718. case Type.Warning:
  2719. NotificationText = "WARNING";
  2720. break;
  2721. case Type.Error:
  2722. NotificationText = "ERROR";
  2723. break;
  2724. }
  2725.  
  2726. if (Image == null)
  2727. {
  2728. GFX.DrawString(NotificationText, TypeFont, new SolidBrush(ForeColor), new Point(10, 5));
  2729. GFX.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(10, 21, Width - 17, Height - 5));
  2730. }
  2731. else
  2732. {
  2733. GFX.DrawImage(_Image, 12, 4, 16, 16);
  2734. GFX.DrawString(NotificationText, TypeFont, new SolidBrush(ForeColor), new Point(30, 5));
  2735. GFX.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(10, 21, Width - 17, Height - 5));
  2736. }
  2737.  
  2738. CloseCoordinates = new Point(Width - 26, 4);
  2739.  
  2740. if (_ShowCloseButton == true)
  2741. {
  2742. // Draw the close button
  2743. GFX.DrawString("r", new Font("Marlett", 7, FontStyle.Regular), new SolidBrush(Color.FromArgb(130, 130, 130)), new Rectangle(Width - 20, 10, Width, Height), new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Near });
  2744. }
  2745.  
  2746. CrvBorderPath.Dispose();
  2747. }
  2748. }
  2749.  
  2750. #endregion
  2751. #region tabcontrol
  2752. public class t_TabControl : TabControl
  2753. {
  2754. private static List<WeakReference> __ENCList = new List<WeakReference>();
  2755. [DebuggerNonUserCode]
  2756. private static void __ENCAddToList(object value)
  2757. {
  2758. List<WeakReference> _ENCList = t_TabControl.__ENCList;
  2759. Monitor.Enter(_ENCList);
  2760. checked
  2761. {
  2762. try
  2763. {
  2764. bool flag = t_TabControl.__ENCList.Count == t_TabControl.__ENCList.Capacity;
  2765. if (flag)
  2766. {
  2767. int num = 0;
  2768. int arg_3F_0 = 0;
  2769. int num2 = t_TabControl.__ENCList.Count - 1;
  2770. int num3 = arg_3F_0;
  2771. while (true)
  2772. {
  2773. int arg_90_0 = num3;
  2774. int num4 = num2;
  2775. if (arg_90_0 > num4)
  2776. {
  2777. break;
  2778. }
  2779. WeakReference weakReference = t_TabControl.__ENCList[num3];
  2780. flag = weakReference.IsAlive;
  2781. if (flag)
  2782. {
  2783. bool flag2 = num3 != num;
  2784. if (flag2)
  2785. {
  2786. t_TabControl.__ENCList[num] = t_TabControl.__ENCList[num3];
  2787. }
  2788. num++;
  2789. }
  2790. num3++;
  2791. }
  2792. t_TabControl.__ENCList.RemoveRange(num, t_TabControl.__ENCList.Count - num);
  2793. t_TabControl.__ENCList.Capacity = t_TabControl.__ENCList.Count;
  2794. }
  2795. t_TabControl.__ENCList.Add(new WeakReference(RuntimeHelpers.GetObjectValue(value)));
  2796. }
  2797. finally
  2798. {
  2799. Monitor.Exit(_ENCList);
  2800. }
  2801. }
  2802. }
  2803. private Color BG_ = Color.FromArgb(111, 177, 199);
  2804. [DefaultValue(typeof(Color), "111, 177, 199"), DisplayName("TabS Color")]
  2805. public Color BG
  2806. {
  2807. get
  2808. {
  2809. return BG_;
  2810. }
  2811. set { BG_ = value; Invalidate(); }
  2812.  
  2813. }
  2814. private Color AT_ = Color.FromArgb(111, 177, 199);
  2815. [DefaultValue(typeof(Color), "111, 177, 199"), DisplayName("Tab Color")]
  2816. public Color AT
  2817. {
  2818. get
  2819. {
  2820. return AT_;
  2821. }
  2822. set { AT_ = value; Invalidate(); }
  2823.  
  2824. }
  2825. private Color TX_ = Color.White;
  2826. [DefaultValue(typeof(Color), "White"), DisplayName("TextTab Color")]
  2827. public Color TX
  2828. {
  2829. get
  2830. {
  2831. return TX_;
  2832. }
  2833. set { TX_ = value; Invalidate(); }
  2834.  
  2835. }
  2836. public t_TabControl()
  2837. {
  2838. t_TabControl.__ENCAddToList(this);
  2839. this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
  2840. Size size = new Size(0, 34);
  2841. this.ItemSize = size;
  2842. size = new Size(24, 0);
  2843. this.Padding = (Point)size;
  2844. this.Font = new Font("Arial", 12f);
  2845. }
  2846. protected override void CreateHandle()
  2847. {
  2848. base.CreateHandle();
  2849. this.Alignment = TabAlignment.Top;
  2850. }
  2851. protected override void OnPaint(PaintEventArgs e)
  2852. {
  2853. base.OnPaint(e);
  2854. Graphics graphics = e.Graphics;
  2855. graphics.SmoothingMode = SmoothingMode.HighQuality;
  2856. graphics.Clear(this.Parent.BackColor);
  2857. Color color = default(Color);
  2858. int arg_3D_0 = 0;
  2859. checked
  2860. {
  2861. int num = this.TabCount - 1;
  2862. int num2 = arg_3D_0;
  2863. while (true)
  2864. {
  2865. int arg_369_0 = num2;
  2866. int num3 = num;
  2867. if (arg_369_0 > num3)
  2868. {
  2869. break;
  2870. }
  2871. Rectangle tabRect = this.GetTabRect(num2);
  2872. bool flag = num2 == this.SelectedIndex;
  2873. Point location;
  2874. if (flag)
  2875. {
  2876. color = TX;
  2877. Graphics arg_C5_0 = graphics;
  2878. Pen arg_C5_1 = new Pen(BG);
  2879. Point point = new Point(tabRect.X - 2, tabRect.Height - 1);
  2880. Point arg_C5_2 = point;
  2881. location = new Point(tabRect.X + tabRect.Width - 2, tabRect.Height - 1);
  2882. arg_C5_0.DrawLine(arg_C5_1, arg_C5_2, location);
  2883. Graphics arg_11B_0 = graphics;
  2884. Pen arg_11B_1 = new Pen(AT);
  2885. location = new Point(tabRect.X - 2, tabRect.Height);
  2886. Point arg_11B_2 = location;
  2887. point = new Point(tabRect.X + tabRect.Width - 2, tabRect.Height);
  2888. arg_11B_0.DrawLine(arg_11B_1, arg_11B_2, point);
  2889. }
  2890. else
  2891. {
  2892. color = Color.FromArgb(160, 160, 160);
  2893. Graphics arg_18D_0 = graphics;
  2894. Pen arg_18D_1 = new Pen(Color.Transparent);
  2895. location = new Point(tabRect.X - 2, tabRect.Height - 1);
  2896. Point arg_18D_2 = location;
  2897. Point point = new Point(tabRect.X + tabRect.Width - 2, tabRect.Height - 1);
  2898. arg_18D_0.DrawLine(arg_18D_1, arg_18D_2, point);
  2899. Graphics arg_1E0_0 = graphics;
  2900. Pen arg_1E0_1 = new Pen(Color.Transparent);
  2901. location = new Point(tabRect.X - 2, tabRect.Height);
  2902. Point arg_1E0_2 = location;
  2903. point = new Point(tabRect.X + tabRect.Width - 2, tabRect.Height);
  2904. arg_1E0_0.DrawLine(arg_1E0_1, arg_1E0_2, point);
  2905. }
  2906. flag = (num2 != 0);
  2907. if (flag)
  2908. {
  2909. Graphics arg_23D_0 = graphics;
  2910. Pen arg_23D_1 = new Pen(Color.Transparent);
  2911. location = new Point(tabRect.X - 4, tabRect.Height - 7);
  2912. Point arg_23D_2 = location;
  2913. Point point = new Point(tabRect.X + 4, tabRect.Y + 6);
  2914. arg_23D_0.DrawLine(arg_23D_1, arg_23D_2, point);
  2915. }
  2916. location = tabRect.Location;
  2917. int x = (int)Math.Round(unchecked((double)location.X + (double)tabRect.Width / 2.0 - (double)(graphics.MeasureString(this.TabPages[num2].Text, this.Font).Width / 2f)));
  2918. location = tabRect.Location;
  2919. int y = (int)Math.Round(unchecked((double)location.Y + (double)tabRect.Height / 2.0 - (double)(graphics.MeasureString(this.TabPages[num2].Text, this.Font).Height / 2f)));
  2920. Graphics arg_329_0 = graphics;
  2921. string arg_329_1 = this.TabPages[num2].Text;
  2922. Font arg_329_2 = this.Font;
  2923. Brush arg_329_3 = new SolidBrush(color);
  2924. location = new Point(x, y);
  2925. arg_329_0.DrawString(arg_329_1, arg_329_2, arg_329_3, location);
  2926. try
  2927. {
  2928. this.TabPages[num2].BackColor = this.Parent.BackColor;
  2929. }
  2930. catch (Exception arg_34F_0)
  2931. {
  2932. // ProjectData.SetProjectError(arg_34F_0);
  2933. // ProjectData.ClearProjectError();
  2934. }
  2935. num2++;
  2936. }
  2937. }
  2938. }
  2939. }
  2940.  
  2941. #endregion
  2942. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement