Advertisement
Astekk

italk theme c#

Dec 22nd, 2014
4,508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 152.60 KB | None | 0 0
  1.  
  2.  
  3. #region Imports
  4.  
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Drawing;
  10. using System.Drawing.Drawing2D;
  11. using System.Drawing.Text;
  12. using System.Runtime.InteropServices;
  13. using System.Text;
  14. using System.Windows.Forms;
  15.  
  16. #endregion
  17. #region RoundRect
  18.  
  19. // [CREDIT][DO NOT REMOVE]
  20. //
  21. // This module was written by Aeonhack
  22. //
  23. // [CREDIT][DO NOT REMOVE]
  24.  
  25. static class RoundRectangle
  26. {
  27. public static GraphicsPath RoundRect(Rectangle Rectangle, int Curve)
  28. {
  29. GraphicsPath GP = new GraphicsPath();
  30. int EndArcWidth = Curve * 2;
  31. GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -180, 90);
  32. GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -90, 90);
  33. GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 0, 90);
  34. GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 90, 90);
  35. GP.AddLine(new Point(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
  36. return GP;
  37. }
  38.  
  39. public static GraphicsPath RoundRect(int X, int Y, int Width, int Height, int Curve)
  40. {
  41. Rectangle Rectangle = new Rectangle(X, Y, Width, Height);
  42. GraphicsPath GP = new GraphicsPath();
  43. int EndArcWidth = Curve * 2;
  44. GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -180, 90);
  45. GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -90, 90);
  46. GP.AddArc(new Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 0, 90);
  47. GP.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 90, 90);
  48. GP.AddLine(new Point(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
  49. return GP;
  50. }
  51. }
  52.  
  53. #endregion
  54.  
  55. //|------DO-NOT-REMOVE------|
  56. //
  57. // Creator: HazelDev
  58. // Site : HazelDev.com
  59. // Created: 23.Jul.2014
  60. // Changed: 29.Sep.2014
  61. // Version: 1.3.0
  62. //
  63. //|------DO-NOT-REMOVE------|
  64.  
  65. #region Control Renderer
  66.  
  67. #region Color Table
  68.  
  69. public abstract class xColorTable
  70. {
  71. public abstract Color TextColor { get; }
  72. public abstract Color Background { get; }
  73. public abstract Color SelectionBorder { get; }
  74. public abstract Color SelectionTopGradient { get; }
  75. public abstract Color SelectionMidGradient { get; }
  76. public abstract Color SelectionBottomGradient { get; }
  77. public abstract Color PressedBackground { get; }
  78. public abstract Color CheckedBackground { get; }
  79. public abstract Color CheckedSelectedBackground { get; }
  80. public abstract Color DropdownBorder { get; }
  81. public abstract Color Arrow { get; }
  82. public abstract Color OverflowBackground { get; }
  83. }
  84.  
  85. public abstract class ColorTable
  86. {
  87. public abstract xColorTable CommonColorTable { get; }
  88. public abstract Color BackgroundTopGradient { get; }
  89. public abstract Color BackgroundBottomGradient { get; }
  90. public abstract Color DroppedDownItemBackground { get; }
  91. public abstract Color DropdownTopGradient { get; }
  92. public abstract Color DropdownBottomGradient { get; }
  93. public abstract Color Separator { get; }
  94. public abstract Color ImageMargin { get; }
  95. }
  96.  
  97. public class MSColorTable : ColorTable
  98. {
  99.  
  100. private xColorTable _CommonColorTable;
  101.  
  102. public MSColorTable()
  103. {
  104. _CommonColorTable = new DefaultCColorTable();
  105. }
  106.  
  107. public override xColorTable CommonColorTable
  108. {
  109. get
  110. {
  111. return _CommonColorTable;
  112. }
  113. }
  114.  
  115. public override System.Drawing.Color BackgroundTopGradient
  116. {
  117. get
  118. {
  119. return Color.FromArgb(246, 246, 246);
  120. }
  121. }
  122.  
  123. public override System.Drawing.Color BackgroundBottomGradient
  124. {
  125. get
  126. {
  127. return Color.FromArgb(226, 226, 226);
  128. }
  129. }
  130.  
  131. public override System.Drawing.Color DropdownTopGradient
  132. {
  133. get
  134. {
  135. return Color.FromArgb(246, 246, 246);
  136. }
  137. }
  138.  
  139. public override System.Drawing.Color DropdownBottomGradient
  140. {
  141. get
  142. {
  143. return Color.FromArgb(246, 246, 246);
  144. }
  145. }
  146.  
  147. public override System.Drawing.Color DroppedDownItemBackground
  148. {
  149. get
  150. {
  151. return Color.FromArgb(240, 240, 240);
  152. }
  153. }
  154.  
  155. public override System.Drawing.Color Separator
  156. {
  157. get
  158. {
  159. return Color.FromArgb(190, 195, 203);
  160. }
  161. }
  162.  
  163. public override System.Drawing.Color ImageMargin
  164. {
  165. get
  166. {
  167. return Color.FromArgb(240, 240, 240);
  168. }
  169. }
  170. }
  171.  
  172. public class DefaultCColorTable : xColorTable
  173. {
  174.  
  175. public override System.Drawing.Color CheckedBackground
  176. {
  177. get
  178. {
  179. return Color.FromArgb(230, 230, 230);
  180. }
  181. }
  182.  
  183. public override System.Drawing.Color CheckedSelectedBackground
  184. {
  185. get
  186. {
  187. return Color.FromArgb(230, 230, 230);
  188. }
  189. }
  190.  
  191. public override System.Drawing.Color SelectionBorder
  192. {
  193. get
  194. {
  195. return Color.FromArgb(180, 180, 180);
  196. }
  197. }
  198.  
  199. public override System.Drawing.Color SelectionTopGradient
  200. {
  201. get
  202. {
  203. return Color.FromArgb(240, 240, 240);
  204. }
  205. }
  206.  
  207. public override System.Drawing.Color SelectionMidGradient
  208. {
  209. get
  210. {
  211. return Color.FromArgb(235, 235, 235);
  212. }
  213. }
  214.  
  215. public override System.Drawing.Color SelectionBottomGradient
  216. {
  217. get
  218. {
  219. return Color.FromArgb(230, 230, 230);
  220. }
  221. }
  222.  
  223. public override System.Drawing.Color PressedBackground
  224. {
  225. get
  226. {
  227. return Color.FromArgb(232, 232, 232);
  228. }
  229. }
  230.  
  231. public override System.Drawing.Color TextColor
  232. {
  233. get
  234. {
  235. return Color.FromArgb(80, 80, 80);
  236. }
  237. }
  238.  
  239. public override System.Drawing.Color Background
  240. {
  241. get
  242. {
  243. return Color.FromArgb(188, 199, 216);
  244. }
  245. }
  246.  
  247. public override System.Drawing.Color DropdownBorder
  248. {
  249. get
  250. {
  251. return Color.LightGray;
  252. }
  253. }
  254.  
  255. public override System.Drawing.Color Arrow
  256. {
  257. get
  258. {
  259. return Color.Black;
  260. }
  261. }
  262.  
  263. public override System.Drawing.Color OverflowBackground
  264. {
  265. get
  266. {
  267. return Color.FromArgb(213, 220, 232);
  268. }
  269. }
  270. }
  271.  
  272. #endregion
  273. #region Renderer
  274.  
  275. public class ControlRenderer : ToolStripProfessionalRenderer
  276. {
  277.  
  278. public ControlRenderer()
  279. : this(new MSColorTable())
  280. {
  281. }
  282.  
  283. public ControlRenderer(ColorTable ColorTable)
  284. {
  285. this.ColorTable = ColorTable;
  286. }
  287.  
  288. private ColorTable _ColorTable;
  289. public new ColorTable ColorTable
  290. {
  291. get
  292. {
  293. if (_ColorTable == null)
  294. {
  295. _ColorTable = new MSColorTable();
  296. }
  297. return _ColorTable;
  298. }
  299. set
  300. {
  301. _ColorTable = value;
  302. }
  303. }
  304.  
  305. protected override void OnRenderToolStripBackground(System.Windows.Forms.ToolStripRenderEventArgs e)
  306. {
  307. base.OnRenderToolStripBackground(e);
  308.  
  309. // Menu strip bar gradient
  310. using (LinearGradientBrush LGB = new LinearGradientBrush(e.AffectedBounds, this.ColorTable.BackgroundTopGradient, this.ColorTable.BackgroundBottomGradient, LinearGradientMode.Vertical))
  311. {
  312. e.Graphics.FillRectangle(LGB, e.AffectedBounds);
  313. }
  314.  
  315. }
  316.  
  317. protected override void OnRenderToolStripBorder(System.Windows.Forms.ToolStripRenderEventArgs e)
  318. {
  319. if (e.ToolStrip.Parent == null)
  320. {
  321. // Draw border around the menu drop-down
  322. Rectangle Rect = new Rectangle(0, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
  323. using (Pen P1 = new Pen(this.ColorTable.CommonColorTable.DropdownBorder))
  324. {
  325. e.Graphics.DrawRectangle(P1, Rect);
  326. }
  327.  
  328.  
  329. // Fill the gap between menu drop-down and owner item
  330. using (SolidBrush B1 = new SolidBrush(this.ColorTable.DroppedDownItemBackground))
  331. {
  332. e.Graphics.FillRectangle(B1, e.ConnectedArea);
  333. }
  334.  
  335. }
  336. }
  337.  
  338. protected override void OnRenderMenuItemBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  339. {
  340. if (e.Item.Enabled)
  341. {
  342. if (e.Item.Selected)
  343. {
  344. if (!e.Item.IsOnDropDown)
  345. {
  346. Rectangle SelRect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1);
  347. RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, SelRect);
  348. }
  349. else
  350. {
  351. Rectangle SelRect = new Rectangle(2, 0, e.Item.Width - 4, e.Item.Height - 1);
  352. RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, SelRect);
  353. }
  354. }
  355.  
  356. if (((ToolStripMenuItem)e.Item).DropDown.Visible && !e.Item.IsOnDropDown)
  357. {
  358. Rectangle BorderRect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height);
  359. // Fill the background
  360. Rectangle BackgroundRect = new Rectangle(1, 1, e.Item.Width - 2, e.Item.Height + 2);
  361. using (SolidBrush B1 = new SolidBrush(this.ColorTable.DroppedDownItemBackground))
  362. {
  363. e.Graphics.FillRectangle(B1, BackgroundRect);
  364. }
  365.  
  366.  
  367. // Draw border
  368. using (Pen P1 = new Pen(this.ColorTable.CommonColorTable.DropdownBorder))
  369. {
  370. RectDrawing.DrawRoundedRectangle(e.Graphics, P1, System.Convert.ToSingle(BorderRect.X), System.Convert.ToSingle(BorderRect.Y), System.Convert.ToSingle(BorderRect.Width), System.Convert.ToSingle(BorderRect.Height), 2);
  371. }
  372.  
  373. }
  374. e.Item.ForeColor = this.ColorTable.CommonColorTable.TextColor;
  375. }
  376. }
  377.  
  378. protected override void OnRenderItemText(System.Windows.Forms.ToolStripItemTextRenderEventArgs e)
  379. {
  380. e.TextColor = this.ColorTable.CommonColorTable.TextColor;
  381. base.OnRenderItemText(e);
  382. }
  383.  
  384. protected override void OnRenderItemCheck(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
  385. {
  386. base.OnRenderItemCheck(e);
  387.  
  388. Rectangle rect = new Rectangle(3, 1, e.Item.Height - 3, e.Item.Height - 3);
  389. Color c = default(Color);
  390.  
  391. if (e.Item.Selected)
  392. {
  393. c = this.ColorTable.CommonColorTable.CheckedSelectedBackground;
  394. }
  395. else
  396. {
  397. c = this.ColorTable.CommonColorTable.CheckedBackground;
  398. }
  399.  
  400. using (SolidBrush b = new SolidBrush(c))
  401. {
  402. e.Graphics.FillRectangle(b, rect);
  403. }
  404.  
  405.  
  406. using (Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder))
  407. {
  408. e.Graphics.DrawRectangle(p, rect);
  409. }
  410.  
  411.  
  412. e.Graphics.DrawString("ü", new Font("Wingdings", 13, FontStyle.Regular), Brushes.Black, new Point(4, 2));
  413. }
  414.  
  415. protected override void OnRenderSeparator(System.Windows.Forms.ToolStripSeparatorRenderEventArgs e)
  416. {
  417. base.OnRenderSeparator(e);
  418. int PT1 = 28;
  419. int PT2 = System.Convert.ToInt32(e.Item.Width);
  420. int Y = 3;
  421. using (Pen P1 = new Pen(this.ColorTable.Separator))
  422. {
  423. e.Graphics.DrawLine(P1, PT1, Y, PT2, Y);
  424. }
  425.  
  426. }
  427.  
  428. protected override void OnRenderImageMargin(System.Windows.Forms.ToolStripRenderEventArgs e)
  429. {
  430. base.OnRenderImageMargin(e);
  431.  
  432. Rectangle BackgroundRect = new Rectangle(0, -1, e.ToolStrip.Width, e.ToolStrip.Height + 1);
  433. using (LinearGradientBrush LGB = new LinearGradientBrush(BackgroundRect,
  434. this.ColorTable.DropdownTopGradient,
  435. this.ColorTable.DropdownBottomGradient,
  436. LinearGradientMode.Vertical))
  437. {
  438. e.Graphics.FillRectangle(LGB, BackgroundRect);
  439. }
  440.  
  441.  
  442. using (SolidBrush B1 = new SolidBrush(this.ColorTable.ImageMargin))
  443. {
  444. e.Graphics.FillRectangle(B1, e.AffectedBounds);
  445. }
  446.  
  447. }
  448.  
  449. protected override void OnRenderButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  450. {
  451. Rectangle rect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1);
  452. bool @checked = System.Convert.ToBoolean(((ToolStripButton)e.Item).Checked);
  453. bool drawBorder = false;
  454.  
  455. if (@checked)
  456. {
  457. drawBorder = true;
  458.  
  459. if (e.Item.Selected && !e.Item.Pressed)
  460. {
  461. using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.CheckedSelectedBackground))
  462. {
  463. e.Graphics.FillRectangle(b, rect);
  464. }
  465.  
  466. }
  467. else
  468. {
  469. using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.CheckedBackground))
  470. {
  471. e.Graphics.FillRectangle(b, rect);
  472. }
  473.  
  474. }
  475.  
  476. }
  477. else
  478. {
  479.  
  480. if (e.Item.Pressed)
  481. {
  482. drawBorder = true;
  483. using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground))
  484. {
  485. e.Graphics.FillRectangle(b, rect);
  486. }
  487.  
  488. }
  489. else if (e.Item.Selected)
  490. {
  491. drawBorder = true;
  492. RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, rect);
  493. }
  494.  
  495. }
  496.  
  497. if (drawBorder)
  498. {
  499. using (Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder))
  500. {
  501. e.Graphics.DrawRectangle(p, rect);
  502. }
  503.  
  504. }
  505. }
  506.  
  507. protected override void OnRenderDropDownButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  508. {
  509. Rectangle rect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1);
  510. bool drawBorder = false;
  511.  
  512. if (e.Item.Pressed)
  513. {
  514. drawBorder = true;
  515. using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground))
  516. {
  517. e.Graphics.FillRectangle(b, rect);
  518. }
  519.  
  520. }
  521. else if (e.Item.Selected)
  522. {
  523. drawBorder = true;
  524. RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, rect);
  525. }
  526.  
  527. if (drawBorder)
  528. {
  529. using (Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder))
  530. {
  531. e.Graphics.DrawRectangle(p, rect);
  532. }
  533.  
  534. }
  535. }
  536.  
  537. protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
  538. {
  539. base.OnRenderSplitButtonBackground(e);
  540. bool drawBorder = false;
  541. bool drawSeparator = true;
  542. ToolStripSplitButton item = (ToolStripSplitButton)e.Item;
  543. checked
  544. {
  545. Rectangle btnRect = new Rectangle(0, 0, item.ButtonBounds.Width - 1, item.ButtonBounds.Height - 1);
  546. Rectangle borderRect = new Rectangle(0, 0, item.Bounds.Width - 1, item.Bounds.Height - 1);
  547. bool flag = item.DropDownButtonPressed;
  548. if (flag)
  549. {
  550. drawBorder = true;
  551. drawSeparator = false;
  552. SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground);
  553. try
  554. {
  555. e.Graphics.FillRectangle(b, borderRect);
  556. }
  557. finally
  558. {
  559. flag = (b != null);
  560. if (flag)
  561. {
  562. ((IDisposable)b).Dispose();
  563. }
  564. }
  565. }
  566. else
  567. {
  568. flag = item.DropDownButtonSelected;
  569. if (flag)
  570. {
  571. drawBorder = true;
  572. RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, borderRect);
  573. }
  574. }
  575. flag = item.ButtonPressed;
  576. if (flag)
  577. {
  578. SolidBrush b2 = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground);
  579. try
  580. {
  581. e.Graphics.FillRectangle(b2, btnRect);
  582. }
  583. finally
  584. {
  585. flag = (b2 != null);
  586. if (flag)
  587. {
  588. ((IDisposable)b2).Dispose();
  589. }
  590. }
  591. }
  592. flag = drawBorder;
  593. if (flag)
  594. {
  595. Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder);
  596. try
  597. {
  598. e.Graphics.DrawRectangle(p, borderRect);
  599. flag = drawSeparator;
  600. if (flag)
  601. {
  602. e.Graphics.DrawRectangle(p, btnRect);
  603. }
  604. }
  605. finally
  606. {
  607. flag = (p != null);
  608. if (flag)
  609. {
  610. ((IDisposable)p).Dispose();
  611. }
  612. }
  613. this.DrawCustomArrow(e.Graphics, item);
  614. }
  615. }
  616. }
  617.  
  618.  
  619. private void DrawCustomArrow(Graphics g, ToolStripSplitButton item)
  620. {
  621. int dropWidth = System.Convert.ToInt32(item.DropDownButtonBounds.Width - 1);
  622. int dropHeight = System.Convert.ToInt32(item.DropDownButtonBounds.Height - 1);
  623. float triangleWidth = dropWidth / 2.0F + 1;
  624. float triangleLeft = System.Convert.ToSingle(item.DropDownButtonBounds.Left + (dropWidth - triangleWidth) / 2.0F);
  625. float triangleHeight = triangleWidth / 2.0F;
  626. float triangleTop = System.Convert.ToSingle(item.DropDownButtonBounds.Top + (dropHeight - triangleHeight) / 2.0F + 1);
  627. RectangleF arrowRect = new RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight);
  628.  
  629. this.DrawCustomArrow(g, item, Rectangle.Round(arrowRect));
  630. }
  631.  
  632. private void DrawCustomArrow(Graphics g, ToolStripItem item, Rectangle rect)
  633. {
  634. ToolStripArrowRenderEventArgs arrowEventArgs = new ToolStripArrowRenderEventArgs(g, item, rect, this.ColorTable.CommonColorTable.Arrow, ArrowDirection.Down);
  635. base.OnRenderArrow(arrowEventArgs);
  636. }
  637.  
  638. protected override void OnRenderOverflowButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
  639. {
  640. Rectangle rect = default(Rectangle);
  641. Rectangle rectEnd = default(Rectangle);
  642. rect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 2);
  643. rectEnd = new Rectangle(rect.X - 5, rect.Y, rect.Width - 5, rect.Height);
  644.  
  645. if (e.Item.Pressed)
  646. {
  647. using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.PressedBackground))
  648. {
  649. e.Graphics.FillRectangle(b, rect);
  650. }
  651.  
  652. }
  653. else if (e.Item.Selected)
  654. {
  655. RectDrawing.DrawSelection(e.Graphics, this.ColorTable.CommonColorTable, rect);
  656. }
  657. else
  658. {
  659. using (SolidBrush b = new SolidBrush(this.ColorTable.CommonColorTable.OverflowBackground))
  660. {
  661. e.Graphics.FillRectangle(b, rect);
  662. }
  663.  
  664. }
  665.  
  666. using (Pen P1 = new Pen(this.ColorTable.CommonColorTable.Background))
  667. {
  668. RectDrawing.DrawRoundedRectangle(e.Graphics, P1, System.Convert.ToSingle(rectEnd.X), System.Convert.ToSingle(rectEnd.Y), System.Convert.ToSingle(rectEnd.Width), System.Convert.ToSingle(rectEnd.Height), 3);
  669. }
  670.  
  671.  
  672. // Icon
  673. int w = System.Convert.ToInt32(rect.Width - 1);
  674. int h = System.Convert.ToInt32(rect.Height - 1);
  675. float triangleWidth = w / 2.0F + 1;
  676. float triangleLeft = System.Convert.ToSingle(rect.Left + (w - triangleWidth) / 2.0F + 3);
  677. float triangleHeight = triangleWidth / 2.0F;
  678. float triangleTop = System.Convert.ToSingle(rect.Top + (h - triangleHeight) / 2.0F + 7);
  679. RectangleF arrowRect = new RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight);
  680. this.DrawCustomArrow(e.Graphics, e.Item, Rectangle.Round(arrowRect));
  681.  
  682. using (Pen p = new Pen(this.ColorTable.CommonColorTable.Arrow))
  683. {
  684. e.Graphics.DrawLine(p, triangleLeft + 2, triangleTop - 2, triangleLeft + triangleWidth - 2, triangleTop - 2);
  685. }
  686.  
  687. }
  688. }
  689.  
  690. #endregion
  691. #region Drawing
  692.  
  693. public class RectDrawing
  694. {
  695.  
  696. public static void DrawSelection(Graphics G, xColorTable ColorTable, Rectangle Rect)
  697. {
  698. Rectangle TopRect = default(Rectangle);
  699. Rectangle BottomRect = default(Rectangle);
  700. Rectangle FillRect = new Rectangle(Rect.X + 1, Rect.Y + 1, Rect.Width - 1, Rect.Height - 1);
  701.  
  702. TopRect = FillRect;
  703. TopRect.Height -= System.Convert.ToInt32(TopRect.Height / 2);
  704. BottomRect = new Rectangle(TopRect.X, TopRect.Bottom, TopRect.Width, FillRect.Height - TopRect.Height);
  705.  
  706. // Top gradient
  707. using (LinearGradientBrush LGB = new LinearGradientBrush(TopRect, ColorTable.SelectionTopGradient, ColorTable.SelectionMidGradient, LinearGradientMode.Vertical))
  708. {
  709. G.FillRectangle(LGB, TopRect);
  710. }
  711.  
  712.  
  713. // Bottom
  714. using (SolidBrush B1 = new SolidBrush(ColorTable.SelectionBottomGradient))
  715. {
  716. G.FillRectangle(B1, BottomRect);
  717. }
  718.  
  719.  
  720. // Border
  721. using (Pen P1 = new Pen(ColorTable.SelectionBorder))
  722. {
  723. RectDrawing.DrawRoundedRectangle(G, P1, System.Convert.ToSingle(Rect.X), System.Convert.ToSingle(Rect.Y), System.Convert.ToSingle(Rect.Width), System.Convert.ToSingle(Rect.Height), 2);
  724. }
  725.  
  726. }
  727.  
  728. public static void DrawRoundedRectangle(Graphics G, Pen P, float X, float Y, float W, float H, float Rad)
  729. {
  730.  
  731. using (GraphicsPath gp = new GraphicsPath())
  732. {
  733. gp.AddLine(X + Rad, Y, X + W - (Rad * 2), Y);
  734. gp.AddArc(X + W - (Rad * 2), Y, Rad * 2, Rad * 2, 270, 90);
  735. gp.AddLine(X + W, Y + Rad, X + W, Y + H - (Rad * 2));
  736. gp.AddArc(X + W - (Rad * 2), Y + H - (Rad * 2), Rad * 2, Rad * 2, 0, 90);
  737. gp.AddLine(X + W - (Rad * 2), Y + H, X + Rad, Y + H);
  738. gp.AddArc(X, Y + H - (Rad * 2), Rad * 2, Rad * 2, 90, 90);
  739. gp.AddLine(X, Y + H - (Rad * 2), X, Y + Rad);
  740. gp.AddArc(X, Y, Rad * 2, Rad * 2, 180, 90);
  741. gp.CloseFigure();
  742.  
  743. G.SmoothingMode = SmoothingMode.AntiAlias;
  744. G.DrawPath(P, gp);
  745. G.SmoothingMode = SmoothingMode.Default;
  746. }
  747.  
  748. }
  749. }
  750.  
  751. #endregion
  752.  
  753. #endregion
  754. #region ThemeContainer
  755.  
  756. public class iTalk_ThemeContainer : ContainerControl
  757. {
  758.  
  759. #region Variables
  760.  
  761. private Point MouseP = new Point(0, 0);
  762. private bool Cap = false;
  763. private int MoveHeight;
  764. private bool _DrawBottomBar = true;
  765. private string _TextBottom = null;
  766. const int BorderCurve = 7;
  767.  
  768. #endregion
  769. #region Properties
  770.  
  771. public bool DrawBottomBar
  772. {
  773. get { return _DrawBottomBar; }
  774. set
  775. {
  776. _DrawBottomBar = value;
  777. Invalidate();
  778. }
  779. }
  780.  
  781. public string TextBottom
  782. {
  783. get { return _TextBottom; }
  784. set
  785. {
  786. _TextBottom = value;
  787. Invalidate();
  788. }
  789. }
  790.  
  791. #endregion
  792. #region EventArgs
  793.  
  794. protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  795. {
  796. base.OnMouseDown(e);
  797. if (e.Button == System.Windows.Forms.MouseButtons.Left & new Rectangle(0, 0, Width, MoveHeight).Contains(e.Location))
  798. {
  799. Cap = true;
  800. MouseP = e.Location;
  801. }
  802. }
  803.  
  804. protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  805. {
  806. base.OnMouseUp(e);
  807. Cap = false;
  808. }
  809.  
  810. protected override void OnMouseMove(MouseEventArgs e)
  811. {
  812. base.OnMouseMove(e);
  813. bool cap = this.Cap;
  814. if (cap)
  815. {
  816. this.Parent.Location = Control.MousePosition - (Size)this.MouseP;
  817. }
  818. }
  819.  
  820. protected override void OnInvalidated(InvalidateEventArgs e)
  821. {
  822. base.OnInvalidated(e);
  823. this.ParentForm.FindForm().Text = this.Text;
  824. }
  825.  
  826. protected override void OnPaintBackground(PaintEventArgs e)
  827. {
  828. base.OnPaintBackground(e);
  829. }
  830.  
  831. protected override void OnTextChanged(System.EventArgs e)
  832. {
  833. base.OnTextChanged(e);
  834. Invalidate();
  835. }
  836.  
  837. #endregion
  838.  
  839. protected override void OnCreateControl()
  840. {
  841. base.OnCreateControl();
  842. this.ParentForm.FormBorderStyle = FormBorderStyle.None;
  843. this.ParentForm.TransparencyKey = Color.Fuchsia;
  844. }
  845.  
  846. protected override void CreateHandle()
  847. {
  848. base.CreateHandle();
  849. }
  850.  
  851. public iTalk_ThemeContainer()
  852. : base()
  853. {
  854. SetStyle((ControlStyles)139270, true);
  855. Dock = DockStyle.Fill;
  856. MoveHeight = 25;
  857. Padding = new Padding(3, 28, 3, 28);
  858. Font = new Font("Segoe UI", 8, FontStyle.Regular);
  859. ForeColor = Color.FromArgb(142, 142, 142);
  860. BackColor = Color.FromArgb(246, 246, 246);
  861. DoubleBuffered = true;
  862. }
  863.  
  864. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  865. {
  866. base.OnPaint(e);
  867.  
  868. Bitmap B = new Bitmap(Width, Height);
  869. Graphics G = Graphics.FromImage(B);
  870. Rectangle ClientRectangle = new Rectangle(0, 0, Width - 1, Height - 1);
  871. Color TransparencyKey = this.ParentForm.TransparencyKey;
  872.  
  873. G.SmoothingMode = SmoothingMode.Default;
  874. G.Clear(TransparencyKey);
  875.  
  876. // Draw the container borders
  877. G.FillPath(new SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(ClientRectangle, BorderCurve));
  878. // Draw a rectangle in which the controls should be added on
  879. G.FillPath(new SolidBrush(Color.FromArgb(246, 246, 246)), RoundRectangle.RoundRect(new Rectangle(2, 20, Width - 5, Height - 42), BorderCurve));
  880.  
  881. // Patch the header with a rectangle that has a curve so its border will remain within container bounds
  882. G.FillPath(new SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(new Rectangle(2, 2, Width / 2 + 2, 16), BorderCurve));
  883. G.FillPath(new SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(new Rectangle(Width / 2 - 3, 2, Width / 2, 16), BorderCurve));
  884. // Fill the header rectangle below the patch
  885. G.FillRectangle(new SolidBrush(Color.FromArgb(52, 52, 52)), new Rectangle(2, 15, Width - 5, 10));
  886.  
  887. // Increase the thickness of the container borders
  888. G.DrawPath(new Pen(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(new Rectangle(2, 2, Width - 5, Height - 5), BorderCurve));
  889. G.DrawPath(new Pen(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(ClientRectangle, BorderCurve));
  890.  
  891. // Draw the string from the specified 'Text' property on the header rectangle
  892. G.DrawString(Text, new Font("Trebuchet MS", 10, FontStyle.Bold), new SolidBrush(Color.FromArgb(221, 221, 221)), new Rectangle(BorderCurve, BorderCurve - 4, Width - 1, 22), new StringFormat
  893. {
  894. Alignment = StringAlignment.Center,
  895. LineAlignment = StringAlignment.Near
  896. });
  897.  
  898.  
  899. // Draws a rectangle at the bottom of the container
  900. if (_DrawBottomBar == true)
  901. {
  902. G.FillRectangle(new SolidBrush(Color.FromArgb(52, 52, 52)), 0, Height - 25, Width - 3, 22 - 2);
  903. G.DrawLine(new Pen(Color.FromArgb(52, 52, 52)), 5, Height - 5, Width - 6, Height - 5);
  904. G.DrawLine(new Pen(Color.FromArgb(52, 52, 52)), 7, Height - 4, Width - 7, Height - 4);
  905.  
  906. G.DrawString(_TextBottom, new Font("Trebuchet MS", 10, FontStyle.Bold), new SolidBrush(Color.FromArgb(221, 221, 221)), 5, Height - 23);
  907. }
  908. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  909. G.Dispose();
  910. B.Dispose();
  911. }
  912. }
  913.  
  914. #endregion
  915. #region ControlBox
  916.  
  917. public class iTalk_ControlBox : Control
  918. {
  919.  
  920. #region Enums
  921.  
  922. public enum MouseState : byte
  923. {
  924. None = 0,
  925. Over = 1,
  926. Down = 2,
  927. Block = 3
  928. }
  929.  
  930. #endregion
  931. #region Variables
  932.  
  933. MouseState State = MouseState.None;
  934. int i;
  935. Rectangle CloseRect = new Rectangle(28, 0, 47, 18);
  936. Rectangle MinimizeRect = new Rectangle(0, 0, 28, 18);
  937.  
  938. #endregion
  939. #region EventArgs
  940.  
  941. protected override void OnMouseClick(MouseEventArgs e)
  942. {
  943. base.OnMouseClick(e);
  944. if (i > 0 & i < 28)
  945. {
  946. this.FindForm().WindowState = FormWindowState.Minimized;
  947. }
  948. else if (i > 30 & i < 75)
  949. {
  950. this.FindForm().Close();
  951. }
  952.  
  953. State = MouseState.Down;
  954. }
  955.  
  956. protected override void OnMouseEnter(System.EventArgs e)
  957. {
  958. base.OnMouseEnter(e);
  959. State = MouseState.Over;
  960. Invalidate();
  961. }
  962.  
  963. protected override void OnMouseLeave(System.EventArgs e)
  964. {
  965. base.OnMouseLeave(e);
  966. State = MouseState.None;
  967. Invalidate();
  968. }
  969.  
  970. protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  971. {
  972. base.OnMouseUp(e);
  973. State = MouseState.Over;
  974. Invalidate();
  975. }
  976.  
  977. protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  978. {
  979. base.OnMouseMove(e);
  980. i = e.Location.X;
  981. Invalidate();
  982. }
  983.  
  984. protected override void OnResize(EventArgs e)
  985. {
  986. base.OnResize(e);
  987. Width = 77;
  988. Height = 19;
  989. }
  990.  
  991. #endregion
  992.  
  993. public iTalk_ControlBox()
  994. {
  995. SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  996. BackColor = Color.Transparent;
  997. DoubleBuffered = true;
  998. Anchor = AnchorStyles.Top | AnchorStyles.Right;
  999. }
  1000. protected override void OnCreateControl()
  1001. {
  1002. base.OnCreateControl();
  1003. Point location = new Point(checked(this.FindForm().Width - 81), -1);
  1004. this.Location = location;
  1005. }
  1006.  
  1007. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  1008. {
  1009. base.OnPaint(e);
  1010.  
  1011. Bitmap B = new Bitmap(Width, Height);
  1012. Graphics G = Graphics.FromImage(B);
  1013. GraphicsPath GP_MinimizeRect = new GraphicsPath();
  1014. GraphicsPath GP_CloseRect = new GraphicsPath();
  1015.  
  1016. GP_MinimizeRect.AddRectangle(MinimizeRect);
  1017. GP_CloseRect.AddRectangle(CloseRect);
  1018. G.Clear(BackColor);
  1019.  
  1020. switch (State)
  1021. {
  1022. case MouseState.None:
  1023. NonePoint:
  1024. LinearGradientBrush MinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1025. G.FillPath(MinimizeGradient, GP_MinimizeRect);
  1026. G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect);
  1027. G.DrawString("0", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16);
  1028.  
  1029. LinearGradientBrush CloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1030. G.FillPath(CloseGradient, GP_CloseRect);
  1031. G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect);
  1032. G.DrawString("r", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16);
  1033. break;
  1034. case MouseState.Over:
  1035. if (i > 0 & i < 28)
  1036. {
  1037. LinearGradientBrush xMinimizeGradient = new LinearGradientBrush(this.MinimizeRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90f);
  1038. G.FillPath(xMinimizeGradient, GP_MinimizeRect);
  1039. G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect);
  1040. G.DrawString("0", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16);
  1041.  
  1042. LinearGradientBrush xCloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1043. G.FillPath(xCloseGradient, GP_CloseRect);
  1044. G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect);
  1045. G.DrawString("r", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16);
  1046. }
  1047. else if (i > 30 & i < 75)
  1048. {
  1049. LinearGradientBrush xCloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90);
  1050. G.FillPath(xCloseGradient, GP_CloseRect);
  1051. G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect);
  1052. G.DrawString("r", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16);
  1053.  
  1054. LinearGradientBrush xMinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90);
  1055. G.FillPath(xMinimizeGradient, RoundRectangle.RoundRect(MinimizeRect, 1));
  1056. G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect);
  1057. G.DrawString("0", new Font("Marlett", 11, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16);
  1058. }
  1059. else
  1060. {
  1061. goto NonePoint; // Return to [MouseState = None]
  1062. }
  1063. break;
  1064. }
  1065.  
  1066. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  1067. G.Dispose();
  1068. GP_CloseRect.Dispose();
  1069. GP_MinimizeRect.Dispose();
  1070. B.Dispose();
  1071. }
  1072. }
  1073.  
  1074. #endregion
  1075. #region Button 1
  1076.  
  1077. class iTalk_Button_1 : Control
  1078. {
  1079.  
  1080. #region Variables
  1081.  
  1082. private int MouseState;
  1083. private GraphicsPath Shape;
  1084. private LinearGradientBrush InactiveGB;
  1085. private LinearGradientBrush PressedGB;
  1086. private LinearGradientBrush PressedContourGB;
  1087. private Rectangle R1;
  1088. private Pen P1;
  1089. private Pen P3;
  1090. private Image _Image;
  1091. private Size _ImageSize;
  1092. private StringAlignment _TextAlignment = StringAlignment.Center;
  1093. private Color _TextColor = Color.FromArgb(150, 150, 150);
  1094. private ContentAlignment _ImageAlign = ContentAlignment.MiddleLeft;
  1095.  
  1096. #endregion
  1097. #region Image Designer
  1098.  
  1099. private static PointF ImageLocation(StringFormat SF, SizeF Area, SizeF ImageArea)
  1100. {
  1101. PointF MyPoint = default(PointF);
  1102. switch (SF.Alignment)
  1103. {
  1104. case StringAlignment.Center:
  1105. MyPoint.X = Convert.ToSingle((Area.Width - ImageArea.Width) / 2);
  1106. break;
  1107. case StringAlignment.Near:
  1108. MyPoint.X = 2;
  1109. break;
  1110. case StringAlignment.Far:
  1111. MyPoint.X = Area.Width - ImageArea.Width - 2;
  1112.  
  1113. break;
  1114. }
  1115.  
  1116. switch (SF.LineAlignment)
  1117. {
  1118. case StringAlignment.Center:
  1119. MyPoint.Y = Convert.ToSingle((Area.Height - ImageArea.Height) / 2);
  1120. break;
  1121. case StringAlignment.Near:
  1122. MyPoint.Y = 2;
  1123. break;
  1124. case StringAlignment.Far:
  1125. MyPoint.Y = Area.Height - ImageArea.Height - 2;
  1126. break;
  1127. }
  1128. return MyPoint;
  1129. }
  1130.  
  1131. private StringFormat GetStringFormat(ContentAlignment _ContentAlignment)
  1132. {
  1133. StringFormat SF = new StringFormat();
  1134. switch (_ContentAlignment)
  1135. {
  1136. case ContentAlignment.MiddleCenter:
  1137. SF.LineAlignment = StringAlignment.Center;
  1138. SF.Alignment = StringAlignment.Center;
  1139. break;
  1140. case ContentAlignment.MiddleLeft:
  1141. SF.LineAlignment = StringAlignment.Center;
  1142. SF.Alignment = StringAlignment.Near;
  1143. break;
  1144. case ContentAlignment.MiddleRight:
  1145. SF.LineAlignment = StringAlignment.Center;
  1146. SF.Alignment = StringAlignment.Far;
  1147. break;
  1148. case ContentAlignment.TopCenter:
  1149. SF.LineAlignment = StringAlignment.Near;
  1150. SF.Alignment = StringAlignment.Center;
  1151. break;
  1152. case ContentAlignment.TopLeft:
  1153. SF.LineAlignment = StringAlignment.Near;
  1154. SF.Alignment = StringAlignment.Near;
  1155. break;
  1156. case ContentAlignment.TopRight:
  1157. SF.LineAlignment = StringAlignment.Near;
  1158. SF.Alignment = StringAlignment.Far;
  1159. break;
  1160. case ContentAlignment.BottomCenter:
  1161. SF.LineAlignment = StringAlignment.Far;
  1162. SF.Alignment = StringAlignment.Center;
  1163. break;
  1164. case ContentAlignment.BottomLeft:
  1165. SF.LineAlignment = StringAlignment.Far;
  1166. SF.Alignment = StringAlignment.Near;
  1167. break;
  1168. case ContentAlignment.BottomRight:
  1169. SF.LineAlignment = StringAlignment.Far;
  1170. SF.Alignment = StringAlignment.Far;
  1171. break;
  1172. }
  1173. return SF;
  1174. }
  1175.  
  1176. #endregion
  1177. #region Properties
  1178.  
  1179. public Image Image
  1180. {
  1181. get { return _Image; }
  1182. set
  1183. {
  1184. if (value == null)
  1185. {
  1186. _ImageSize = Size.Empty;
  1187. }
  1188. else
  1189. {
  1190. _ImageSize = value.Size;
  1191. }
  1192.  
  1193. _Image = value;
  1194. Invalidate();
  1195. }
  1196. }
  1197.  
  1198. protected Size ImageSize
  1199. {
  1200. get { return _ImageSize; }
  1201. }
  1202.  
  1203. public ContentAlignment ImageAlign
  1204. {
  1205. get { return _ImageAlign; }
  1206. set
  1207. {
  1208. _ImageAlign = value;
  1209. Invalidate();
  1210. }
  1211. }
  1212.  
  1213. public StringAlignment TextAlignment
  1214. {
  1215. get { return this._TextAlignment; }
  1216. set
  1217. {
  1218. this._TextAlignment = value;
  1219. this.Invalidate();
  1220. }
  1221. }
  1222.  
  1223. public override Color ForeColor
  1224. {
  1225. get { return this._TextColor; }
  1226. set
  1227. {
  1228. this._TextColor = value;
  1229. this.Invalidate();
  1230. }
  1231. }
  1232.  
  1233. #endregion
  1234. #region EventArgs
  1235.  
  1236. protected override void OnMouseUp(MouseEventArgs e)
  1237. {
  1238. MouseState = 0;
  1239. Invalidate();
  1240. base.OnMouseUp(e);
  1241. }
  1242. protected override void OnMouseDown(MouseEventArgs e)
  1243. {
  1244. MouseState = 1;
  1245. Invalidate();
  1246. base.OnMouseDown(e);
  1247. }
  1248.  
  1249. protected override void OnMouseLeave(EventArgs e)
  1250. {
  1251. MouseState = 0;
  1252. Invalidate();
  1253. base.OnMouseLeave(e);
  1254. }
  1255.  
  1256. protected override void OnTextChanged(System.EventArgs e)
  1257. {
  1258. Invalidate();
  1259. base.OnTextChanged(e);
  1260. }
  1261.  
  1262. #endregion
  1263.  
  1264. public iTalk_Button_1()
  1265. {
  1266. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  1267.  
  1268. BackColor = Color.Transparent;
  1269. DoubleBuffered = true;
  1270. Font = new Font("Segoe UI", 12);
  1271. ForeColor = Color.FromArgb(150, 150, 150);
  1272. Size = new Size(166, 40);
  1273. _TextAlignment = StringAlignment.Center;
  1274. P1 = new Pen(Color.FromArgb(190, 190, 190)); // P1 = Border color
  1275. }
  1276.  
  1277. protected override void OnResize(System.EventArgs e)
  1278. {
  1279. if (Width > 0 && Height > 0)
  1280. {
  1281. Shape = new GraphicsPath();
  1282. R1 = new Rectangle(0, 0, Width, Height);
  1283.  
  1284. InactiveGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(251, 251, 251), Color.FromArgb(225, 225, 225), 90f);
  1285. PressedGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(235, 235, 235), Color.FromArgb(223, 223, 223), 90f);
  1286. PressedContourGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(167, 167, 167), Color.FromArgb(167, 167, 167), 90f);
  1287.  
  1288. P3 = new Pen(PressedContourGB);
  1289. }
  1290.  
  1291. var _Shape = Shape;
  1292. _Shape.AddArc(0, 0, 10, 10, 180, 90);
  1293. _Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  1294. _Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  1295. _Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  1296. _Shape.CloseAllFigures();
  1297.  
  1298. Invalidate();
  1299. base.OnResize(e);
  1300. }
  1301.  
  1302. protected override void OnPaint(PaintEventArgs e)
  1303. {
  1304. var _G = e.Graphics;
  1305. _G.SmoothingMode = SmoothingMode.HighQuality;
  1306. PointF ipt = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize);
  1307.  
  1308. switch (MouseState)
  1309. {
  1310. case 0:
  1311. _G.FillPath(InactiveGB, Shape);
  1312. _G.DrawPath(P1, Shape);
  1313. if ((Image == null))
  1314. {
  1315. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1316. {
  1317. Alignment = _TextAlignment,
  1318. LineAlignment = StringAlignment.Center
  1319. });
  1320. }
  1321. else
  1322. {
  1323. _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1324. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1325. {
  1326. Alignment = _TextAlignment,
  1327. LineAlignment = StringAlignment.Center
  1328. });
  1329. }
  1330. break;
  1331. case 1:
  1332. _G.FillPath(PressedGB, Shape);
  1333. _G.DrawPath(P3, Shape);
  1334.  
  1335. if ((Image == null))
  1336. {
  1337. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1338. {
  1339. Alignment = _TextAlignment,
  1340. LineAlignment = StringAlignment.Center
  1341. });
  1342. }
  1343. else
  1344. {
  1345. _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1346. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1347. {
  1348. Alignment = _TextAlignment,
  1349. LineAlignment = StringAlignment.Center
  1350. });
  1351. }
  1352. break;
  1353. }
  1354. base.OnPaint(e);
  1355. }
  1356. }
  1357.  
  1358. #endregion
  1359. #region Button 2
  1360.  
  1361. class iTalk_Button_2 : Control
  1362. {
  1363.  
  1364. #region Variables
  1365.  
  1366. private int MouseState;
  1367. private GraphicsPath Shape;
  1368. private LinearGradientBrush InactiveGB;
  1369. private LinearGradientBrush PressedGB;
  1370. private LinearGradientBrush PressedContourGB;
  1371. private Rectangle R1;
  1372. private Pen P1;
  1373. private Pen P3;
  1374. private Image _Image;
  1375. private Size _ImageSize;
  1376. private StringAlignment _TextAlignment = StringAlignment.Center;
  1377. private ContentAlignment _ImageAlign = ContentAlignment.MiddleLeft;
  1378.  
  1379. #endregion
  1380. #region Image Designer
  1381.  
  1382. private static PointF ImageLocation(StringFormat SF, SizeF Area, SizeF ImageArea)
  1383. {
  1384. PointF MyPoint = default(PointF);
  1385. switch (SF.Alignment)
  1386. {
  1387. case StringAlignment.Center:
  1388. MyPoint.X = Convert.ToSingle((Area.Width - ImageArea.Width) / 2);
  1389. break;
  1390. case StringAlignment.Near:
  1391. MyPoint.X = 2;
  1392. break;
  1393. case StringAlignment.Far:
  1394. MyPoint.X = Area.Width - ImageArea.Width - 2;
  1395. break;
  1396. }
  1397.  
  1398. switch (SF.LineAlignment)
  1399. {
  1400. case StringAlignment.Center:
  1401. MyPoint.Y = Convert.ToSingle((Area.Height - ImageArea.Height) / 2);
  1402. break;
  1403. case StringAlignment.Near:
  1404. MyPoint.Y = 2;
  1405. break;
  1406. case StringAlignment.Far:
  1407. MyPoint.Y = Area.Height - ImageArea.Height - 2;
  1408. break;
  1409. }
  1410. return MyPoint;
  1411. }
  1412.  
  1413. private StringFormat GetStringFormat(ContentAlignment _ContentAlignment)
  1414. {
  1415. StringFormat SF = new StringFormat();
  1416. switch (_ContentAlignment)
  1417. {
  1418. case ContentAlignment.MiddleCenter:
  1419. SF.LineAlignment = StringAlignment.Center;
  1420. SF.Alignment = StringAlignment.Center;
  1421. break;
  1422. case ContentAlignment.MiddleLeft:
  1423. SF.LineAlignment = StringAlignment.Center;
  1424. SF.Alignment = StringAlignment.Near;
  1425. break;
  1426. case ContentAlignment.MiddleRight:
  1427. SF.LineAlignment = StringAlignment.Center;
  1428. SF.Alignment = StringAlignment.Far;
  1429. break;
  1430. case ContentAlignment.TopCenter:
  1431. SF.LineAlignment = StringAlignment.Near;
  1432. SF.Alignment = StringAlignment.Center;
  1433. break;
  1434. case ContentAlignment.TopLeft:
  1435. SF.LineAlignment = StringAlignment.Near;
  1436. SF.Alignment = StringAlignment.Near;
  1437. break;
  1438. case ContentAlignment.TopRight:
  1439. SF.LineAlignment = StringAlignment.Near;
  1440. SF.Alignment = StringAlignment.Far;
  1441. break;
  1442. case ContentAlignment.BottomCenter:
  1443. SF.LineAlignment = StringAlignment.Far;
  1444. SF.Alignment = StringAlignment.Center;
  1445. break;
  1446. case ContentAlignment.BottomLeft:
  1447. SF.LineAlignment = StringAlignment.Far;
  1448. SF.Alignment = StringAlignment.Near;
  1449. break;
  1450. case ContentAlignment.BottomRight:
  1451. SF.LineAlignment = StringAlignment.Far;
  1452. SF.Alignment = StringAlignment.Far;
  1453. break;
  1454. }
  1455. return SF;
  1456. }
  1457.  
  1458. #endregion
  1459. #region Properties
  1460.  
  1461. public Image Image
  1462. {
  1463. get { return _Image; }
  1464. set
  1465. {
  1466. if (value == null)
  1467. {
  1468. _ImageSize = Size.Empty;
  1469. }
  1470. else
  1471. {
  1472. _ImageSize = value.Size;
  1473. }
  1474.  
  1475. _Image = value;
  1476. Invalidate();
  1477. }
  1478. }
  1479.  
  1480. public StringAlignment TextAlignment
  1481. {
  1482. get { return this._TextAlignment; }
  1483. set
  1484. {
  1485. this._TextAlignment = value;
  1486. this.Invalidate();
  1487. }
  1488. }
  1489.  
  1490. protected Size ImageSize
  1491. {
  1492. get { return _ImageSize; }
  1493. }
  1494.  
  1495. public ContentAlignment ImageAlign
  1496. {
  1497. get { return _ImageAlign; }
  1498. set
  1499. {
  1500. _ImageAlign = value;
  1501. Invalidate();
  1502. }
  1503. }
  1504.  
  1505. #endregion
  1506. #region EventArgs
  1507.  
  1508. protected override void OnMouseUp(MouseEventArgs e)
  1509. {
  1510. MouseState = 0;
  1511. Invalidate();
  1512. base.OnMouseUp(e);
  1513. }
  1514. protected override void OnMouseDown(MouseEventArgs e)
  1515. {
  1516. MouseState = 1;
  1517. Invalidate();
  1518. base.OnMouseDown(e);
  1519. }
  1520.  
  1521. protected override void OnMouseLeave(EventArgs e)
  1522. {
  1523. MouseState = 0;
  1524. // [Inactive]
  1525. Invalidate();
  1526. // Update control
  1527. base.OnMouseLeave(e);
  1528. }
  1529.  
  1530. protected override void OnTextChanged(System.EventArgs e)
  1531. {
  1532. Invalidate();
  1533. base.OnTextChanged(e);
  1534. }
  1535.  
  1536. #endregion
  1537.  
  1538. public iTalk_Button_2()
  1539. {
  1540. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  1541.  
  1542. BackColor = Color.Transparent;
  1543. DoubleBuffered = true;
  1544. Font = new Font("Segoe UI", 14);
  1545. ForeColor = Color.White;
  1546. Size = new Size(166, 40);
  1547. _TextAlignment = StringAlignment.Center;
  1548. P1 = new Pen(Color.FromArgb(0, 118, 176));
  1549. }
  1550.  
  1551. protected override void OnResize(System.EventArgs e)
  1552. {
  1553. base.OnResize(e);
  1554. if (Width > 0 && Height > 0)
  1555. {
  1556. Shape = new GraphicsPath();
  1557. R1 = new Rectangle(0, 0, Width, Height);
  1558.  
  1559. InactiveGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(0, 176, 231), Color.FromArgb(0, 152, 224), 90f);
  1560. PressedGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(0, 118, 176), Color.FromArgb(0, 149, 222), 90f);
  1561. PressedContourGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(0, 118, 176), Color.FromArgb(0, 118, 176), 90f);
  1562.  
  1563. P3 = new Pen(PressedContourGB);
  1564. }
  1565.  
  1566. var _Shape = Shape;
  1567. _Shape.AddArc(0, 0, 10, 10, 180, 90);
  1568. _Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  1569. _Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  1570. _Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  1571. _Shape.CloseAllFigures();
  1572.  
  1573. Invalidate();
  1574. }
  1575.  
  1576. protected override void OnPaint(PaintEventArgs e)
  1577. {
  1578. var _G = e.Graphics;
  1579. _G.SmoothingMode = SmoothingMode.HighQuality;
  1580.  
  1581. PointF ipt = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize);
  1582.  
  1583. switch (MouseState)
  1584. {
  1585. case 0:
  1586. _G.FillPath(InactiveGB, Shape);
  1587. _G.DrawPath(P1, Shape);
  1588. if ((Image == null))
  1589. {
  1590. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1591. {
  1592. Alignment = _TextAlignment,
  1593. LineAlignment = StringAlignment.Center
  1594. });
  1595. }
  1596. else
  1597. {
  1598. _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1599. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1600. {
  1601. Alignment = _TextAlignment,
  1602. LineAlignment = StringAlignment.Center
  1603. });
  1604. }
  1605. break;
  1606. case 1:
  1607. _G.FillPath(PressedGB, Shape);
  1608. _G.DrawPath(P3, Shape);
  1609. if ((Image == null))
  1610. {
  1611. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1612. {
  1613. Alignment = _TextAlignment,
  1614. LineAlignment = StringAlignment.Center
  1615. });
  1616. }
  1617. else
  1618. {
  1619. _G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);
  1620. _G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat
  1621. {
  1622. Alignment = _TextAlignment,
  1623. LineAlignment = StringAlignment.Center
  1624. });
  1625. }
  1626. break;
  1627. }
  1628. base.OnPaint(e);
  1629. }
  1630. }
  1631.  
  1632. #endregion
  1633. #region Toggle Button
  1634.  
  1635. [DefaultEvent("ToggledChanged")]
  1636. class iTalk_Toggle : Control
  1637. {
  1638.  
  1639. #region Designer
  1640.  
  1641. //|------DO-NOT-REMOVE------|
  1642. //|---------CREDITS---------|
  1643.  
  1644. // Pill class and functions were originally created by Tedd
  1645. // Last edited by Tedd on: 12/20/2013
  1646. // Modified by HazelDev on: 1/4/2014
  1647.  
  1648. //|---------CREDITS---------|
  1649. //|------DO-NOT-REMOVE------|
  1650.  
  1651. public class PillStyle
  1652. {
  1653. public bool Left;
  1654. public bool Right;
  1655. }
  1656.  
  1657. public GraphicsPath Pill(Rectangle Rectangle, PillStyle PillStyle)
  1658. {
  1659. GraphicsPath functionReturnValue = default(GraphicsPath);
  1660. functionReturnValue = new GraphicsPath();
  1661.  
  1662. if (PillStyle.Left)
  1663. {
  1664. functionReturnValue.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, Rectangle.Height, Rectangle.Height), -270, 180);
  1665. }
  1666. else
  1667. {
  1668. functionReturnValue.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height, Rectangle.X, Rectangle.Y);
  1669. }
  1670.  
  1671. if (PillStyle.Right)
  1672. {
  1673. functionReturnValue.AddArc(new Rectangle(Rectangle.X + Rectangle.Width - Rectangle.Height, Rectangle.Y, Rectangle.Height, Rectangle.Height), -90, 180);
  1674. }
  1675. else
  1676. {
  1677. functionReturnValue.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height);
  1678. }
  1679.  
  1680. functionReturnValue.CloseAllFigures();
  1681. return functionReturnValue;
  1682. }
  1683.  
  1684. public object Pill(int X, int Y, int Width, int Height, PillStyle PillStyle)
  1685. {
  1686. return Pill(new Rectangle(X, Y, Width, Height), PillStyle);
  1687. }
  1688.  
  1689. #endregion
  1690. #region Enums
  1691.  
  1692. public enum _Type
  1693. {
  1694. YesNo,
  1695. OnOff,
  1696. IO
  1697. }
  1698.  
  1699. #endregion
  1700. #region Variables
  1701.  
  1702. private Timer AnimationTimer = new Timer { Interval = 1 };
  1703. private int ToggleLocation = 0;
  1704. public event ToggledChangedEventHandler ToggledChanged;
  1705. public delegate void ToggledChangedEventHandler();
  1706. private bool _Toggled;
  1707. private _Type ToggleType;
  1708. private Rectangle Bar;
  1709. private Size cHandle = new Size(15, 20);
  1710.  
  1711. #endregion
  1712. #region Properties
  1713.  
  1714. public bool Toggled
  1715. {
  1716. get { return _Toggled; }
  1717. set
  1718. {
  1719. _Toggled = value;
  1720. Invalidate();
  1721.  
  1722. if (ToggledChanged != null)
  1723. {
  1724. ToggledChanged();
  1725. }
  1726. }
  1727. }
  1728.  
  1729. public _Type Type
  1730. {
  1731. get { return ToggleType; }
  1732. set
  1733. {
  1734. ToggleType = value;
  1735. Invalidate();
  1736. }
  1737. }
  1738.  
  1739. #endregion
  1740. #region EventArgs
  1741.  
  1742. protected override void OnResize(EventArgs e)
  1743. {
  1744. base.OnResize(e);
  1745. Width = 41;
  1746. Height = 23;
  1747. }
  1748.  
  1749. protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
  1750. {
  1751. base.OnMouseUp(e);
  1752. Toggled = !Toggled;
  1753. }
  1754.  
  1755. #endregion
  1756.  
  1757. public iTalk_Toggle()
  1758. {
  1759. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
  1760. AnimationTimer.Tick += new EventHandler(AnimationTimer_Tick);
  1761. }
  1762. protected override void OnHandleCreated(EventArgs e)
  1763. {
  1764. base.OnHandleCreated(e);
  1765. AnimationTimer.Start();
  1766. }
  1767.  
  1768. void AnimationTimer_Tick(object sender, EventArgs e)
  1769. {
  1770. // Create a slide animation when toggled on/off
  1771. if ((_Toggled == true))
  1772. {
  1773. if ((ToggleLocation < 100))
  1774. {
  1775. ToggleLocation += 10;
  1776. this.Invalidate(false);
  1777. }
  1778. }
  1779. else if ((ToggleLocation > 0))
  1780. {
  1781. ToggleLocation -= 10;
  1782. this.Invalidate(false);
  1783. }
  1784. }
  1785.  
  1786. protected override void OnPaint(PaintEventArgs e)
  1787. {
  1788. base.OnPaint(e);
  1789. Graphics G = e.Graphics;
  1790. G.Clear(Parent.BackColor);
  1791. checked
  1792. {
  1793. Point point = new Point(0, (int)Math.Round(unchecked((double)this.Height / 2.0 - (double)this.cHandle.Height / 2.0)));
  1794. Point arg_A8_0 = point;
  1795. Point point2 = new Point(0, (int)Math.Round(unchecked((double)this.Height / 2.0 + (double)this.cHandle.Height / 2.0)));
  1796. LinearGradientBrush Gradient = new LinearGradientBrush(arg_A8_0, point2, Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240));
  1797. this.Bar = new Rectangle(8, 10, this.Width - 21, this.Height - 21);
  1798.  
  1799. G.SmoothingMode = SmoothingMode.AntiAlias;
  1800. G.FillPath(Gradient, (GraphicsPath)this.Pill(0, (int)Math.Round(unchecked((double)this.Height / 2.0 - (double)this.cHandle.Height / 2.0)), this.Width - 1, this.cHandle.Height - 5, new iTalk_Toggle.PillStyle
  1801. {
  1802. Left = true,
  1803. Right = true
  1804. }));
  1805. G.DrawPath(new Pen(Color.FromArgb(177, 177, 176)), (GraphicsPath)this.Pill(0, (int)Math.Round(unchecked((double)this.Height / 2.0 - (double)this.cHandle.Height / 2.0)), this.Width - 1, this.cHandle.Height - 5, new iTalk_Toggle.PillStyle
  1806. {
  1807. Left = true,
  1808. Right = true
  1809. }));
  1810. Gradient.Dispose();
  1811. switch (this.ToggleType)
  1812. {
  1813. case iTalk_Toggle._Type.YesNo:
  1814. {
  1815. bool toggled = this.Toggled;
  1816. if (toggled)
  1817. {
  1818. G.DrawString("Yes", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 7), (float)this.Bar.Y, new StringFormat
  1819. {
  1820. Alignment = StringAlignment.Center,
  1821. LineAlignment = StringAlignment.Center
  1822. });
  1823. }
  1824. else
  1825. {
  1826. G.DrawString("No", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 18), (float)this.Bar.Y, new StringFormat
  1827. {
  1828. Alignment = StringAlignment.Center,
  1829. LineAlignment = StringAlignment.Center
  1830. });
  1831. }
  1832. break;
  1833. }
  1834. case iTalk_Toggle._Type.OnOff:
  1835. {
  1836. bool toggled = this.Toggled;
  1837. if (toggled)
  1838. {
  1839. G.DrawString("On", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 7), (float)this.Bar.Y, new StringFormat
  1840. {
  1841. Alignment = StringAlignment.Center,
  1842. LineAlignment = StringAlignment.Center
  1843. });
  1844. }
  1845. else
  1846. {
  1847. G.DrawString("Off", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 18), (float)this.Bar.Y, new StringFormat
  1848. {
  1849. Alignment = StringAlignment.Center,
  1850. LineAlignment = StringAlignment.Center
  1851. });
  1852. }
  1853. break;
  1854. }
  1855. case iTalk_Toggle._Type.IO:
  1856. {
  1857. bool toggled = this.Toggled;
  1858. if (toggled)
  1859. {
  1860. G.DrawString("I", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 7), (float)this.Bar.Y, new StringFormat
  1861. {
  1862. Alignment = StringAlignment.Center,
  1863. LineAlignment = StringAlignment.Center
  1864. });
  1865. }
  1866. else
  1867. {
  1868. G.DrawString("O", new Font("Segoe UI", 7f, FontStyle.Regular), Brushes.Gray, (float)(this.Bar.X + 18), (float)this.Bar.Y, new StringFormat
  1869. {
  1870. Alignment = StringAlignment.Center,
  1871. LineAlignment = StringAlignment.Center
  1872. });
  1873. }
  1874. break;
  1875. }
  1876. }
  1877. G.FillEllipse(new SolidBrush(Color.FromArgb(249, 249, 249)), this.Bar.X + (int)Math.Round(unchecked((double)this.Bar.Width * ((double)this.ToggleLocation / 80.0))) - (int)Math.Round((double)this.cHandle.Width / 2.0), this.Bar.Y + (int)Math.Round((double)this.Bar.Height / 2.0) - (int)Math.Round(unchecked((double)this.cHandle.Height / 2.0 - 1.0)), this.cHandle.Width, this.cHandle.Height - 5);
  1878. G.DrawEllipse(new Pen(Color.FromArgb(177, 177, 176)), this.Bar.X + (int)Math.Round(unchecked((double)this.Bar.Width * ((double)this.ToggleLocation / 80.0) - (double)checked((int)Math.Round((double)this.cHandle.Width / 2.0)))), this.Bar.Y + (int)Math.Round((double)this.Bar.Height / 2.0) - (int)Math.Round(unchecked((double)this.cHandle.Height / 2.0 - 1.0)), this.cHandle.Width, this.cHandle.Height - 5);
  1879. }
  1880. }
  1881. }
  1882. #endregion
  1883. #region Label
  1884.  
  1885. class iTalk_Label : Label
  1886. {
  1887.  
  1888. public iTalk_Label()
  1889. {
  1890. Font = new Font("Segoe UI", 8);
  1891. ForeColor = Color.FromArgb(142, 142, 142);
  1892. BackColor = Color.Transparent;
  1893. }
  1894. }
  1895.  
  1896. #endregion
  1897. #region Link Label
  1898.  
  1899. class iTalk_LinkLabel : LinkLabel
  1900. {
  1901.  
  1902. public iTalk_LinkLabel()
  1903. {
  1904. Font = new Font("Segoe UI", 8, FontStyle.Regular);
  1905. BackColor = Color.Transparent;
  1906. LinkColor = Color.FromArgb(51, 153, 225);
  1907. ActiveLinkColor = Color.FromArgb(0, 101, 202);
  1908. VisitedLinkColor = Color.FromArgb(0, 101, 202);
  1909. LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
  1910. }
  1911. }
  1912.  
  1913. #endregion
  1914. #region Header Label
  1915.  
  1916. class iTalk_HeaderLabel : Label
  1917. {
  1918.  
  1919. public iTalk_HeaderLabel()
  1920. {
  1921. Font = new Font("Segoe UI", 25, FontStyle.Regular);
  1922. ForeColor = Color.FromArgb(80, 80, 80);
  1923. BackColor = Color.Transparent;
  1924. }
  1925. }
  1926.  
  1927. #endregion
  1928. #region Big TextBox
  1929.  
  1930. [DefaultEvent("TextChanged")]
  1931. class iTalk_TextBox_Big : Control
  1932. {
  1933. #region Variables
  1934.  
  1935. public TextBox iTalkTB = new TextBox();
  1936. private GraphicsPath Shape;
  1937. private int _maxchars = 32767;
  1938. private bool _ReadOnly;
  1939. private bool _Multiline;
  1940. private Image _Image;
  1941. private Size _ImageSize;
  1942. private HorizontalAlignment ALNType;
  1943. private bool isPasswordMasked = false;
  1944. private Pen P1;
  1945. private SolidBrush B1;
  1946.  
  1947. #endregion
  1948. #region Properties
  1949.  
  1950. public HorizontalAlignment TextAlignment
  1951. {
  1952. get { return ALNType; }
  1953. set
  1954. {
  1955. ALNType = value;
  1956. Invalidate();
  1957. }
  1958. }
  1959. public int MaxLength
  1960. {
  1961. get { return _maxchars; }
  1962. set
  1963. {
  1964. _maxchars = value;
  1965. iTalkTB.MaxLength = MaxLength;
  1966. Invalidate();
  1967. }
  1968. }
  1969.  
  1970. public bool UseSystemPasswordChar
  1971. {
  1972. get { return isPasswordMasked; }
  1973. set
  1974. {
  1975. iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar;
  1976. isPasswordMasked = value;
  1977. Invalidate();
  1978. }
  1979. }
  1980. public bool ReadOnly
  1981. {
  1982. get { return _ReadOnly; }
  1983. set
  1984. {
  1985. _ReadOnly = value;
  1986. if (iTalkTB != null)
  1987. {
  1988. iTalkTB.ReadOnly = value;
  1989. }
  1990. }
  1991. }
  1992. public bool Multiline
  1993. {
  1994. get { return _Multiline; }
  1995. set
  1996. {
  1997. _Multiline = value;
  1998. if (iTalkTB != null)
  1999. {
  2000. iTalkTB.Multiline = value;
  2001.  
  2002. if (value)
  2003. {
  2004. iTalkTB.Height = Height - 23;
  2005. }
  2006. else
  2007. {
  2008. Height = iTalkTB.Height + 23;
  2009. }
  2010. }
  2011.  
  2012. }
  2013. }
  2014.  
  2015. public Image Image
  2016. {
  2017. get
  2018. {
  2019. return _Image;
  2020. }
  2021. set
  2022. {
  2023. if (value == null)
  2024. {
  2025. _ImageSize = Size.Empty;
  2026. }
  2027. else
  2028. {
  2029. _ImageSize = value.Size;
  2030. }
  2031.  
  2032. _Image = value;
  2033.  
  2034. if (Image == null)
  2035. {
  2036. iTalkTB.Location = new Point(8, 10);
  2037. }
  2038. else
  2039. {
  2040. iTalkTB.Location = new Point(35, 11);
  2041. }
  2042. Invalidate();
  2043. }
  2044. }
  2045.  
  2046. protected Size ImageSize
  2047. {
  2048. get
  2049. {
  2050. return _ImageSize;
  2051. }
  2052. }
  2053.  
  2054. #endregion
  2055. #region EventArgs
  2056.  
  2057. protected override void OnTextChanged(System.EventArgs e)
  2058. {
  2059. base.OnTextChanged(e);
  2060. iTalkTB.Text = Text;
  2061. Invalidate();
  2062. }
  2063.  
  2064. protected override void OnForeColorChanged(System.EventArgs e)
  2065. {
  2066. base.OnForeColorChanged(e);
  2067. iTalkTB.ForeColor = ForeColor;
  2068. Invalidate();
  2069. }
  2070.  
  2071. protected override void OnFontChanged(System.EventArgs e)
  2072. {
  2073. base.OnFontChanged(e);
  2074. iTalkTB.Font = Font;
  2075. }
  2076.  
  2077. protected override void OnPaintBackground(PaintEventArgs e)
  2078. {
  2079. base.OnPaintBackground(e);
  2080. }
  2081.  
  2082. private void _OnKeyDown(object Obj, KeyEventArgs e)
  2083. {
  2084. if (e.Control && e.KeyCode == Keys.A)
  2085. {
  2086. iTalkTB.SelectAll();
  2087. e.SuppressKeyPress = true;
  2088. }
  2089. if (e.Control && e.KeyCode == Keys.C)
  2090. {
  2091. iTalkTB.Copy();
  2092. e.SuppressKeyPress = true;
  2093. }
  2094. }
  2095.  
  2096. protected override void OnResize(System.EventArgs e)
  2097. {
  2098. base.OnResize(e);
  2099. if (_Multiline)
  2100. {
  2101. iTalkTB.Height = Height - 23;
  2102. }
  2103. else
  2104. {
  2105. Height = iTalkTB.Height + 23;
  2106. }
  2107.  
  2108. Shape = new GraphicsPath();
  2109. var _with1 = Shape;
  2110. _with1.AddArc(0, 0, 10, 10, 180, 90);
  2111. _with1.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2112. _with1.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2113. _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  2114. _with1.CloseAllFigures();
  2115. }
  2116.  
  2117. protected override void OnGotFocus(System.EventArgs e)
  2118. {
  2119. base.OnGotFocus(e);
  2120. iTalkTB.Focus();
  2121. }
  2122.  
  2123. #endregion
  2124. public void AddTextBox()
  2125. {
  2126. var _TB = iTalkTB;
  2127. _TB.Location = new Point(7, 10);
  2128. _TB.Text = string.Empty;
  2129. _TB.BorderStyle = BorderStyle.None;
  2130. _TB.TextAlign = HorizontalAlignment.Left;
  2131. _TB.Font = new Font("Tahoma", 11);
  2132. _TB.UseSystemPasswordChar = UseSystemPasswordChar;
  2133. _TB.Multiline = false;
  2134. iTalkTB.KeyDown += _OnKeyDown;
  2135. }
  2136.  
  2137. public iTalk_TextBox_Big()
  2138. {
  2139. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2140. SetStyle(ControlStyles.UserPaint, true);
  2141.  
  2142. AddTextBox();
  2143. Controls.Add(iTalkTB);
  2144.  
  2145. P1 = new Pen(Color.FromArgb(180, 180, 180)); // P1 = Border color
  2146. B1 = new SolidBrush(Color.White); // B1 = Rect Background color
  2147. BackColor = Color.Transparent;
  2148. ForeColor = Color.DimGray;
  2149.  
  2150. Text = null;
  2151. Font = new Font("Tahoma", 11);
  2152. Size = new Size(135, 43);
  2153. DoubleBuffered = true;
  2154. }
  2155. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2156. {
  2157. base.OnPaint(e);
  2158. Bitmap B = new Bitmap(Width, Height);
  2159. Graphics G = Graphics.FromImage(B);
  2160.  
  2161. G.SmoothingMode = SmoothingMode.AntiAlias;
  2162.  
  2163. if (Image == null)
  2164. {
  2165. iTalkTB.Width = Width - 18;
  2166. }
  2167. else
  2168. {
  2169. iTalkTB.Width = Width - 45;
  2170. }
  2171.  
  2172. iTalkTB.TextAlign = TextAlignment;
  2173. iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar;
  2174.  
  2175. G.Clear(Color.Transparent);
  2176. G.FillPath(B1, Shape); // Draw background
  2177. G.DrawPath(P1, Shape); // Draw border
  2178.  
  2179.  
  2180. if (Image != null)
  2181. {
  2182. G.DrawImage(_Image, 5, 8, 24, 24);
  2183. // 24x24 is the perfect size of the image
  2184. }
  2185.  
  2186. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  2187. G.Dispose();
  2188. B.Dispose();
  2189. }
  2190. }
  2191.  
  2192. #endregion
  2193. #region Small TextBox
  2194.  
  2195. [DefaultEvent("TextChanged")]
  2196. class iTalk_TextBox_Small : Control
  2197. {
  2198. #region Variables
  2199.  
  2200. public TextBox iTalkTB = new TextBox();
  2201. private GraphicsPath Shape;
  2202. private int _maxchars = 32767;
  2203. private bool _ReadOnly;
  2204. private bool _Multiline;
  2205. private HorizontalAlignment ALNType;
  2206. private bool isPasswordMasked = false;
  2207. private Pen P1;
  2208. private SolidBrush B1;
  2209.  
  2210. #endregion
  2211. #region Properties
  2212.  
  2213. public HorizontalAlignment TextAlignment
  2214. {
  2215. get { return ALNType; }
  2216. set
  2217. {
  2218. ALNType = value;
  2219. Invalidate();
  2220. }
  2221. }
  2222. public int MaxLength
  2223. {
  2224. get { return _maxchars; }
  2225. set
  2226. {
  2227. _maxchars = value;
  2228. iTalkTB.MaxLength = MaxLength;
  2229. Invalidate();
  2230. }
  2231. }
  2232.  
  2233. public bool UseSystemPasswordChar
  2234. {
  2235. get { return isPasswordMasked; }
  2236. set
  2237. {
  2238. iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar;
  2239. isPasswordMasked = value;
  2240. Invalidate();
  2241. }
  2242. }
  2243. public bool ReadOnly
  2244. {
  2245. get { return _ReadOnly; }
  2246. set
  2247. {
  2248. _ReadOnly = value;
  2249. if (iTalkTB != null)
  2250. {
  2251. iTalkTB.ReadOnly = value;
  2252. }
  2253. }
  2254. }
  2255. public bool Multiline
  2256. {
  2257. get { return _Multiline; }
  2258. set
  2259. {
  2260. _Multiline = value;
  2261. if (iTalkTB != null)
  2262. {
  2263. iTalkTB.Multiline = value;
  2264.  
  2265. if (value)
  2266. {
  2267. iTalkTB.Height = Height - 10;
  2268. }
  2269. else
  2270. {
  2271. Height = iTalkTB.Height + 10;
  2272. }
  2273. }
  2274. }
  2275. }
  2276.  
  2277. #endregion
  2278. #region EventArgs
  2279.  
  2280. protected override void OnTextChanged(System.EventArgs e)
  2281. {
  2282. base.OnTextChanged(e);
  2283. iTalkTB.Text = Text;
  2284. Invalidate();
  2285. }
  2286.  
  2287. protected override void OnForeColorChanged(System.EventArgs e)
  2288. {
  2289. base.OnForeColorChanged(e);
  2290. iTalkTB.ForeColor = ForeColor;
  2291. Invalidate();
  2292. }
  2293.  
  2294. protected override void OnFontChanged(System.EventArgs e)
  2295. {
  2296. base.OnFontChanged(e);
  2297. iTalkTB.Font = Font;
  2298. }
  2299.  
  2300. protected override void OnPaintBackground(PaintEventArgs e)
  2301. {
  2302. base.OnPaintBackground(e);
  2303. }
  2304.  
  2305. private void _OnKeyDown(object Obj, KeyEventArgs e)
  2306. {
  2307. if (e.Control && e.KeyCode == Keys.A)
  2308. {
  2309. iTalkTB.SelectAll();
  2310. e.SuppressKeyPress = true;
  2311. }
  2312. if (e.Control && e.KeyCode == Keys.C)
  2313. {
  2314. iTalkTB.Copy();
  2315. e.SuppressKeyPress = true;
  2316. }
  2317. }
  2318.  
  2319. protected override void OnResize(System.EventArgs e)
  2320. {
  2321. base.OnResize(e);
  2322. if (_Multiline)
  2323. {
  2324. iTalkTB.Height = Height - 10;
  2325. }
  2326. else
  2327. {
  2328. Height = iTalkTB.Height + 10;
  2329. }
  2330.  
  2331. Shape = new GraphicsPath();
  2332. var _with1 = Shape;
  2333. _with1.AddArc(0, 0, 10, 10, 180, 90);
  2334. _with1.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2335. _with1.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2336. _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  2337. _with1.CloseAllFigures();
  2338. }
  2339.  
  2340. protected override void OnGotFocus(System.EventArgs e)
  2341. {
  2342. base.OnGotFocus(e);
  2343. iTalkTB.Focus();
  2344. }
  2345.  
  2346. #endregion
  2347. public void AddTextBox()
  2348. {
  2349. var _TB = iTalkTB;
  2350. _TB.Size = new Size(Width - 10, 33);
  2351. _TB.Location = new Point(7, 5);
  2352. _TB.Text = string.Empty;
  2353. _TB.BorderStyle = BorderStyle.None;
  2354. _TB.TextAlign = HorizontalAlignment.Left;
  2355. _TB.Font = new Font("Tahoma", 11);
  2356. _TB.UseSystemPasswordChar = UseSystemPasswordChar;
  2357. _TB.Multiline = false;
  2358. iTalkTB.KeyDown += _OnKeyDown;
  2359. }
  2360.  
  2361. public iTalk_TextBox_Small()
  2362. {
  2363. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2364. SetStyle(ControlStyles.UserPaint, true);
  2365.  
  2366. AddTextBox();
  2367. Controls.Add(iTalkTB);
  2368.  
  2369. P1 = new Pen(Color.FromArgb(180, 180, 180)); // P1 = Border color
  2370. B1 = new SolidBrush(Color.White); // B1 = Rect Background color
  2371. BackColor = Color.Transparent;
  2372. ForeColor = Color.DimGray;
  2373.  
  2374. Text = null;
  2375. Font = new Font("Tahoma", 11);
  2376. Size = new Size(135, 33);
  2377. DoubleBuffered = true;
  2378. }
  2379. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2380. {
  2381. base.OnPaint(e);
  2382. Bitmap B = new Bitmap(Width, Height);
  2383. Graphics G = Graphics.FromImage(B);
  2384.  
  2385. G.SmoothingMode = SmoothingMode.AntiAlias;
  2386.  
  2387. var _TB = iTalkTB;
  2388. _TB.Width = Width - 10;
  2389. _TB.TextAlign = TextAlignment;
  2390. _TB.UseSystemPasswordChar = UseSystemPasswordChar;
  2391.  
  2392. G.Clear(Color.Transparent);
  2393. G.FillPath(B1, Shape); // Draw background
  2394. G.DrawPath(P1, Shape); // Draw border
  2395.  
  2396. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  2397. G.Dispose();
  2398. B.Dispose();
  2399. }
  2400.  
  2401. }
  2402.  
  2403. #endregion
  2404. #region RichTextBox
  2405.  
  2406. [DefaultEvent("TextChanged")]
  2407. class iTalk_RichTextBox : Control
  2408. {
  2409.  
  2410. #region Variables
  2411.  
  2412. public RichTextBox iTalkRTB = new RichTextBox();
  2413. private bool _ReadOnly;
  2414. private bool _WordWrap;
  2415. private bool _AutoWordSelection;
  2416. private GraphicsPath Shape;
  2417.  
  2418. #endregion
  2419. #region Properties
  2420.  
  2421. public override string Text
  2422. {
  2423. get { return iTalkRTB.Text; }
  2424. set
  2425. {
  2426. iTalkRTB.Text = value;
  2427. Invalidate();
  2428. }
  2429. }
  2430. public bool ReadOnly
  2431. {
  2432. get { return _ReadOnly; }
  2433. set
  2434. {
  2435. _ReadOnly = value;
  2436. if (iTalkRTB != null)
  2437. {
  2438. iTalkRTB.ReadOnly = value;
  2439. }
  2440. }
  2441. }
  2442. public bool WordWrap
  2443. {
  2444. get { return _WordWrap; }
  2445. set
  2446. {
  2447. _WordWrap = value;
  2448. if (iTalkRTB != null)
  2449. {
  2450. iTalkRTB.WordWrap = value;
  2451. }
  2452. }
  2453. }
  2454. public bool AutoWordSelection
  2455. {
  2456. get { return _AutoWordSelection; }
  2457. set
  2458. {
  2459. _AutoWordSelection = value;
  2460. if (iTalkRTB != null)
  2461. {
  2462. iTalkRTB.AutoWordSelection = value;
  2463. }
  2464. }
  2465. }
  2466. #endregion
  2467. #region EventArgs
  2468.  
  2469. protected override void OnTextChanged(System.EventArgs e)
  2470. {
  2471. base.OnTextChanged(e);
  2472. iTalkRTB.Text = Text;
  2473. Invalidate();
  2474. }
  2475.  
  2476. protected override void OnForeColorChanged(System.EventArgs e)
  2477. {
  2478. base.OnForeColorChanged(e);
  2479. iTalkRTB.ForeColor = ForeColor;
  2480. Invalidate();
  2481. }
  2482.  
  2483. protected override void OnFontChanged(System.EventArgs e)
  2484. {
  2485. base.OnFontChanged(e);
  2486. iTalkRTB.Font = Font;
  2487. }
  2488. protected override void OnPaintBackground(PaintEventArgs e)
  2489. {
  2490. base.OnPaintBackground(e);
  2491. }
  2492.  
  2493. protected override void OnSizeChanged(System.EventArgs e)
  2494. {
  2495. base.OnSizeChanged(e);
  2496. iTalkRTB.Size = new Size(Width - 13, Height - 11);
  2497. }
  2498.  
  2499. protected override void OnResize(System.EventArgs e)
  2500. {
  2501. base.OnResize(e);
  2502.  
  2503. Shape = new GraphicsPath();
  2504. var _with1 = Shape;
  2505. _with1.AddArc(0, 0, 10, 10, 180, 90);
  2506. _with1.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2507. _with1.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2508. _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  2509. _with1.CloseAllFigures();
  2510. }
  2511.  
  2512. #endregion
  2513.  
  2514. public void AddRichTextBox()
  2515. {
  2516. var _with2 = iTalkRTB;
  2517. _with2.BackColor = Color.White;
  2518. _with2.Size = new Size(Width - 10, 100);
  2519. _with2.Location = new Point(7, 5);
  2520. _with2.Text = string.Empty;
  2521. _with2.BorderStyle = BorderStyle.None;
  2522. _with2.Font = new Font("Tahoma", 10);
  2523. _with2.Multiline = true;
  2524. }
  2525.  
  2526. public iTalk_RichTextBox()
  2527. : base()
  2528. {
  2529. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2530. SetStyle(ControlStyles.UserPaint, true);
  2531.  
  2532. AddRichTextBox();
  2533. Controls.Add(iTalkRTB);
  2534. BackColor = Color.Transparent;
  2535. ForeColor = Color.DimGray;
  2536.  
  2537. Text = null;
  2538. Font = new Font("Tahoma", 10);
  2539. Size = new Size(150, 100);
  2540. WordWrap = true;
  2541. AutoWordSelection = false;
  2542. DoubleBuffered = true;
  2543. }
  2544.  
  2545. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2546. {
  2547. base.OnPaint(e);
  2548. Bitmap B = new Bitmap(this.Width, this.Height);
  2549. Graphics G = Graphics.FromImage(B);
  2550. G.SmoothingMode = SmoothingMode.AntiAlias;
  2551. G.Clear(Color.Transparent);
  2552. G.FillPath(Brushes.White, this.Shape);
  2553. G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), this.Shape);
  2554. G.Dispose();
  2555. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  2556. B.Dispose();
  2557. }
  2558. }
  2559.  
  2560. #endregion
  2561. #region NumericUpDown
  2562.  
  2563. public class iTalk_NumericUpDown : Control
  2564. {
  2565.  
  2566. #region Enums
  2567.  
  2568. public enum _TextAlignment
  2569. {
  2570. Near,
  2571. Center
  2572. }
  2573.  
  2574. #endregion
  2575. #region Variables
  2576.  
  2577. private GraphicsPath Shape;
  2578. private Pen P1;
  2579. private SolidBrush B1;
  2580.  
  2581. private long _Value;
  2582. private long _Minimum;
  2583. private long _Maximum;
  2584. private int Xval;
  2585. private int Yval;
  2586. private bool KeyboardNum;
  2587. private _TextAlignment MyStringAlignment;
  2588.  
  2589. #endregion
  2590. #region Properties
  2591.  
  2592. public long Value
  2593. {
  2594. get
  2595. {
  2596. return _Value;
  2597. }
  2598. set
  2599. {
  2600. if (value <= _Maximum & value >= _Minimum)
  2601. {
  2602. _Value = value;
  2603. }
  2604. Invalidate();
  2605. }
  2606. }
  2607.  
  2608. public long Minimum
  2609. {
  2610. get
  2611. {
  2612. return _Minimum;
  2613. }
  2614. set
  2615. {
  2616. if (value < _Maximum)
  2617. {
  2618. _Minimum = value;
  2619. }
  2620. if (_Value < _Minimum)
  2621. {
  2622. _Value = Minimum;
  2623. }
  2624. Invalidate();
  2625. }
  2626. }
  2627.  
  2628. public long Maximum
  2629. {
  2630. get
  2631. {
  2632. return _Maximum;
  2633. }
  2634. set
  2635. {
  2636. if (value > _Minimum)
  2637. {
  2638. _Maximum = value;
  2639. }
  2640. if (_Value > _Maximum)
  2641. {
  2642. _Value = _Maximum;
  2643. }
  2644. Invalidate();
  2645. }
  2646. }
  2647.  
  2648. public _TextAlignment TextAlignment
  2649. {
  2650. get
  2651. {
  2652. return MyStringAlignment;
  2653. }
  2654. set
  2655. {
  2656. MyStringAlignment = value;
  2657. Invalidate();
  2658. }
  2659. }
  2660.  
  2661. #endregion
  2662. #region EventArgs
  2663.  
  2664. protected override void OnResize(System.EventArgs e)
  2665. {
  2666. base.OnResize(e);
  2667. Height = 28;
  2668. Shape = new GraphicsPath();
  2669. Shape.AddArc(0, 0, 10, 10, 180, 90);
  2670. Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2671. Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2672. Shape.AddArc(0, Height - 11, 10, 10, 90, 90);
  2673. Shape.CloseAllFigures();
  2674. }
  2675.  
  2676. protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
  2677. {
  2678. base.OnMouseMove(e);
  2679. Xval = e.Location.X;
  2680. Yval = e.Location.Y;
  2681. Invalidate();
  2682.  
  2683. if (e.X < Width - 24)
  2684. {
  2685. Cursor = Cursors.IBeam;
  2686. }
  2687. else
  2688. {
  2689. Cursor = Cursors.Default;
  2690. }
  2691. }
  2692.  
  2693. protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  2694. {
  2695. base.OnMouseClick(e);
  2696. if (Xval > this.Width - 23 && Xval < this.Width - 3)
  2697. {
  2698. if (Yval < 15)
  2699. {
  2700. if ((Value + 1) <= _Maximum)
  2701. {
  2702. _Value++;
  2703. }
  2704. }
  2705. else
  2706. {
  2707. if ((Value - 1) >= _Minimum)
  2708. {
  2709. _Value--;
  2710. }
  2711. }
  2712. }
  2713. else
  2714. {
  2715. KeyboardNum = !KeyboardNum;
  2716. Focus();
  2717. }
  2718. Invalidate();
  2719. }
  2720.  
  2721. protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
  2722. {
  2723. base.OnKeyPress(e);
  2724. try
  2725. {
  2726. if (KeyboardNum == true)
  2727. {
  2728. _Value = long.Parse((_Value).ToString() + e.KeyChar.ToString().ToString());
  2729. }
  2730. if (_Value > _Maximum)
  2731. {
  2732. _Value = _Maximum;
  2733. }
  2734. }
  2735. catch (Exception)
  2736. {
  2737. }
  2738. }
  2739.  
  2740. protected override void OnKeyUp(System.Windows.Forms.KeyEventArgs e)
  2741. {
  2742. base.OnKeyUp(e);
  2743. if (e.KeyCode == Keys.Back)
  2744. {
  2745. string TemporaryValue = _Value.ToString();
  2746. TemporaryValue = TemporaryValue.Remove(Convert.ToInt32(TemporaryValue.Length - 1));
  2747. if (TemporaryValue.Length == 0)
  2748. {
  2749. TemporaryValue = "0";
  2750. }
  2751. _Value = Convert.ToInt32(TemporaryValue);
  2752. }
  2753. Invalidate();
  2754. }
  2755.  
  2756. protected override void OnMouseWheel(MouseEventArgs e)
  2757. {
  2758. base.OnMouseWheel(e);
  2759. if (e.Delta > 0)
  2760. {
  2761. if ((Value + 1) <= _Maximum)
  2762. {
  2763. _Value++;
  2764. }
  2765. Invalidate();
  2766. }
  2767. else
  2768. {
  2769. if ((Value - 1) >= _Minimum)
  2770. {
  2771. _Value--;
  2772. }
  2773. Invalidate();
  2774. }
  2775. }
  2776.  
  2777. #endregion
  2778.  
  2779. public iTalk_NumericUpDown()
  2780. {
  2781. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  2782. SetStyle(ControlStyles.UserPaint, true);
  2783.  
  2784. P1 = new Pen(Color.FromArgb(180, 180, 180)); // P1 = Border color
  2785. B1 = new SolidBrush(Color.White); // B1 = Rect Background color
  2786. BackColor = Color.Transparent;
  2787. ForeColor = Color.DimGray;
  2788.  
  2789. _Minimum = 0;
  2790. _Maximum = 100;
  2791.  
  2792. Font = new Font("Tahoma", 11);
  2793. Size = new Size(70, 28);
  2794. MinimumSize = new Size(62, 28);
  2795. DoubleBuffered = true;
  2796. }
  2797.  
  2798. public void Increment(int Value)
  2799. {
  2800. this._Value += Value;
  2801. Invalidate();
  2802. }
  2803.  
  2804. public void Decrement(int Value)
  2805. {
  2806. this._Value -= Value;
  2807. Invalidate();
  2808. }
  2809.  
  2810. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  2811. {
  2812. base.OnPaint(e);
  2813. Bitmap B = new Bitmap(Width, Height);
  2814. Graphics G = Graphics.FromImage(B);
  2815.  
  2816. G.SmoothingMode = SmoothingMode.AntiAlias;
  2817.  
  2818. G.Clear(Color.Transparent); // Set control background color
  2819. G.FillPath(B1, Shape); // Draw background
  2820. G.DrawPath(P1, Shape); // Draw border
  2821.  
  2822. LinearGradientBrush ColorGradient = new LinearGradientBrush(new Rectangle(Width - 23, 4, 19, 19), Color.FromArgb(241, 241, 241), Color.FromArgb(241, 241, 241), 90.0F);
  2823. G.FillRectangle(ColorGradient, ColorGradient.Rectangle); // Fills the body of the rectangle
  2824.  
  2825. G.DrawRectangle(new Pen(Color.FromArgb(252, 252, 252)), new Rectangle(Width - 22, 5, 17, 17));
  2826. G.DrawRectangle(new Pen(Color.FromArgb(180, 180, 180)), new Rectangle(Width - 23, 4, 19, 19));
  2827.  
  2828. G.DrawLine(new Pen(Color.FromArgb(250, 252, 250)), new Point(Width - 22, Height - 16), new Point(Width - 5, Height - 16));
  2829. G.DrawLine(new Pen(Color.FromArgb(180, 180, 180)), new Point(Width - 22, Height - 15), new Point(Width - 5, Height - 15));
  2830. G.DrawLine(new Pen(Color.FromArgb(250, 250, 250)), new Point(Width - 22, Height - 14), new Point(Width - 5, Height - 14));
  2831.  
  2832. G.DrawString("+", new Font("Tahoma", 8), Brushes.Gray, Width - 19, Height - 26);
  2833. G.DrawString("-", new Font("Tahoma", 12), Brushes.Gray, Width - 19, Height - 20);
  2834.  
  2835. switch (MyStringAlignment)
  2836. {
  2837. case _TextAlignment.Near:
  2838. G.DrawString(System.Convert.ToString(Value), Font, new SolidBrush(ForeColor), new Rectangle(5, 0, Width - 1, Height - 1), new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
  2839. break;
  2840. case _TextAlignment.Center:
  2841. G.DrawString(System.Convert.ToString(Value), Font, new SolidBrush(ForeColor), new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
  2842. break;
  2843. }
  2844.  
  2845. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  2846. G.Dispose();
  2847. B.Dispose();
  2848. }
  2849. }
  2850.  
  2851. #endregion
  2852. #region Left Chat Bubble
  2853.  
  2854. public class iTalk_ChatBubble_L : Control
  2855. {
  2856.  
  2857. #region Variables
  2858.  
  2859. private GraphicsPath Shape;
  2860. private Color _TextColor = Color.FromArgb(52, 52, 52);
  2861. private Color _BubbleColor = Color.FromArgb(217, 217, 217);
  2862. private bool _DrawBubbleArrow = true;
  2863.  
  2864. #endregion
  2865. #region Properties
  2866.  
  2867. public override Color ForeColor
  2868. {
  2869. get { return this._TextColor; }
  2870. set
  2871. {
  2872. this._TextColor = value;
  2873. this.Invalidate();
  2874. }
  2875. }
  2876.  
  2877. public Color BubbleColor
  2878. {
  2879. get { return this._BubbleColor; }
  2880. set
  2881. {
  2882. this._BubbleColor = value;
  2883. this.Invalidate();
  2884. }
  2885. }
  2886.  
  2887. public bool DrawBubbleArrow
  2888. {
  2889. get { return _DrawBubbleArrow; }
  2890. set
  2891. {
  2892. _DrawBubbleArrow = value;
  2893. Invalidate();
  2894. }
  2895. }
  2896.  
  2897. #endregion
  2898.  
  2899. public iTalk_ChatBubble_L()
  2900. {
  2901. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  2902. DoubleBuffered = true;
  2903. Size = new Size(152, 38);
  2904. BackColor = Color.Transparent;
  2905. ForeColor = Color.FromArgb(52, 52, 52);
  2906. Font = new Font("Segoe UI", 10);
  2907. }
  2908.  
  2909. protected override void OnResize(System.EventArgs e)
  2910. {
  2911. Shape = new GraphicsPath();
  2912.  
  2913. var _Shape = Shape;
  2914. _Shape.AddArc(9, 0, 10, 10, 180, 90);
  2915. _Shape.AddArc(Width - 11, 0, 10, 10, -90, 90);
  2916. _Shape.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  2917. _Shape.AddArc(9, Height - 11, 10, 10, 90, 90);
  2918. _Shape.CloseAllFigures();
  2919.  
  2920. Invalidate();
  2921. base.OnResize(e);
  2922. }
  2923.  
  2924. protected override void OnPaint(PaintEventArgs e)
  2925. {
  2926. base.OnPaint(e);
  2927. Bitmap B = new Bitmap(this.Width, this.Height);
  2928. Graphics G = Graphics.FromImage(B);
  2929. var _G = G;
  2930. _G.SmoothingMode = SmoothingMode.HighQuality;
  2931. _G.PixelOffsetMode = PixelOffsetMode.HighQuality;
  2932. _G.Clear(BackColor);
  2933.  
  2934. // Fill the body of the bubble with the specified color
  2935. _G.FillPath(new SolidBrush(_BubbleColor), Shape);
  2936. // Draw the string specified in 'Text' property
  2937. _G.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(15, 4, Width - 17, Height - 5));
  2938.  
  2939. // Draw a polygon on the right side of the bubble
  2940. if (_DrawBubbleArrow == true) {
  2941. Point[] p = {
  2942. new Point(9, Height - 19),
  2943. new Point(0, Height - 25),
  2944. new Point(9, Height - 30)
  2945. };
  2946. _G.FillPolygon(new SolidBrush(_BubbleColor), p);
  2947. _G.DrawPolygon(new Pen(new SolidBrush(_BubbleColor)), p);
  2948. }
  2949. G.Dispose();
  2950. e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
  2951. e.Graphics.DrawImageUnscaled(B, 0, 0);
  2952. B.Dispose();
  2953. }
  2954. }
  2955.  
  2956. #endregion
  2957. #region Right Chat Bubble
  2958.  
  2959. public class iTalk_ChatBubble_R : Control
  2960. {
  2961.  
  2962. #region Variables
  2963.  
  2964. private GraphicsPath Shape;
  2965. private Color _TextColor = Color.FromArgb(52, 52, 52);
  2966. private Color _BubbleColor = Color.FromArgb(192, 206, 215);
  2967. private bool _DrawBubbleArrow = true;
  2968.  
  2969. #endregion
  2970. #region Properties
  2971.  
  2972. public override Color ForeColor
  2973. {
  2974. get { return this._TextColor; }
  2975. set
  2976. {
  2977. this._TextColor = value;
  2978. this.Invalidate();
  2979. }
  2980. }
  2981.  
  2982. public Color BubbleColor
  2983. {
  2984. get { return this._BubbleColor; }
  2985. set
  2986. {
  2987. this._BubbleColor = value;
  2988. this.Invalidate();
  2989. }
  2990. }
  2991.  
  2992. public bool DrawBubbleArrow
  2993. {
  2994. get { return _DrawBubbleArrow; }
  2995. set
  2996. {
  2997. _DrawBubbleArrow = value;
  2998. Invalidate();
  2999. }
  3000. }
  3001.  
  3002. #endregion
  3003.  
  3004. public iTalk_ChatBubble_R()
  3005. {
  3006. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  3007. DoubleBuffered = true;
  3008. Size = new Size(152, 38);
  3009. BackColor = Color.Transparent;
  3010. ForeColor = Color.FromArgb(52, 52, 52);
  3011. Font = new Font("Segoe UI", 10);
  3012. }
  3013.  
  3014. protected override void OnResize(System.EventArgs e)
  3015. {
  3016. base.OnResize(e);
  3017. Shape = new GraphicsPath();
  3018.  
  3019. var _with1 = Shape;
  3020. _with1.AddArc(0, 0, 10, 10, 180, 90);
  3021. _with1.AddArc(Width - 18, 0, 10, 10, -90, 90);
  3022. _with1.AddArc(Width - 18, Height - 11, 10, 10, 0, 90);
  3023. _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  3024. _with1.CloseAllFigures();
  3025.  
  3026. Invalidate();
  3027. }
  3028.  
  3029. protected override void OnPaint(PaintEventArgs e)
  3030. {
  3031. base.OnPaint(e);
  3032. Bitmap B = new Bitmap(this.Width, this.Height);
  3033. Graphics G = Graphics.FromImage(B);
  3034.  
  3035. var _G = G;
  3036. _G.SmoothingMode = SmoothingMode.HighQuality;
  3037. _G.PixelOffsetMode = PixelOffsetMode.HighQuality;
  3038. _G.Clear(BackColor);
  3039.  
  3040. // Fill the body of the bubble with the specified color
  3041. _G.FillPath(new SolidBrush(_BubbleColor), Shape);
  3042. // Draw the string specified in 'Text' property
  3043. _G.DrawString(Text, Font, new SolidBrush(ForeColor), (new Rectangle(6, 4, Width - 15, Height)));
  3044.  
  3045. // Draw a polygon on the right side of the bubble
  3046. if (_DrawBubbleArrow == true)
  3047. {
  3048. Point[] p = {
  3049. new Point(Width - 8, Height - 19),
  3050. new Point(Width, Height - 25),
  3051. new Point(Width - 8, Height - 30)
  3052. };
  3053. _G.FillPolygon(new SolidBrush(_BubbleColor), p);
  3054. _G.DrawPolygon(new Pen(new SolidBrush(_BubbleColor)), p);
  3055. }
  3056.  
  3057. G.Dispose();
  3058. e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
  3059. e.Graphics.DrawImageUnscaled(B, 0, 0);
  3060. B.Dispose();
  3061. }
  3062. }
  3063.  
  3064. #endregion
  3065. #region Separator
  3066.  
  3067. public class iTalk_Separator : Control
  3068. {
  3069.  
  3070. public iTalk_Separator()
  3071. {
  3072. SetStyle(ControlStyles.ResizeRedraw, true);
  3073. this.Size = new Size(120, 10);
  3074. }
  3075.  
  3076. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  3077. {
  3078. base.OnPaint(e);
  3079. e.Graphics.DrawLine(new Pen(Color.FromArgb(184, 183, 188)), 0, 5, Width, 5);
  3080. }
  3081. }
  3082.  
  3083. #endregion
  3084. #region Panel
  3085.  
  3086. class iTalk_Panel : ContainerControl
  3087. {
  3088.  
  3089.  
  3090. private GraphicsPath Shape;
  3091. public iTalk_Panel()
  3092. {
  3093. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  3094. SetStyle(ControlStyles.UserPaint, true);
  3095.  
  3096. BackColor = Color.Transparent;
  3097. this.Size = new Size(187, 117);
  3098. Padding = new Padding(5, 5, 5, 5);
  3099. DoubleBuffered = true;
  3100. }
  3101.  
  3102. protected override void OnResize(System.EventArgs e)
  3103. {
  3104. base.OnResize(e);
  3105.  
  3106. Shape = new GraphicsPath();
  3107. var _with1 = Shape;
  3108. _with1.AddArc(0, 0, 10, 10, 180, 90);
  3109. _with1.AddArc(Width - 11, 0, 10, 10, -90, 90);
  3110. _with1.AddArc(Width - 11, Height - 11, 10, 10, 0, 90);
  3111. _with1.AddArc(0, Height - 11, 10, 10, 90, 90);
  3112. _with1.CloseAllFigures();
  3113. }
  3114.  
  3115. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  3116. {
  3117. base.OnPaint(e);
  3118. Bitmap B = new Bitmap(Width, Height);
  3119. Graphics G = Graphics.FromImage(B);
  3120.  
  3121. G.SmoothingMode = SmoothingMode.HighQuality;
  3122.  
  3123. G.Clear(Color.Transparent);
  3124. G.FillPath(Brushes.White, Shape); // Draw RTB background
  3125. G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), Shape); // Draw border
  3126.  
  3127. G.Dispose();
  3128. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  3129. B.Dispose();
  3130. }
  3131. }
  3132.  
  3133. #endregion
  3134. #region GroupBox
  3135.  
  3136. public class iTalk_GroupBox : ContainerControl
  3137. {
  3138.  
  3139. public iTalk_GroupBox()
  3140. {
  3141. SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
  3142. BackColor = Color.Transparent;
  3143. DoubleBuffered = true;
  3144. this.Size = new Size(212, 104);
  3145. this.MinimumSize = new Size(136, 50);
  3146. this.Padding = new Padding(5, 28, 5, 5);
  3147. }
  3148.  
  3149. protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  3150. {
  3151. base.OnPaint(e);
  3152. Bitmap B = new Bitmap(Width, Height);
  3153. Graphics G = Graphics.FromImage(B);
  3154. Rectangle TitleBox = new Rectangle(51, 3, Width - 103, 18);
  3155. Rectangle box = new Rectangle(0, 0, Width - 1, Height - 10);
  3156.  
  3157. G.Clear(Color.Transparent);
  3158. G.SmoothingMode = SmoothingMode.HighQuality;
  3159.  
  3160. // Draw the body of the GroupBox
  3161. G.FillPath(Brushes.White, RoundRectangle.RoundRect(new Rectangle(1, 12, Width - 3, box.Height - 1), 8));
  3162. // Draw the border of the GroupBox
  3163. G.DrawPath(new Pen(Color.FromArgb(159, 159, 161)), RoundRectangle.RoundRect(new Rectangle(1, 12, Width - 3, Height - 13), 8));
  3164.  
  3165. // Draw the background of the title box
  3166. G.FillPath(Brushes.White, RoundRectangle.RoundRect(TitleBox, 1));
  3167. // Draw the border of the title box
  3168. G.DrawPath(new Pen(Color.FromArgb(182, 180, 186)), RoundRectangle.RoundRect(TitleBox, 4));
  3169. // Draw the specified string from 'Text' property inside the title box
  3170. G.DrawString(Text, new Font("Tahoma", 9, FontStyle.Regular), new SolidBrush(Color.FromArgb(53, 53, 53)), TitleBox, new StringFormat
  3171. {
  3172. Alignment = StringAlignment.Center,
  3173. LineAlignment = StringAlignment.Center
  3174. });
  3175.  
  3176. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  3177. G.Dispose();
  3178. B.Dispose();
  3179. }
  3180. }
  3181.  
  3182. #endregion
  3183. #region CheckBox
  3184.  
  3185. [DefaultEvent("CheckedChanged")]
  3186. class iTalk_CheckBox : Control
  3187. {
  3188.  
  3189. #region Variables
  3190.  
  3191. private GraphicsPath Shape;
  3192. private LinearGradientBrush GB;
  3193. private Rectangle R1;
  3194. private Rectangle R2;
  3195. private bool _Checked;
  3196. public event CheckedChangedEventHandler CheckedChanged;
  3197. public delegate void CheckedChangedEventHandler(object sender);
  3198.  
  3199. #endregion
  3200. #region Properties
  3201.  
  3202. public bool Checked
  3203. {
  3204. get { return _Checked; }
  3205. set
  3206. {
  3207. _Checked = value;
  3208. if (CheckedChanged != null)
  3209. {
  3210. CheckedChanged(this);
  3211. }
  3212. Invalidate();
  3213. }
  3214. }
  3215.  
  3216. #endregion
  3217.  
  3218. public iTalk_CheckBox()
  3219. {
  3220. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  3221.  
  3222. BackColor = Color.Transparent;
  3223. DoubleBuffered = true;
  3224. Font = new Font("Segoe UI", 10);
  3225. Size = new Size(120, 26);
  3226. }
  3227.  
  3228. protected override void OnClick(EventArgs e)
  3229. {
  3230. _Checked = !_Checked;
  3231. if (CheckedChanged != null)
  3232. {
  3233. CheckedChanged(this);
  3234. }
  3235. Invalidate();
  3236. base.OnClick(e);
  3237. }
  3238.  
  3239. protected override void OnTextChanged(System.EventArgs e)
  3240. {
  3241. Invalidate();
  3242. base.OnTextChanged(e);
  3243. }
  3244.  
  3245. protected override void OnResize(System.EventArgs e)
  3246. {
  3247. if (Width > 0 && Height > 0)
  3248. {
  3249. Shape = new GraphicsPath();
  3250.  
  3251. R1 = new Rectangle(17, 0, Width, Height + 1);
  3252. R2 = new Rectangle(0, 0, Width, Height);
  3253. GB = new LinearGradientBrush(new Rectangle(0, 0, 25, 25), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240), 90);
  3254.  
  3255. var _Shape = Shape;
  3256. _Shape.AddArc(0, 0, 7, 7, 180, 90);
  3257. _Shape.AddArc(7, 0, 7, 7, -90, 90);
  3258. _Shape.AddArc(7, 7, 7, 7, 0, 90);
  3259. _Shape.AddArc(0, 7, 7, 7, 90, 90);
  3260. _Shape.CloseAllFigures();
  3261. Height = 15;
  3262. }
  3263.  
  3264. Invalidate();
  3265. base.OnResize(e);
  3266. }
  3267.  
  3268. protected override void OnPaint(PaintEventArgs e)
  3269. {
  3270. base.OnPaint(e);
  3271.  
  3272. var _G = e.Graphics;
  3273. _G.Clear(Color.FromArgb(246, 246, 246));
  3274. _G.SmoothingMode = SmoothingMode.AntiAlias;
  3275. // Fill the body of the CheckBox
  3276. _G.FillPath(GB, Shape);
  3277. // Draw the border
  3278. _G.DrawPath(new Pen(Color.FromArgb(160, 160, 160)), Shape);
  3279. // Draw the string
  3280. _G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(142, 142, 142)), R1, new StringFormat { LineAlignment = StringAlignment.Center });
  3281.  
  3282. if (Checked)
  3283. {
  3284. _G.DrawString("ü", new Font("Wingdings", 14), new SolidBrush(Color.FromArgb(142, 142, 142)), new Rectangle(-2, 1, Width, Height), new StringFormat { LineAlignment = StringAlignment.Center });
  3285. }
  3286. e.Dispose();
  3287. }
  3288. }
  3289.  
  3290. #endregion
  3291. #region RadioButton
  3292.  
  3293. [DefaultEvent("CheckedChanged")]
  3294. class iTalk_RadioButton : Control
  3295. {
  3296.  
  3297. #region Enums
  3298.  
  3299. public enum MouseState : byte
  3300. {
  3301. None = 0,
  3302. Over = 1,
  3303. Down = 2,
  3304. Block = 3
  3305. }
  3306.  
  3307. #endregion
  3308. #region Variables
  3309.  
  3310. private bool _Checked;
  3311. public event CheckedChangedEventHandler CheckedChanged;
  3312. public delegate void CheckedChangedEventHandler(object sender);
  3313.  
  3314. #endregion
  3315. #region Properties
  3316.  
  3317. public bool Checked
  3318. {
  3319. get { return _Checked; }
  3320. set
  3321. {
  3322. _Checked = value;
  3323. InvalidateControls();
  3324. if (CheckedChanged != null)
  3325. {
  3326. CheckedChanged(this);
  3327. }
  3328. Invalidate();
  3329. }
  3330. }
  3331.  
  3332. #endregion
  3333. #region EventArgs
  3334.  
  3335. protected override void OnTextChanged(System.EventArgs e)
  3336. {
  3337. Invalidate();
  3338. base.OnTextChanged(e);
  3339. }
  3340.  
  3341. protected override void OnResize(EventArgs e)
  3342. {
  3343. base.OnResize(e);
  3344. Height = 15;
  3345. }
  3346.  
  3347. protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
  3348. {
  3349. if (!_Checked)
  3350. Checked = true;
  3351. base.OnMouseDown(e);
  3352. }
  3353.  
  3354. #endregion
  3355.  
  3356. public iTalk_RadioButton()
  3357. {
  3358. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
  3359. BackColor = Color.Transparent;
  3360. Font = new Font("Segoe UI", 10);
  3361. Width = 132;
  3362. }
  3363.  
  3364. private void InvalidateControls()
  3365. {
  3366. if (!IsHandleCreated || !_Checked)
  3367. return;
  3368.  
  3369. foreach (Control _Control in Parent.Controls)
  3370. {
  3371. if (!object.ReferenceEquals(_Control, this) && _Control is iTalk_RadioButton)
  3372. {
  3373. ((iTalk_RadioButton)_Control).Checked = false;
  3374. }
  3375. }
  3376. }
  3377.  
  3378. protected override void OnPaint(PaintEventArgs e)
  3379. {
  3380. base.OnPaint(e);
  3381. var _G = e.Graphics;
  3382.  
  3383. _G.Clear(Color.FromArgb(246, 246, 246));
  3384. _G.SmoothingMode = SmoothingMode.AntiAlias;
  3385.  
  3386. LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(14, 14)), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240), 90);
  3387. _G.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(14, 14)));
  3388.  
  3389. GraphicsPath GP = new GraphicsPath();
  3390. GP.AddEllipse(new Rectangle(0, 0, 14, 14));
  3391. _G.SetClip(GP);
  3392. _G.ResetClip();
  3393.  
  3394. // Draw ellipse border
  3395. _G.DrawEllipse(new Pen(Color.FromArgb(160, 160, 160)), new Rectangle(new Point(0, 0), new Size(14, 14)));
  3396.  
  3397. // Draw an ellipse inside the body
  3398. if (_Checked)
  3399. {
  3400. SolidBrush EllipseColor = new SolidBrush(Color.FromArgb(142, 142, 142));
  3401. _G.FillEllipse(EllipseColor, new Rectangle(new Point(4, 4), new Size(6, 6)));
  3402. }
  3403. // Draw the string specified in 'Text' property
  3404. _G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(142, 142, 142)), 16, 8, new StringFormat { LineAlignment = StringAlignment.Center });
  3405.  
  3406. e.Dispose();
  3407. }
  3408. }
  3409.  
  3410. #endregion
  3411. #region Notification Number
  3412.  
  3413. class iTalk_NotificationNumber : Control
  3414. {
  3415. #region Variables
  3416.  
  3417. private int _Value = 0;
  3418. private int _Maximum = 99;
  3419.  
  3420. #endregion
  3421. #region Properties
  3422.  
  3423. public int Value
  3424. {
  3425. get
  3426. {
  3427. if (this._Value == 0)
  3428. {
  3429. return 0;
  3430. }
  3431. return this._Value;
  3432. }
  3433. set
  3434. {
  3435. if (value > this._Maximum)
  3436. {
  3437. value = this._Maximum;
  3438. }
  3439. this._Value = value;
  3440. this.Invalidate();
  3441. }
  3442. }
  3443.  
  3444. public int Maximum
  3445. {
  3446. get
  3447. {
  3448. return this._Maximum;
  3449. }
  3450. set
  3451. {
  3452. if (value < this._Value)
  3453. {
  3454. this._Value = value;
  3455. }
  3456. this._Maximum = value;
  3457. this.Invalidate();
  3458. }
  3459. }
  3460.  
  3461.  
  3462.  
  3463. #endregion
  3464.  
  3465. public iTalk_NotificationNumber()
  3466. {
  3467. SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  3468. SetStyle(ControlStyles.UserPaint, true);
  3469.  
  3470. Text = null;
  3471. DoubleBuffered = true;
  3472. }
  3473.  
  3474. protected override void OnResize(EventArgs e)
  3475. {
  3476. base.OnResize(e);
  3477. Height = 20;
  3478. Width = 20;
  3479. }
  3480.  
  3481. protected override void OnPaint(PaintEventArgs e)
  3482. {
  3483. base.OnPaint(e);
  3484. var _G = e.Graphics;
  3485. string myString = _Value.ToString();
  3486. _G.Clear(BackColor);
  3487. _G.SmoothingMode = SmoothingMode.AntiAlias;
  3488. LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(18, 20)), Color.FromArgb(197, 69, 68), Color.FromArgb(176, 52, 52), 90f);
  3489.  
  3490. // Fills the body with LGB gradient
  3491. _G.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(18, 18)));
  3492. // Draw border
  3493. _G.DrawEllipse(new Pen(Color.FromArgb(205, 70, 66)), new Rectangle(new Point(0, 0), new Size(18, 18)));
  3494. _G.DrawString(myString, new Font("Segoe UI", 8, FontStyle.Bold), new SolidBrush(Color.FromArgb(255, 255, 253)), new Rectangle(0, 0, Width - 2, Height), new StringFormat
  3495. {
  3496. Alignment = StringAlignment.Center,
  3497. LineAlignment = StringAlignment.Center
  3498. });
  3499. e.Dispose();
  3500. }
  3501.  
  3502. }
  3503.  
  3504. #endregion
  3505. #region ListView
  3506.  
  3507. class iTalk_Listview : ListView
  3508. {
  3509.  
  3510. [DllImport("uxtheme", CharSet = CharSet.Unicode)]
  3511. public static extern int SetWindowTheme(IntPtr hWnd, string textSubAppName, string textSubIdList);
  3512.  
  3513. public iTalk_Listview()
  3514. {
  3515. this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
  3516. this.DoubleBuffered = true;
  3517. HeaderStyle = ColumnHeaderStyle.Nonclickable;
  3518. BorderStyle = System.Windows.Forms.BorderStyle.None;
  3519. }
  3520.  
  3521. protected override void OnHandleCreated(EventArgs e)
  3522. {
  3523. iTalk_Listview.SetWindowTheme(this.Handle, "explorer", null);
  3524. base.OnHandleCreated(e);
  3525. }
  3526. }
  3527.  
  3528. #endregion
  3529. #region ComboBox
  3530.  
  3531. class iTalk_ComboBox : ComboBox
  3532. {
  3533.  
  3534. #region Variables
  3535.  
  3536. private int _StartIndex = 0;
  3537. private Color _HoverSelectionColor = Color.FromArgb(241, 241, 241);
  3538.  
  3539. #endregion
  3540. #region Custom Properties
  3541.  
  3542. public int StartIndex
  3543. {
  3544. get { return _StartIndex; }
  3545. set
  3546. {
  3547. _StartIndex = value;
  3548. try
  3549. {
  3550. base.SelectedIndex = value;
  3551. }
  3552. catch
  3553. {
  3554. }
  3555. Invalidate();
  3556. }
  3557. }
  3558.  
  3559. public Color HoverSelectionColor
  3560. {
  3561. get { return _HoverSelectionColor; }
  3562. set
  3563. {
  3564. _HoverSelectionColor = value;
  3565. Invalidate();
  3566. }
  3567. }
  3568.  
  3569. #endregion
  3570. #region EventArgs
  3571.  
  3572. protected override void OnDrawItem(DrawItemEventArgs e)
  3573. {
  3574. if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
  3575. {
  3576. e.Graphics.FillRectangle(new SolidBrush(_HoverSelectionColor), e.Bounds);
  3577. }
  3578. else
  3579. {
  3580. e.Graphics.FillRectangle(Brushes.White, e.Bounds);
  3581. }
  3582.  
  3583. if (!(e.Index == -1))
  3584. {
  3585. e.Graphics.DrawString(GetItemText(Items[e.Index]), e.Font, Brushes.DimGray, e.Bounds);
  3586. }
  3587. }
  3588.  
  3589. protected override void OnLostFocus(EventArgs e)
  3590. {
  3591. base.OnLostFocus(e);
  3592. SuspendLayout();
  3593. Update();
  3594. ResumeLayout();
  3595. }
  3596.  
  3597. protected override void OnPaintBackground(PaintEventArgs e)
  3598. {
  3599. base.OnPaintBackground(e);
  3600. }
  3601.  
  3602. #endregion
  3603.  
  3604. public iTalk_ComboBox()
  3605. {
  3606. SetStyle((ControlStyles)139286, true);
  3607. SetStyle(ControlStyles.Selectable, false);
  3608.  
  3609. DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
  3610. DropDownStyle = ComboBoxStyle.DropDownList;
  3611.  
  3612. BackColor = Color.FromArgb(246, 246, 246);
  3613. ForeColor = Color.FromArgb(142, 142, 142);
  3614. Size = new Size(135, 26);
  3615. ItemHeight = 20;
  3616. DropDownHeight = 100;
  3617. Font = new Font("Segoe UI", 10, FontStyle.Regular);
  3618. }
  3619.  
  3620. protected override void OnPaint(PaintEventArgs e)
  3621. {
  3622. base.OnPaint(e);
  3623. LinearGradientBrush LGB = default(LinearGradientBrush);
  3624. GraphicsPath GP = default(GraphicsPath);
  3625.  
  3626. e.Graphics.Clear(BackColor);
  3627. e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
  3628.  
  3629. // Create a curvy border
  3630. GP = RoundRectangle.RoundRect(0, 0, Width - 1, Height - 1, 5);
  3631. // Fills the body of the rectangle with a gradient
  3632. LGB = new LinearGradientBrush(ClientRectangle, Color.FromArgb(241, 241, 241), Color.FromArgb(241, 241, 241), 90f);
  3633.  
  3634. e.Graphics.SetClip(GP);
  3635. e.Graphics.FillRectangle(LGB, ClientRectangle);
  3636. e.Graphics.ResetClip();
  3637.  
  3638. // Draw rectangle border
  3639. e.Graphics.DrawPath(new Pen(Color.FromArgb(204, 204, 204)), GP);
  3640. // Draw string
  3641. e.Graphics.DrawString(Text, Font, new SolidBrush(Color.FromArgb(142, 142, 142)), new Rectangle(3, 0, Width - 20, Height), new StringFormat
  3642. {
  3643. LineAlignment = StringAlignment.Center,
  3644. Alignment = StringAlignment.Near
  3645. });
  3646.  
  3647. // Draw the dropdown arrow
  3648. e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160), 2), new Point(Width - 18, 10), new Point(Width - 14, 14));
  3649. e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160), 2), new Point(Width - 14, 14), new Point(Width - 10, 10));
  3650. e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160)), new Point(Width - 14, 15), new Point(Width - 14, 14));
  3651.  
  3652. GP.Dispose();
  3653. LGB.Dispose();
  3654. }
  3655. }
  3656.  
  3657. #endregion
  3658. #region Circular ProgressBar
  3659.  
  3660. public class iTalk_ProgressBar : Control
  3661. {
  3662.  
  3663. #region Enums
  3664.  
  3665. public enum _ProgressShape
  3666. {
  3667. Round,
  3668. Flat
  3669. }
  3670.  
  3671. #endregion
  3672. #region Variables
  3673.  
  3674. private long _Value;
  3675. private long _Maximum = 100;
  3676. private Color _ProgressColor1 = Color.FromArgb(92, 92, 92);
  3677. private Color _ProgressColor2 = Color.FromArgb(92, 92, 92);
  3678. private _ProgressShape ProgressShapeVal;
  3679.  
  3680. #endregion
  3681. #region Custom Properties
  3682.  
  3683. public long Value
  3684. {
  3685. get { return _Value; }
  3686. set
  3687. {
  3688. if (value > _Maximum)
  3689. value = _Maximum;
  3690. _Value = value;
  3691. Invalidate();
  3692. }
  3693. }
  3694.  
  3695. public long Maximum
  3696. {
  3697. get { return _Maximum; }
  3698. set
  3699. {
  3700. if (value < 1)
  3701. value = 1;
  3702. _Maximum = value;
  3703. Invalidate();
  3704. }
  3705. }
  3706.  
  3707. public Color ProgressColor1
  3708. {
  3709. get { return _ProgressColor1; }
  3710. set
  3711. {
  3712. _ProgressColor1 = value;
  3713. Invalidate();
  3714. }
  3715. }
  3716.  
  3717. public Color ProgressColor2
  3718. {
  3719. get { return _ProgressColor2; }
  3720. set
  3721. {
  3722. _ProgressColor2 = value;
  3723. Invalidate();
  3724. }
  3725. }
  3726.  
  3727. public _ProgressShape ProgressShape
  3728. {
  3729. get { return ProgressShapeVal; }
  3730. set
  3731. {
  3732. ProgressShapeVal = value;
  3733. Invalidate();
  3734. }
  3735. }
  3736.  
  3737. #endregion
  3738. #region EventArgs
  3739.  
  3740. protected override void OnResize(EventArgs e)
  3741. {
  3742. base.OnResize(e);
  3743. SetStandardSize();
  3744. }
  3745.  
  3746. protected override void OnSizeChanged(EventArgs e)
  3747. {
  3748. base.OnSizeChanged(e);
  3749. SetStandardSize();
  3750. }
  3751.  
  3752. protected override void OnPaintBackground(PaintEventArgs p)
  3753. {
  3754. base.OnPaintBackground(p);
  3755. }
  3756.  
  3757. #endregion
  3758.  
  3759. public iTalk_ProgressBar()
  3760. {
  3761. Size = new Size(130, 130);
  3762. Font = new Font("Segoe UI", 15);
  3763. MinimumSize = new Size(100, 100);
  3764. DoubleBuffered = true;
  3765. }
  3766.  
  3767. private void SetStandardSize()
  3768. {
  3769. int _Size = Math.Max(Width, Height);
  3770. Size = new Size(_Size, _Size);
  3771. }
  3772.  
  3773. public void Increment(int Val)
  3774. {
  3775. this._Value += Val;
  3776. Invalidate();
  3777. }
  3778.  
  3779. public void Decrement(int Val)
  3780. {
  3781. this._Value -= Val;
  3782. Invalidate();
  3783. }
  3784.  
  3785. protected override void OnPaint(PaintEventArgs e)
  3786. {
  3787. base.OnPaint(e);
  3788. using (Bitmap bitmap = new Bitmap(this.Width, this.Height))
  3789. {
  3790. using (Graphics graphics = Graphics.FromImage(bitmap))
  3791. {
  3792. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  3793. graphics.Clear(this.BackColor);
  3794. using (LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, this._ProgressColor1, this._ProgressColor2, LinearGradientMode.ForwardDiagonal))
  3795. {
  3796. using (Pen pen = new Pen(brush, 14f))
  3797. {
  3798. switch (this.ProgressShapeVal)
  3799. {
  3800. case _ProgressShape.Round:
  3801. pen.StartCap = LineCap.Round;
  3802. pen.EndCap = LineCap.Round;
  3803. break;
  3804.  
  3805. case _ProgressShape.Flat:
  3806. pen.StartCap = LineCap.Flat;
  3807. pen.EndCap = LineCap.Flat;
  3808. break;
  3809. }
  3810. graphics.DrawArc(pen, 0x12, 0x12, (this.Width - 0x23) - 2, (this.Height - 0x23) - 2, -90, (int)Math.Round((double)((360.0 / ((double)this._Maximum)) * this._Value)));
  3811. }
  3812. }
  3813. using (LinearGradientBrush brush2 = new LinearGradientBrush(this.ClientRectangle, Color.FromArgb(0x34, 0x34, 0x34), Color.FromArgb(0x34, 0x34, 0x34), LinearGradientMode.Vertical))
  3814. {
  3815. graphics.FillEllipse(brush2, 0x18, 0x18, (this.Width - 0x30) - 1, (this.Height - 0x30) - 1);
  3816. }
  3817. SizeF MS = graphics.MeasureString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font);
  3818. graphics.DrawString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font, Brushes.White, Convert.ToInt32(Width / 2 - MS.Width / 2), Convert.ToInt32(Height / 2 - MS.Height / 2));
  3819. e.Graphics.DrawImage(bitmap, 0, 0);
  3820. graphics.Dispose();
  3821. bitmap.Dispose();
  3822. }
  3823. }
  3824. }
  3825. }
  3826.  
  3827. #endregion
  3828. #region Progress Indicator
  3829.  
  3830. class iTalk_ProgressIndicator : Control
  3831. {
  3832.  
  3833. #region Variables
  3834.  
  3835. private readonly SolidBrush BaseColor = new SolidBrush(Color.DarkGray);
  3836. private readonly SolidBrush AnimationColor = new SolidBrush(Color.DimGray);
  3837.  
  3838. private readonly Timer AnimationSpeed = new Timer();
  3839. private PointF[] FloatPoint;
  3840. private BufferedGraphics BuffGraphics;
  3841. private int IndicatorIndex;
  3842. private readonly BufferedGraphicsContext GraphicsContext = BufferedGraphicsManager.Current;
  3843.  
  3844. #endregion
  3845. #region Custom Properties
  3846.  
  3847. public Color P_BaseColor
  3848. {
  3849. get { return BaseColor.Color; }
  3850. set { BaseColor.Color = value; }
  3851. }
  3852.  
  3853. public Color P_AnimationColor
  3854. {
  3855. get { return AnimationColor.Color; }
  3856. set { AnimationColor.Color = value; }
  3857. }
  3858.  
  3859. public int P_AnimationSpeed
  3860. {
  3861. get { return AnimationSpeed.Interval; }
  3862. set { AnimationSpeed.Interval = value; }
  3863. }
  3864.  
  3865. #endregion
  3866. #region EventArgs
  3867.  
  3868. protected override void OnSizeChanged(EventArgs e)
  3869. {
  3870. base.OnSizeChanged(e);
  3871. SetStandardSize();
  3872. UpdateGraphics();
  3873. SetPoints();
  3874. }
  3875.  
  3876. protected override void OnEnabledChanged(EventArgs e)
  3877. {
  3878. base.OnEnabledChanged(e);
  3879. AnimationSpeed.Enabled = this.Enabled;
  3880. }
  3881.  
  3882. protected override void OnHandleCreated(EventArgs e)
  3883. {
  3884. base.OnHandleCreated(e);
  3885. AnimationSpeed.Tick += AnimationSpeed_Tick;
  3886. AnimationSpeed.Start();
  3887. }
  3888.  
  3889. private void AnimationSpeed_Tick(object sender, EventArgs e)
  3890. {
  3891. if (IndicatorIndex.Equals(0))
  3892. {
  3893. IndicatorIndex = FloatPoint.Length - 1;
  3894. }
  3895. else
  3896. {
  3897. IndicatorIndex -= 1;
  3898. }
  3899. this.Invalidate(false);
  3900. }
  3901.  
  3902. #endregion
  3903.  
  3904. public iTalk_ProgressIndicator()
  3905. {
  3906. this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
  3907.  
  3908. Size = new Size(80, 80);
  3909. Text = string.Empty;
  3910. MinimumSize = new Size(80, 80);
  3911. SetPoints();
  3912. AnimationSpeed.Interval = 100;
  3913. }
  3914.  
  3915. private void SetStandardSize()
  3916. {
  3917. int _Size = Math.Max(Width, Height);
  3918. Size = new Size(_Size, _Size);
  3919. }
  3920.  
  3921. private void SetPoints()
  3922. {
  3923. Stack<PointF> stack = new Stack<PointF>();
  3924. PointF startingFloatPoint = new PointF(((float)this.Width) / 2f, ((float)this.Height) / 2f);
  3925. for (float i = 0f; i < 360f; i += 45f)
  3926. {
  3927. this.SetValue(startingFloatPoint, (int)Math.Round((double)((((double)this.Width) / 2.0) - 15.0)), (double)i);
  3928. PointF endPoint = this.EndPoint;
  3929. endPoint = new PointF(endPoint.X - 7.5f, endPoint.Y - 7.5f);
  3930. stack.Push(endPoint);
  3931. }
  3932. this.FloatPoint = stack.ToArray();
  3933. }
  3934.  
  3935. private void UpdateGraphics()
  3936. {
  3937. if ((this.Width > 0) && (this.Height > 0))
  3938. {
  3939. Size size2 = new Size(this.Width + 1, this.Height + 1);
  3940. this.GraphicsContext.MaximumBuffer = size2;
  3941. this.BuffGraphics = this.GraphicsContext.Allocate(this.CreateGraphics(), this.ClientRectangle);
  3942. this.BuffGraphics.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
  3943. }
  3944. }
  3945.  
  3946. protected override void OnPaint(PaintEventArgs e)
  3947. {
  3948. base.OnPaint(e);
  3949. this.BuffGraphics.Graphics.Clear(this.BackColor);
  3950. int num2 = this.FloatPoint.Length - 1;
  3951. for (int i = 0; i <= num2; i++)
  3952. {
  3953. if (this.IndicatorIndex == i)
  3954. {
  3955. this.BuffGraphics.Graphics.FillEllipse(this.AnimationColor, this.FloatPoint[i].X, this.FloatPoint[i].Y, 15f, 15f);
  3956. }
  3957. else
  3958. {
  3959. this.BuffGraphics.Graphics.FillEllipse(this.BaseColor, this.FloatPoint[i].X, this.FloatPoint[i].Y, 15f, 15f);
  3960. }
  3961. }
  3962. this.BuffGraphics.Render(e.Graphics);
  3963. }
  3964.  
  3965.  
  3966. private double Rise;
  3967. private double Run;
  3968. private PointF _StartingFloatPoint;
  3969.  
  3970. private X AssignValues<X>(ref X Run, X Length)
  3971. {
  3972. Run = Length;
  3973. return Length;
  3974. }
  3975.  
  3976. private void SetValue(PointF StartingFloatPoint, int Length, double Angle)
  3977. {
  3978. double CircleRadian = Math.PI * Angle / 180.0;
  3979.  
  3980. _StartingFloatPoint = StartingFloatPoint;
  3981. Rise = AssignValues(ref Run, Length);
  3982. Rise = Math.Sin(CircleRadian) * Rise;
  3983. Run = Math.Cos(CircleRadian) * Run;
  3984. }
  3985.  
  3986. private PointF EndPoint
  3987. {
  3988. get
  3989. {
  3990. float LocationX = Convert.ToSingle(_StartingFloatPoint.Y + Rise);
  3991. float LocationY = Convert.ToSingle(_StartingFloatPoint.X + Run);
  3992.  
  3993. return new PointF(LocationY, LocationX);
  3994. }
  3995. }
  3996. }
  3997.  
  3998. #endregion
  3999. #region TabControl
  4000.  
  4001. class iTalk_TabControl : TabControl
  4002. {
  4003.  
  4004. // NOTE: For best quality icons/images on the TabControl; from the associated ImageList, set
  4005. // the image size (24,24) so it can fit in the tab rectangle. However, to ensure a
  4006. // high-quality image drawing, make sure you only add (32,32) images and not (24,24) as
  4007. // determined in the ImageList
  4008.  
  4009. // INFO: A free, non-commercial icon list that would fit in perfectly with the TabControl is
  4010. // Wireframe Toolbar Icons by Gentleface. Licensed under Creative Commons Attribution.
  4011. // Check it out from here: http://www.gentleface.com/free_icon_set.html
  4012.  
  4013. public iTalk_TabControl()
  4014. {
  4015. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true);
  4016.  
  4017. DoubleBuffered = true;
  4018. SizeMode = TabSizeMode.Fixed;
  4019. ItemSize = new Size(44, 135);
  4020. DrawMode = TabDrawMode.OwnerDrawFixed;
  4021.  
  4022. foreach (TabPage Page in this.TabPages)
  4023. {
  4024. Page.BackColor = Color.FromArgb(246, 246, 246);
  4025. }
  4026. }
  4027.  
  4028. protected override void CreateHandle()
  4029. {
  4030. base.CreateHandle();
  4031.  
  4032. base.DoubleBuffered = true;
  4033. SizeMode = TabSizeMode.Fixed;
  4034. Appearance = TabAppearance.Normal;
  4035. Alignment = TabAlignment.Left;
  4036. }
  4037.  
  4038.  
  4039. protected override void OnControlAdded(ControlEventArgs e)
  4040. {
  4041. base.OnControlAdded(e);
  4042. if (e.Control is TabPage)
  4043. {
  4044. IEnumerator enumerator;
  4045. try
  4046. {
  4047. enumerator = this.Controls.GetEnumerator();
  4048. while (enumerator.MoveNext())
  4049. {
  4050. TabPage current = (TabPage)enumerator.Current;
  4051. current = new TabPage();
  4052. }
  4053. }
  4054. finally
  4055. {
  4056. e.Control.BackColor = Color.FromArgb(246, 246, 246);
  4057. }
  4058. }
  4059. }
  4060.  
  4061. protected override void OnPaint(PaintEventArgs e)
  4062. {
  4063. base.OnPaint(e);
  4064. Bitmap B = new Bitmap(Width, Height);
  4065. Graphics G = Graphics.FromImage(B);
  4066.  
  4067. var _Graphics = G;
  4068.  
  4069. _Graphics.Clear(Color.FromArgb(246, 246, 246));
  4070. _Graphics.SmoothingMode = SmoothingMode.HighSpeed;
  4071. _Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
  4072. _Graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
  4073.  
  4074. // Draw tab selector background
  4075. _Graphics.FillRectangle(new SolidBrush(Color.FromArgb(54, 57, 64)), new Rectangle(-5, 0, ItemSize.Height + 4, Height));
  4076. // Draw vertical line at the end of the tab selector rectangle
  4077. _Graphics.DrawLine(new Pen(Color.FromArgb(25, 26, 28)), ItemSize.Height - 1, 0, ItemSize.Height - 1, Height);
  4078.  
  4079. for (int TabIndex = 0; TabIndex <= TabCount - 1; TabIndex++)
  4080. {
  4081. if (TabIndex == SelectedIndex)
  4082. {
  4083. Rectangle TabRect = new Rectangle(new Point(GetTabRect(TabIndex).Location.X - 2, GetTabRect(TabIndex).Location.Y - 2), new Size(GetTabRect(TabIndex).Width + 3, GetTabRect(TabIndex).Height - 8));
  4084.  
  4085. // Draw background of the selected tab
  4086. _Graphics.FillRectangle(new SolidBrush(Color.FromArgb(35, 36, 38)), TabRect.X, TabRect.Y, TabRect.Width - 4, TabRect.Height + 3);
  4087. // Draw a tab highlighter on the background of the selected tab
  4088. Rectangle TabHighlighter = new Rectangle(new Point(GetTabRect(TabIndex).X - 2, GetTabRect(TabIndex).Location.Y - (TabIndex == 0 ? 1 : 1)), new Size(4, GetTabRect(TabIndex).Height - 7));
  4089. _Graphics.FillRectangle(new SolidBrush(Color.FromArgb(89, 169, 222)), TabHighlighter);
  4090. // Draw tab text
  4091. _Graphics.DrawString(TabPages[TabIndex].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold), new SolidBrush(Color.FromArgb(254, 255, 255)), new Rectangle(TabRect.Left + 40, TabRect.Top + 12, TabRect.Width - 40, TabRect.Height), new StringFormat { Alignment = StringAlignment.Near });
  4092.  
  4093. if (this.ImageList != null)
  4094. {
  4095. int Index = TabPages[TabIndex].ImageIndex;
  4096. if (!(Index == -1))
  4097. {
  4098. _Graphics.DrawImage(ImageList.Images[TabPages[TabIndex].ImageIndex], TabRect.X + 9, TabRect.Y + 6, 24, 24);
  4099. }
  4100. }
  4101. }
  4102. else
  4103. {
  4104. Rectangle TabRect = new Rectangle(new Point(GetTabRect(TabIndex).Location.X - 2, GetTabRect(TabIndex).Location.Y - 2), new Size(GetTabRect(TabIndex).Width + 3, GetTabRect(TabIndex).Height - 8));
  4105. _Graphics.DrawString(TabPages[TabIndex].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold), new SolidBrush(Color.FromArgb(159, 162, 167)), new Rectangle(TabRect.Left + 40, TabRect.Top + 12, TabRect.Width - 40, TabRect.Height), new StringFormat { Alignment = StringAlignment.Near });
  4106.  
  4107. if (this.ImageList != null)
  4108. {
  4109. int Index = TabPages[TabIndex].ImageIndex;
  4110. if (!(Index == -1))
  4111. {
  4112. _Graphics.DrawImage(ImageList.Images[TabPages[TabIndex].ImageIndex], TabRect.X + 9, TabRect.Y + 6, 24, 24);
  4113. }
  4114. }
  4115.  
  4116. }
  4117. }
  4118. e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
  4119. e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
  4120. e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
  4121. e.Graphics.DrawImage((Image)B.Clone(), 0, 0);
  4122. G.Dispose();
  4123. B.Dispose();
  4124. }
  4125. }
  4126.  
  4127. #endregion
  4128. #region TrackBar
  4129.  
  4130. [DefaultEvent("ValueChanged")]
  4131. class iTalk_TrackBar : Control
  4132. {
  4133.  
  4134. #region Enums
  4135.  
  4136. public enum ValueDivisor
  4137. {
  4138. By1 = 1,
  4139. By10 = 10,
  4140. By100 = 100,
  4141. By1000 = 1000
  4142. }
  4143.  
  4144. #endregion
  4145. #region Variables
  4146.  
  4147. private GraphicsPath PipeBorder;
  4148. private GraphicsPath TrackBarHandle;
  4149. private Rectangle TrackBarHandleRect;
  4150. private Rectangle ValueRect;
  4151. private LinearGradientBrush VlaueLGB;
  4152. private LinearGradientBrush TrackBarHandleLGB;
  4153. private bool Cap;
  4154.  
  4155. private int ValueDrawer;
  4156. private int _Minimum = 0;
  4157. private int _Maximum = 10;
  4158. private int _Value = 0;
  4159. private Color _ValueColour = Color.FromArgb(224, 224, 224);
  4160. private bool _DrawHatch = true;
  4161. private bool _DrawValueString = false;
  4162. private bool _JumpToMouse = false;
  4163. private ValueDivisor DividedValue = ValueDivisor.By1;
  4164.  
  4165. #endregion
  4166. #region Custom Properties
  4167.  
  4168. public int Minimum
  4169. {
  4170. get { return _Minimum; }
  4171.  
  4172. set
  4173. {
  4174. if (value >= _Maximum)
  4175. value = _Maximum - 10;
  4176. if (_Value < value)
  4177. _Value = value;
  4178.  
  4179. _Minimum = value;
  4180. Invalidate();
  4181. }
  4182. }
  4183.  
  4184. public int Maximum
  4185. {
  4186. get { return _Maximum; }
  4187.  
  4188. set
  4189. {
  4190. if (value <= _Minimum)
  4191. value = _Minimum + 10;
  4192. if (_Value > value)
  4193. _Value = value;
  4194.  
  4195. _Maximum = value;
  4196. Invalidate();
  4197. }
  4198. }
  4199.  
  4200. public event ValueChangedEventHandler ValueChanged;
  4201. public delegate void ValueChangedEventHandler();
  4202. public int Value
  4203. {
  4204. get { return _Value; }
  4205. set
  4206. {
  4207. if (_Value != value)
  4208. {
  4209. if (value < _Minimum)
  4210. {
  4211. _Value = _Minimum;
  4212. }
  4213. else
  4214. {
  4215. if (value > _Maximum)
  4216. {
  4217. _Value = _Maximum;
  4218. }
  4219. else
  4220. {
  4221. _Value = value;
  4222. }
  4223. }
  4224. Invalidate();
  4225. if (ValueChanged != null)
  4226. {
  4227. ValueChanged();
  4228. }
  4229. }
  4230. }
  4231. }
  4232.  
  4233. public ValueDivisor ValueDivison
  4234. {
  4235. get
  4236. {
  4237. return this.DividedValue;
  4238. }
  4239. set
  4240. {
  4241. this.DividedValue = value;
  4242. this.Invalidate();
  4243. }
  4244. }
  4245.  
  4246. [Browsable(false)]
  4247. public float ValueToSet
  4248. {
  4249. get
  4250. {
  4251. return (float)(((double)this._Value) / ((double)this.DividedValue));
  4252. }
  4253. set
  4254. {
  4255. this.Value = (int)Math.Round((double)(value * ((float)this.DividedValue)));
  4256. }
  4257. }
  4258.  
  4259. public Color ValueColour
  4260. {
  4261. get { return _ValueColour; }
  4262. set
  4263. {
  4264. _ValueColour = value;
  4265. Invalidate();
  4266. }
  4267. }
  4268.  
  4269. public bool DrawHatch
  4270. {
  4271. get { return _DrawHatch; }
  4272. set
  4273. {
  4274. _DrawHatch = value;
  4275. Invalidate();
  4276. }
  4277. }
  4278.  
  4279. public bool DrawValueString
  4280. {
  4281. get { return _DrawValueString; }
  4282. set
  4283. {
  4284. _DrawValueString = value;
  4285. if (_DrawValueString == true)
  4286. {
  4287. Height = 40;
  4288. }
  4289. else
  4290. {
  4291. Height = 22;
  4292. }
  4293. Invalidate();
  4294. }
  4295. }
  4296.  
  4297. public bool JumpToMouse
  4298. {
  4299. get
  4300. {
  4301. return this._JumpToMouse;
  4302. }
  4303. set
  4304. {
  4305. this._JumpToMouse = value;
  4306. }
  4307. }
  4308.  
  4309. #endregion
  4310. #region EventArgs
  4311.  
  4312. protected override void OnMouseMove(MouseEventArgs e)
  4313. {
  4314. base.OnMouseMove(e);
  4315. if ((this.Cap && (e.X > -1)) && (e.X < (this.Width + 1)))
  4316. {
  4317. this.Value = this._Minimum + ((int)Math.Round((double)((this._Maximum - this._Minimum) * (((double)e.X) / ((double)this.Width)))));
  4318. }
  4319. }
  4320.  
  4321. protected override void OnMouseDown(MouseEventArgs e)
  4322. {
  4323. base.OnMouseDown(e);
  4324. if (e.Button == MouseButtons.Left)
  4325. {
  4326. this.ValueDrawer = (int) Math.Round((double) ((((double) (this._Value - this._Minimum)) / ((double) (this._Maximum - this._Minimum))) * (this.Width - 11)));
  4327. this.TrackBarHandleRect = new Rectangle(this.ValueDrawer, 0, 10, 20);
  4328. this.Cap = this.TrackBarHandleRect.Contains(e.Location);
  4329. if (this._JumpToMouse)
  4330. {
  4331. this.Value = this._Minimum + ((int) Math.Round((double) ((this._Maximum - this._Minimum) * (((double) e.X) / ((double) this.Width)))));
  4332. }
  4333. }
  4334. }
  4335.  
  4336. protected override void OnMouseUp(MouseEventArgs e)
  4337. {
  4338. base.OnMouseUp(e);
  4339. this.Cap = false;
  4340. }
  4341.  
  4342.  
  4343. #endregion
  4344.  
  4345. public iTalk_TrackBar()
  4346. {
  4347. SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true);
  4348.  
  4349. _DrawHatch = true;
  4350. Size = new Size(80, 22);
  4351. MinimumSize = new Size(37, 22);
  4352. }
  4353.  
  4354. protected override void OnResize(EventArgs e)
  4355. {
  4356. base.OnResize(e);
  4357. if (_DrawValueString == true) {
  4358. Height = 40;
  4359. } else {
  4360. Height = 22;
  4361. }
  4362. }
  4363.  
  4364. protected override void OnPaint(PaintEventArgs e)
  4365. {
  4366. base.OnPaint(e);
  4367. Graphics G = e.Graphics;
  4368. HatchBrush Hatch = new HatchBrush(HatchStyle.WideDownwardDiagonal, Color.FromArgb(20, Color.Black), Color.Transparent);
  4369. G.Clear(Parent.BackColor);
  4370. G.SmoothingMode = SmoothingMode.AntiAlias;
  4371. checked
  4372. {
  4373. this.PipeBorder = RoundRectangle.RoundRect(1, 6, this.Width - 3, 8, 3);
  4374. try
  4375. {
  4376. this.ValueDrawer = (int)Math.Round(unchecked(checked((double)(this._Value - this._Minimum) / (double)(this._Maximum - this._Minimum)) * (double)checked(this.Width - 11)));
  4377. }
  4378. catch (Exception)
  4379. {
  4380. }
  4381. this.TrackBarHandleRect = new Rectangle(this.ValueDrawer, 0, 10, 20);
  4382. G.SetClip(this.PipeBorder);
  4383. this.ValueRect = new Rectangle(1, 7, this.TrackBarHandleRect.X + this.TrackBarHandleRect.Width - 2, 7);
  4384. this.VlaueLGB = new LinearGradientBrush(this.ValueRect, this._ValueColour, this._ValueColour, 90f);
  4385. G.FillRectangle(this.VlaueLGB, this.ValueRect);
  4386.  
  4387. if (_DrawHatch == true)
  4388. {
  4389. G.FillRectangle(Hatch, this.ValueRect);
  4390. }
  4391.  
  4392. G.ResetClip();
  4393. G.SmoothingMode = SmoothingMode.AntiAlias;
  4394. G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), this.PipeBorder);
  4395. this.TrackBarHandle = RoundRectangle.RoundRect(this.TrackBarHandleRect, 3);
  4396. this.TrackBarHandleLGB = new LinearGradientBrush(this.ClientRectangle, SystemColors.Control, SystemColors.Control, 90f);
  4397. G.FillPath(this.TrackBarHandleLGB, this.TrackBarHandle);
  4398. G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), this.TrackBarHandle);
  4399.  
  4400. if (_DrawValueString == true)
  4401. {
  4402. G.DrawString(System.Convert.ToString(ValueToSet), Font, Brushes.Gray, 0, 25);
  4403. }
  4404. }
  4405. }
  4406. }
  4407.  
  4408. #endregion
  4409. #region MenuStrip
  4410.  
  4411. public class iTalk_MenuStrip : MenuStrip
  4412. {
  4413.  
  4414. public iTalk_MenuStrip()
  4415. {
  4416. this.Renderer = new ControlRenderer();
  4417. }
  4418.  
  4419. public new ControlRenderer Renderer
  4420. {
  4421. get { return (ControlRenderer)base.Renderer; }
  4422. set { base.Renderer = value; }
  4423. }
  4424.  
  4425. }
  4426.  
  4427. #endregion
  4428. #region ContextMenuStrip
  4429.  
  4430. public class iTalk_ContextMenuStrip : ContextMenuStrip
  4431. {
  4432.  
  4433. public iTalk_ContextMenuStrip()
  4434. {
  4435. this.Renderer = new ControlRenderer();
  4436. }
  4437.  
  4438. public new ControlRenderer Renderer
  4439. {
  4440. get { return (ControlRenderer)base.Renderer; }
  4441. set { base.Renderer = value; }
  4442. }
  4443. }
  4444.  
  4445. #endregion
  4446. #region StatusStrip
  4447.  
  4448. public class iTalk_StatusStrip : StatusStrip
  4449. {
  4450.  
  4451. public iTalk_StatusStrip()
  4452. {
  4453. this.Renderer = new ControlRenderer();
  4454. SizingGrip = false;
  4455. }
  4456.  
  4457. public new ControlRenderer Renderer
  4458. {
  4459. get { return (ControlRenderer)base.Renderer; }
  4460. set { base.Renderer = value; }
  4461. }
  4462. }
  4463.  
  4464. #endregion
  4465. #region Info Icon
  4466.  
  4467. class iTalk_Icon_Info : Control
  4468. {
  4469. public iTalk_Icon_Info()
  4470. {
  4471. this.ForeColor = Color.DimGray;
  4472. this.BackColor = Color.FromArgb(246, 246, 246);
  4473. this.Size = new Size(33, 33);
  4474. DoubleBuffered = true;
  4475. }
  4476. protected override void OnPaint(PaintEventArgs e)
  4477. {
  4478. e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
  4479. e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  4480.  
  4481. e.Graphics.FillEllipse(new SolidBrush(Color.Gray), new Rectangle(1, 1, 29, 29));
  4482. e.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(246, 246, 246)), new Rectangle(3, 3, 25, 25));
  4483.  
  4484. e.Graphics.DrawString("¡", new Font("Segoe UI", 25, FontStyle.Bold), new SolidBrush(Color.Gray), new Rectangle(4, -14, Width, 43), new StringFormat
  4485. {
  4486. Alignment = StringAlignment.Near,
  4487. LineAlignment = StringAlignment.Near
  4488. });
  4489. }
  4490. }
  4491.  
  4492. #endregion
  4493. #region Tick Icon
  4494.  
  4495. class iTalk_Icon_Tick : Control
  4496. {
  4497.  
  4498. public iTalk_Icon_Tick()
  4499. {
  4500. this.ForeColor = Color.DimGray;
  4501. this.BackColor = Color.FromArgb(246, 246, 246);
  4502. this.Size = new Size(33, 33);
  4503. DoubleBuffered = true;
  4504. }
  4505.  
  4506. protected override void OnPaint(PaintEventArgs e)
  4507. {
  4508. e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
  4509. e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  4510.  
  4511. e.Graphics.FillEllipse(new SolidBrush(Color.Gray), new Rectangle(1, 1, 29, 29));
  4512. e.Graphics.FillEllipse(new SolidBrush(Color.FromArgb(246, 246, 246)), new Rectangle(3, 3, 25, 25));
  4513.  
  4514. e.Graphics.DrawString("ü", new Font("Wingdings", 25, FontStyle.Bold), new SolidBrush(Color.Gray), new Rectangle(0, -3, Width, 43), new StringFormat
  4515. {
  4516. Alignment = StringAlignment.Near,
  4517. LineAlignment = StringAlignment.Near
  4518. });
  4519. }
  4520. }
  4521.  
  4522. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement