Advertisement
Astekk

darksky c# theme

Dec 3rd, 2014
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.67 KB | None | 0 0
  1. // theme base 1.5.2
  2. using System;
  3. using System.Windows.Forms;
  4. using System.Drawing;
  5. using System.Drawing.Drawing2D;
  6. using System.Windows.Forms;
  7.  
  8. public class TransparentLabel : Label
  9. {
  10. public TransparentLabel()
  11. {
  12. base.SetStyle(ControlStyles.Opaque, true);
  13. base.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
  14. this.ForeColor = Color.FromArgb(0x71, 170, 0xba);
  15. }
  16.  
  17. protected override System.Windows.Forms.CreateParams CreateParams
  18. {
  19. get
  20. {
  21. System.Windows.Forms.CreateParams createParams = base.CreateParams;
  22. createParams.ExStyle |= 0x20;
  23. return createParams;
  24. }
  25. }
  26. }
  27.  
  28. public class SkyDarkTop : Control
  29. {
  30. private Color C1 = Color.FromArgb(0x5e, 0x67, 0x6a);
  31. private Color C2 = Color.FromArgb(0x98, 0xb6, 0xc0);
  32. private Color C3 = Color.FromArgb(0x47, 70, 0x45);
  33. private Color C4 = Color.FromArgb(0x3a, 0x38, 0x36);
  34. private Color CD = Color.FromArgb(0x56, 0x5e, 0x60);
  35. private MouseState ms;
  36.  
  37. public SkyDarkTop()
  38. {
  39. this.DoubleBuffered = true;
  40. base.Size = new Size(10, 10);
  41. }
  42.  
  43. protected override void OnMouseDown(MouseEventArgs e)
  44. {
  45. base.OnMouseDown(e);
  46. this.State = MouseState.Down;
  47. }
  48.  
  49. protected override void OnMouseEnter(EventArgs e)
  50. {
  51. base.OnMouseEnter(e);
  52. this.State = MouseState.Over;
  53. }
  54.  
  55. protected override void OnMouseLeave(EventArgs e)
  56. {
  57. base.OnMouseLeave(e);
  58. this.State = MouseState.None;
  59. }
  60.  
  61. protected override void OnMouseUp(MouseEventArgs e)
  62. {
  63. base.OnMouseUp(e);
  64. this.State = MouseState.Over;
  65. }
  66.  
  67. protected override void OnPaint(PaintEventArgs e)
  68. {
  69. Bitmap image = new Bitmap(base.Width, base.Height);
  70. Graphics graphics = Graphics.FromImage(image);
  71. LinearGradientBrush brush = new LinearGradientBrush(new Point(0, 0), new Point(0, base.Height), this.C3, this.C4);
  72. graphics.FillRectangle(brush, base.ClientRectangle);
  73. brush.Dispose();
  74. graphics.SmoothingMode = SmoothingMode.HighQuality;
  75. switch (this.State)
  76. {
  77. case MouseState.None:
  78. graphics.DrawEllipse(new Pen(this.C1, 2f), new Rectangle(2, 2, base.Width - 5, base.Height - 5));
  79. break;
  80.  
  81. case MouseState.Over:
  82. graphics.DrawEllipse(new Pen(this.C2, 2f), new Rectangle(2, 2, base.Width - 5, base.Height - 5));
  83. break;
  84.  
  85. case MouseState.Down:
  86. graphics.DrawEllipse(new Pen(this.CD, 2f), new Rectangle(2, 2, base.Width - 5, base.Height - 5));
  87. break;
  88. }
  89. graphics.FillEllipse(ConversionFunctions.ToBrush(this.C2), new Rectangle(5, 5, base.Width - 11, base.Height - 11));
  90. e.Graphics.DrawImage(image, 0, 0);
  91. graphics.Dispose();
  92. image.Dispose();
  93. }
  94.  
  95. private MouseState State
  96. {
  97. get
  98. {
  99. return this.ms;
  100. }
  101. set
  102. {
  103. this.ms = value;
  104. base.Invalidate();
  105. }
  106. }
  107.  
  108. public enum MouseState
  109. {
  110. None,
  111. Over,
  112. Down
  113. }
  114. }
  115.  
  116. public class SkyDarkTabControl : TabControl
  117. {
  118. private Color C1 = Color.FromArgb(0x3e, 60, 0x3a);
  119. private Color C2 = Color.FromArgb(80, 0x4e, 0x4c);
  120. private Color C3 = Color.FromArgb(0x33, 0x31, 0x2f);
  121.  
  122. public SkyDarkTabControl()
  123. {
  124. base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
  125. this.DoubleBuffered = true;
  126. }
  127.  
  128. protected override void CreateHandle()
  129. {
  130. base.CreateHandle();
  131. base.Alignment = TabAlignment.Top;
  132. }
  133.  
  134. protected override void OnPaint(PaintEventArgs e)
  135. {
  136. Bitmap image = new Bitmap(base.Width, base.Height);
  137. Graphics graphics = Graphics.FromImage(image);
  138. try
  139. {
  140. base.SelectedTab.BackColor = this.C1;
  141. }
  142. catch
  143. {
  144. }
  145. graphics.Clear(base.Parent.BackColor);
  146. for (int i = 0; i <= (base.TabCount - 1); i++)
  147. {
  148. if (i == base.SelectedIndex)
  149. {
  150. continue;
  151. }
  152. Rectangle rect = new Rectangle(base.GetTabRect(i).X, base.GetTabRect(i).Y + 3, base.GetTabRect(i).Width + 2, base.GetTabRect(i).Height);
  153. LinearGradientBrush brush = new LinearGradientBrush(new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height), Color.FromArgb(60, 0x3b, 0x3a), Color.FromArgb(0x45, 0x45, 70));
  154. graphics.FillRectangle(brush, rect);
  155. brush.Dispose();
  156. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C3), rect);
  157. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height));
  158. string s = string.Empty;
  159. switch (i)
  160. {
  161. case 0:
  162. s = "Main";
  163. break;
  164.  
  165. case 1:
  166. s = "Extra";
  167. break;
  168.  
  169. case 2:
  170. s = "Scan";
  171. break;
  172.  
  173. case 3:
  174. s = "Info";
  175. break;
  176. }
  177. StringFormat format = new StringFormat {
  178. LineAlignment = StringAlignment.Center,
  179. Alignment = StringAlignment.Center
  180. };
  181. graphics.DrawString(s, this.Font, ConversionFunctions.ToBrush(130, 0xb0, 190), rect, format);
  182. }
  183. graphics.FillRectangle(ConversionFunctions.ToBrush(this.C1), 0, base.ItemSize.Height, base.Width, base.Height);
  184. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), 0, base.ItemSize.Height, base.Width - 1, (base.Height - base.ItemSize.Height) - 1);
  185. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C3), 1, base.ItemSize.Height + 1, base.Width - 3, (base.Height - base.ItemSize.Height) - 3);
  186. if (base.SelectedIndex != -1)
  187. {
  188. string str2 = string.Empty;
  189. if (base.SelectedIndex == 0)
  190. {
  191. str2 = "Main";
  192. }
  193. else if (base.SelectedIndex == 1)
  194. {
  195. str2 = "Extra";
  196. }
  197. else if (base.SelectedIndex == 2)
  198. {
  199. str2 = "Scan";
  200. }
  201. else if (base.SelectedIndex == 3)
  202. {
  203. str2 = "Info";
  204. }
  205. Rectangle layoutRectangle = new Rectangle(base.GetTabRect(base.SelectedIndex).X - 2, base.GetTabRect(base.SelectedIndex).Y, base.GetTabRect(base.SelectedIndex).Width + 3, base.GetTabRect(base.SelectedIndex).Height);
  206. graphics.FillRectangle(ConversionFunctions.ToBrush(this.C1), new Rectangle(layoutRectangle.X + 2, layoutRectangle.Y + 2, layoutRectangle.Width - 2, layoutRectangle.Height));
  207. graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(layoutRectangle.X, (layoutRectangle.Y + layoutRectangle.Height) - 2), new Point(layoutRectangle.X, layoutRectangle.Y));
  208. graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(layoutRectangle.X, layoutRectangle.Y), new Point(layoutRectangle.X + layoutRectangle.Width, layoutRectangle.Y));
  209. graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(layoutRectangle.X + layoutRectangle.Width, layoutRectangle.Y), new Point(layoutRectangle.X + layoutRectangle.Width, (layoutRectangle.Y + layoutRectangle.Height) - 2));
  210. graphics.DrawLine(ConversionFunctions.ToPen(this.C3), new Point(layoutRectangle.X + 1, (layoutRectangle.Y + layoutRectangle.Height) - 1), new Point(layoutRectangle.X + 1, layoutRectangle.Y + 1));
  211. graphics.DrawLine(ConversionFunctions.ToPen(this.C3), new Point(layoutRectangle.X + 1, layoutRectangle.Y + 1), new Point((layoutRectangle.X + layoutRectangle.Width) - 1, layoutRectangle.Y + 1));
  212. graphics.DrawLine(ConversionFunctions.ToPen(this.C3), new Point((layoutRectangle.X + layoutRectangle.Width) - 1, layoutRectangle.Y + 1), new Point((layoutRectangle.X + layoutRectangle.Width) - 1, (layoutRectangle.Y + layoutRectangle.Height) - 1));
  213. StringFormat format2 = new StringFormat {
  214. LineAlignment = StringAlignment.Center,
  215. Alignment = StringAlignment.Center
  216. };
  217. graphics.DrawString(str2, this.Font, ConversionFunctions.ToBrush(130, 0xb0, 190), layoutRectangle, format2);
  218. }
  219. e.Graphics.DrawImage(image, 0, 0);
  220. graphics.Dispose();
  221. image.Dispose();
  222. }
  223. }
  224.  
  225. public class SkyDarkSeperator : Control
  226. {
  227. private Alignment al;
  228. private Color C1 = Color.FromArgb(0x33, 0x31, 0x2f);
  229. private Color C2 = Color.FromArgb(90, 0x5b, 90);
  230.  
  231. protected override void OnPaint(PaintEventArgs e)
  232. {
  233. Bitmap image = new Bitmap(base.Width, base.Height);
  234. Graphics graphics = Graphics.FromImage(image);
  235. switch (this.Align)
  236. {
  237. case Alignment.Vertical:
  238. graphics.DrawLine(ConversionFunctions.ToPen(this.C1), new Point(base.Width / 2, 0), new Point(base.Width / 2, base.Height));
  239. graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point((base.Width / 2) + 1, 0), new Point((base.Width / 2) + 1, base.Height));
  240. break;
  241.  
  242. case Alignment.Horizontal:
  243. graphics.DrawLine(ConversionFunctions.ToPen(this.C1), new Point(0, base.Height / 2), new Point(base.Width, base.Height / 2));
  244. graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(0, (base.Height / 2) + 1), new Point(base.Width, (base.Height / 2) + 1));
  245. break;
  246. }
  247. e.Graphics.DrawImage(image, 0, 0);
  248. graphics.Dispose();
  249. image.Dispose();
  250. }
  251.  
  252. public Alignment Align
  253. {
  254. get
  255. {
  256. return this.al;
  257. }
  258. set
  259. {
  260. this.al = value;
  261. base.Invalidate();
  262. }
  263. }
  264.  
  265. public enum Alignment
  266. {
  267. Vertical,
  268. Horizontal
  269. }
  270. }
  271.  
  272. public class SkyDarkRadio : Control
  273. {
  274. private Color C1 = Color.FromArgb(0x23, 0x23, 0x23);
  275. private Color C2 = Color.Transparent;
  276. private Color C3 = Color.Transparent;
  277. private Color C4 = Color.Transparent;
  278. private bool chk;
  279. private MouseState ms;
  280.  
  281. public SkyDarkRadio()
  282. {
  283. base.Size = new Size(base.Width, 13);
  284. }
  285.  
  286. protected override void OnMouseDown(MouseEventArgs e)
  287. {
  288. if (!base.Enabled)
  289. {
  290. this.State = MouseState.Down;
  291. }
  292. }
  293.  
  294. protected override void OnMouseUp(MouseEventArgs e)
  295. {
  296. if (base.Enabled)
  297. {
  298. this.State = MouseState.None;
  299. if (!this.Checked)
  300. {
  301. this.Checked = true;
  302. }
  303. }
  304. }
  305.  
  306. protected override void OnPaint(PaintEventArgs e)
  307. {
  308. Bitmap image = new Bitmap(base.Width, base.Height);
  309. Graphics graphics = Graphics.FromImage(image);
  310. graphics.Clear(base.Parent.BackColor);
  311. switch (base.Enabled)
  312. {
  313. case false:
  314. this.C2 = Color.FromArgb(70, 70, 70);
  315. this.C3 = Color.FromArgb(0x36, 0x36, 0x33);
  316. this.C4 = Color.FromArgb(0x59, 0x58, 0x58);
  317. break;
  318.  
  319. case true:
  320. switch (this.State)
  321. {
  322. case MouseState.None:
  323. this.C2 = Color.FromArgb(70, 70, 70);
  324. this.C3 = Color.FromArgb(0x36, 0x36, 0x33);
  325. this.C4 = Color.FromArgb(0x98, 0xb6, 0xc0);
  326. break;
  327.  
  328. case MouseState.Down:
  329. this.C2 = Color.FromArgb(0x36, 0x36, 0x33);
  330. this.C3 = Color.FromArgb(70, 70, 70);
  331. this.C4 = Color.FromArgb(0x70, 0x8e, 0x98);
  332. break;
  333. }
  334. break;
  335. }
  336. Rectangle rect = new Rectangle(0, 0, base.Height - 1, base.Height - 1);
  337. LinearGradientBrush brush = new LinearGradientBrush(new Point(rect.X + (rect.Width / 2), rect.Y), new Point(rect.X + (rect.Width / 2), rect.Y + rect.Height), this.C2, this.C3);
  338. graphics.SmoothingMode = SmoothingMode.HighQuality;
  339. graphics.FillEllipse(brush, rect);
  340. graphics.DrawEllipse(new Pen(ConversionFunctions.ToBrush(this.C1)), rect);
  341. if (this.Checked)
  342. {
  343. graphics.FillEllipse(ConversionFunctions.ToBrush(this.C4), new Rectangle(rect.X + (rect.Width / 4), rect.Y + (rect.Height / 4), rect.Width / 2, rect.Height / 2));
  344. }
  345. StringFormat format = new StringFormat {
  346. LineAlignment = StringAlignment.Center,
  347. Alignment = StringAlignment.Near
  348. };
  349. graphics.DrawString(base.Text, this.Font, ConversionFunctions.ToBrush(this.C4), new Rectangle((rect.X + rect.Width) + 5, 0, ((base.Width - rect.X) - rect.Width) - 5, base.Height), format);
  350. e.Graphics.DrawImage(image, 0, 0);
  351. graphics.Dispose();
  352. image.Dispose();
  353. }
  354.  
  355. public bool Checked
  356. {
  357. get
  358. {
  359. return this.chk;
  360. }
  361. set
  362. {
  363. this.chk = value;
  364. base.Invalidate();
  365. try
  366. {
  367. if (value)
  368. {
  369. foreach (object obj2 in base.Parent.Controls)
  370. {
  371. if ((obj2 is SkyDarkRadio) && (!object.ReferenceEquals(obj2, this) & ((SkyDarkRadio) obj2).Enabled))
  372. {
  373. ((SkyDarkRadio) obj2).Checked = false;
  374. }
  375. }
  376. }
  377. }
  378. catch
  379. {
  380. }
  381. }
  382. }
  383.  
  384. public MouseState State
  385. {
  386. get
  387. {
  388. return this.ms;
  389. }
  390. set
  391. {
  392. this.ms = value;
  393. base.Invalidate();
  394. }
  395. }
  396.  
  397. public enum MouseState
  398. {
  399. None,
  400. Down
  401. }
  402. }
  403. public class SkyDarkProgress : Control
  404. {
  405. private Color C1 = Color.FromArgb(0x33, 0x31, 0x2f);
  406. private Color C2 = Color.FromArgb(0x51, 0x4d, 0x4d);
  407. private Color C3 = Color.FromArgb(0x40, 60, 0x3b);
  408. private Color C4 = Color.FromArgb(70, 0x47, 70);
  409. private Color C5 = Color.FromArgb(0x3e, 0x3b, 0x3a);
  410. private int max = 100;
  411. private int val;
  412.  
  413. protected override void OnPaint(PaintEventArgs e)
  414. {
  415. Bitmap image = new Bitmap(base.Width, base.Height);
  416. Graphics graphics = Graphics.FromImage(image);
  417. Rectangle rect = new Rectangle(3, 3, Convert.ToInt32((int) ((base.Width - 7) * this.val / this.max)), base.Height - 7);
  418. graphics.Clear(this.C5);
  419. LinearGradientBrush brush = new LinearGradientBrush(new Point(0, 0), new Point(0, base.Height), this.C3, this.C4);
  420. graphics.FillRectangle(brush, rect);
  421. brush.Dispose();
  422. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), rect);
  423. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C1), 0, 0, base.Width - 1, base.Height - 1);
  424. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), 1, 1, base.Width - 3, base.Height - 3);
  425. e.Graphics.DrawImage(image, 0, 0);
  426. graphics.Dispose();
  427. image.Dispose();
  428. }
  429.  
  430. public int Maximum
  431. {
  432. get
  433. {
  434. return this.max;
  435. }
  436. set
  437. {
  438. if (value < 1)
  439. {
  440. this.max = 1;
  441. }
  442. else
  443. {
  444. this.max = value;
  445. }
  446. if (value < this.val)
  447. {
  448. this.val = this.max;
  449. }
  450. base.Invalidate();
  451. }
  452. }
  453.  
  454. public int Value
  455. {
  456. get
  457. {
  458. return this.val;
  459. }
  460. set
  461. {
  462. if (value > this.max)
  463. {
  464. this.val = this.max;
  465. }
  466. else if (value < 0)
  467. {
  468. this.val = 0;
  469. }
  470. else
  471. {
  472. this.val = value;
  473. }
  474. base.Invalidate();
  475. }
  476. }
  477. }
  478.  
  479. public class SkyDarkForm2 : ContainerControl
  480. {
  481. private Color C1 = Color.FromArgb(0x3e, 60, 0x3a);
  482. private Color C2 = Color.FromArgb(0x51, 0x4f, 0x4d);
  483. private Color C3 = Color.FromArgb(0x47, 70, 0x45);
  484. private Color C4 = Color.FromArgb(0x3a, 0x38, 0x36);
  485. private bool Locked;
  486. private Point Locked1;
  487. private Rectangle T1;
  488. private SkyDarkTop withEventsField_Maxim;
  489.  
  490. public SkyDarkForm2()
  491. {
  492. this.Dock = DockStyle.Fill;
  493. base.SendToBack();
  494. this.BackColor = Color.FromArgb(0x3e, 60, 0x3a);
  495. }
  496.  
  497. private void Maxim_Click(object sender, EventArgs e)
  498. {
  499. base.ParentForm.WindowState = FormWindowState.Minimized;
  500. }
  501.  
  502. protected override void OnHandleCreated(EventArgs e)
  503. {
  504. base.ParentForm.FormBorderStyle = FormBorderStyle.None;
  505. SkyDarkTop top = new SkyDarkTop {
  506. Location = new Point(base.Width - 0x16, 3),
  507. Size = new Size(0, 0),
  508. Parent = this
  509. };
  510. this.Maxim = top;
  511. base.Controls.Add(this.Maxim);
  512. this.Maxim.Show();
  513. }
  514.  
  515. protected override void OnPaint(PaintEventArgs e)
  516. {
  517. this.T1 = new Rectangle(1, 1, base.Width - 3, 0x12);
  518. Bitmap image = new Bitmap(base.Width, base.Height);
  519. Graphics graphics = Graphics.FromImage(image);
  520. graphics.Clear(this.C1);
  521. LinearGradientBrush brush = new LinearGradientBrush(new Point(this.T1.X, this.T1.Y), new Point(this.T1.X, this.T1.Y + this.T1.Height), this.C3, this.C4);
  522. graphics.FillRectangle(brush, this.T1);
  523. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), this.T1);
  524. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), new Rectangle(this.T1.X, (this.T1.Y + this.T1.Height) + 2, this.T1.Width, ((base.Height - this.T1.Y) - this.T1.Height) - 4));
  525. brush.Dispose();
  526. StringFormat format = new StringFormat {
  527. LineAlignment = StringAlignment.Center
  528. };
  529. graphics.DrawString(base.Text, this.Font, ConversionFunctions.ToBrush(0x71, 170, 0xba), new Rectangle(new Point(this.T1.X + 4, this.T1.Y), new Size(this.T1.Width - 40, this.T1.Height)), format);
  530. e.Graphics.DrawImage(image, 0, 0);
  531. graphics.Dispose();
  532. image.Dispose();
  533. }
  534.  
  535. protected override void OnResize(EventArgs e)
  536. {
  537. base.OnResize(e);
  538. this.T1 = new Rectangle(1, 1, base.Width - 3, 0x12);
  539. }
  540.  
  541. public SkyDarkTop Maxim
  542. {
  543. get
  544. {
  545. return this.withEventsField_Maxim;
  546. }
  547. set
  548. {
  549. if (this.withEventsField_Maxim != null)
  550. {
  551. this.withEventsField_Maxim.Click -= new EventHandler(this.Maxim_Click);
  552. }
  553. this.withEventsField_Maxim = value;
  554. if (this.withEventsField_Maxim != null)
  555. {
  556. this.withEventsField_Maxim.Click += new EventHandler(this.Maxim_Click);
  557. }
  558. }
  559. }
  560. }
  561.  
  562. public class SkyDarkForm : ContainerControl
  563. {
  564. private Color C1 = Color.FromArgb(0x3e, 60, 0x3a);
  565. private Color C2 = Color.FromArgb(0x51, 0x4f, 0x4d);
  566. private Color C3 = Color.FromArgb(0x47, 70, 0x45);
  567. private Color C4 = Color.FromArgb(0x3a, 0x38, 0x36);
  568. private bool Locked;
  569. private Point Locked1;
  570. private Rectangle T1;
  571. private SkyDarkTop withEventsField_Exim;
  572. private SkyDarkTop withEventsField_Maxim;
  573.  
  574. public SkyDarkForm()
  575. {
  576. this.Dock = DockStyle.Fill;
  577. base.SendToBack();
  578. this.BackColor = Color.FromArgb(0x3e, 60, 0x3a);
  579. }
  580.  
  581. private void Exim_Click(object sender, EventArgs e)
  582. {
  583. Application.Exit();
  584. }
  585.  
  586. private void Maxim_Click(object sender, EventArgs e)
  587. {
  588. base.ParentForm.WindowState = FormWindowState.Minimized;
  589. }
  590.  
  591. protected override void OnHandleCreated(EventArgs e)
  592. {
  593. base.ParentForm.FormBorderStyle = FormBorderStyle.None;
  594. SkyDarkTop top = new SkyDarkTop {
  595. Location = new Point(base.Width - 0x29, 3),
  596. Size = new Size(14, 14),
  597. Parent = this
  598. };
  599. this.Maxim = top;
  600. SkyDarkTop top2 = new SkyDarkTop {
  601. Location = new Point(base.Width - 0x16, 3),
  602. Size = new Size(14, 14),
  603. Parent = this
  604. };
  605. this.Exim = top2;
  606. base.Controls.Add(this.Maxim);
  607. base.Controls.Add(this.Exim);
  608. this.Maxim.Show();
  609. this.Exim.Show();
  610. }
  611.  
  612. protected override void OnPaint(PaintEventArgs e)
  613. {
  614. this.T1 = new Rectangle(1, 1, base.Width - 3, 0x12);
  615. Bitmap image = new Bitmap(base.Width, base.Height);
  616. Graphics graphics = Graphics.FromImage(image);
  617. graphics.Clear(this.C1);
  618. LinearGradientBrush brush = new LinearGradientBrush(new Point(this.T1.X, this.T1.Y), new Point(this.T1.X, this.T1.Y + this.T1.Height), this.C3, this.C4);
  619. graphics.FillRectangle(brush, this.T1);
  620. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), this.T1);
  621. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), new Rectangle(this.T1.X, (this.T1.Y + this.T1.Height) + 2, this.T1.Width, ((base.Height - this.T1.Y) - this.T1.Height) - 4));
  622. brush.Dispose();
  623. StringFormat format = new StringFormat {
  624. LineAlignment = StringAlignment.Center
  625. };
  626. graphics.DrawString(base.Text, this.Font, ConversionFunctions.ToBrush(0x71, 170, 0xba), new Rectangle(new Point(this.T1.X + 4, this.T1.Y), new Size(this.T1.Width - 40, this.T1.Height)), format);
  627. e.Graphics.DrawImage(image, 0, 0);
  628. graphics.Dispose();
  629. image.Dispose();
  630. }
  631.  
  632. protected override void OnResize(EventArgs e)
  633. {
  634. base.OnResize(e);
  635. this.T1 = new Rectangle(1, 1, base.Width - 3, 0x12);
  636. }
  637.  
  638. public SkyDarkTop Exim
  639. {
  640. get
  641. {
  642. return this.withEventsField_Exim;
  643. }
  644. set
  645. {
  646. if (this.withEventsField_Exim != null)
  647. {
  648. this.withEventsField_Exim.Click -= new EventHandler(this.Exim_Click);
  649. }
  650. this.withEventsField_Exim = value;
  651. if (this.withEventsField_Exim != null)
  652. {
  653. this.withEventsField_Exim.Click += new EventHandler(this.Exim_Click);
  654. }
  655. }
  656. }
  657.  
  658. public SkyDarkTop Maxim
  659. {
  660. get
  661. {
  662. return this.withEventsField_Maxim;
  663. }
  664. set
  665. {
  666. if (this.withEventsField_Maxim != null)
  667. {
  668. this.withEventsField_Maxim.Click -= new EventHandler(this.Maxim_Click);
  669. }
  670. this.withEventsField_Maxim = value;
  671. if (this.withEventsField_Maxim != null)
  672. {
  673. this.withEventsField_Maxim.Click += new EventHandler(this.Maxim_Click);
  674. }
  675. }
  676. }
  677. }
  678. public class SkyDarkCheck : Control
  679. {
  680. private Color C1 = Color.FromArgb(0x33, 0x31, 0x2f);
  681. private Color C2 = Color.FromArgb(80, 0x4d, 0x4d);
  682. private Color C3 = Color.FromArgb(70, 0x45, 0x44);
  683. private Color C4 = Color.FromArgb(0x40, 60, 0x3b);
  684. private Color C5 = Color.Transparent;
  685. private bool chk;
  686. private MouseState ms;
  687.  
  688. protected override void OnMouseDown(MouseEventArgs e)
  689. {
  690. if (base.Enabled)
  691. {
  692. this.State = MouseState.Down;
  693. }
  694. }
  695.  
  696. protected override void OnMouseUp(MouseEventArgs e)
  697. {
  698. if (base.Enabled)
  699. {
  700. this.State = MouseState.None;
  701. this.Checked = !this.Checked;
  702. }
  703. }
  704.  
  705. protected override void OnPaint(PaintEventArgs e)
  706. {
  707. Bitmap image = new Bitmap(base.Width - 5, base.Height - 5);
  708. Graphics graphics = Graphics.FromImage(image);
  709. graphics.Clear(base.Parent.BackColor);
  710. this.C3 = Color.FromArgb(70, 0x45, 0x44);
  711. this.C4 = Color.FromArgb(0x40, 60, 0x3b);
  712. switch (base.Enabled)
  713. {
  714. case false:
  715. this.C5 = Color.FromArgb(0x58, 0x58, 0x58);
  716. break;
  717.  
  718. case true:
  719. switch (this.State)
  720. {
  721. case MouseState.None:
  722. this.C5 = Color.FromArgb(0x97, 0xb5, 190);
  723. break;
  724.  
  725. case MouseState.Down:
  726. this.C5 = Color.FromArgb(0x79, 0x97, 160);
  727. this.C3 = Color.FromArgb(0x40, 60, 0x3b);
  728. this.C4 = Color.FromArgb(70, 0x45, 0x44);
  729. break;
  730. }
  731. break;
  732. }
  733. Rectangle rect = new Rectangle(0, 0, base.Height - 6, base.Height - 6);
  734. LinearGradientBrush brush = new LinearGradientBrush(new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height), this.C3, this.C4);
  735. graphics.FillRectangle(brush, rect);
  736. brush.Dispose();
  737. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C1), rect);
  738. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2));
  739. Rectangle rectangle2 = new Rectangle(rect.X + (rect.Width / 4), rect.Y + (rect.Height / 4), rect.Width / 2, rect.Height / 2);
  740. Point[] pointArray = new Point[] { new Point(rectangle2.X, rectangle2.Y + (rectangle2.Height / 2)), new Point(rectangle2.X + (rectangle2.Width / 2), rectangle2.Y + rectangle2.Height), new Point(rectangle2.X + rectangle2.Width, rectangle2.Y) };
  741. if (this.Checked)
  742. {
  743. graphics.SmoothingMode = SmoothingMode.HighQuality;
  744. Pen pen = new Pen(ConversionFunctions.ToBrush(this.C5), 2f);
  745. for (int i = 0; i <= (pointArray.Length - 2); i++)
  746. {
  747. graphics.DrawLine(pen, pointArray[i], pointArray[i + 1]);
  748. }
  749. }
  750. StringFormat format = new StringFormat {
  751. LineAlignment = StringAlignment.Center,
  752. Alignment = StringAlignment.Near
  753. };
  754. graphics.DrawString(base.Text, this.Font, ConversionFunctions.ToBrush(this.C5), new Rectangle((rect.X + rect.Width) + 5, 0, ((base.Width - rect.X) - rect.Width) - 5, base.Height), format);
  755. e.Graphics.DrawImage(image, 0, 0);
  756. graphics.Dispose();
  757. image.Dispose();
  758. }
  759.  
  760. public bool Checked
  761. {
  762. get
  763. {
  764. return this.chk;
  765. }
  766. set
  767. {
  768. this.chk = value;
  769. base.Invalidate();
  770. }
  771. }
  772.  
  773. public MouseState State
  774. {
  775. get
  776. {
  777. return this.ms;
  778. }
  779. set
  780. {
  781. this.ms = value;
  782. base.Invalidate();
  783. }
  784. }
  785.  
  786. public enum MouseState
  787. {
  788. None,
  789. Down
  790. }
  791. }
  792. public class SkyDarkButton : Control
  793. {
  794. private Color C1 = Color.FromArgb(0x33, 0x31, 0x2f);
  795. private Color C2 = Color.FromArgb(90, 0x5b, 90);
  796. private Color C3 = Color.FromArgb(70, 0x47, 70);
  797. private Color C4 = Color.FromArgb(0x3e, 0x3d, 0x3a);
  798. private MouseState ms;
  799.  
  800. public SkyDarkButton()
  801. {
  802. this.DoubleBuffered = true;
  803. }
  804.  
  805. protected override void OnMouseDown(MouseEventArgs e)
  806. {
  807. base.OnMouseDown(e);
  808. this.State = MouseState.Down;
  809. }
  810.  
  811. protected override void OnMouseEnter(EventArgs e)
  812. {
  813. base.OnMouseEnter(e);
  814. this.State = MouseState.Over;
  815. }
  816.  
  817. protected override void OnMouseLeave(EventArgs e)
  818. {
  819. base.OnMouseLeave(e);
  820. this.State = MouseState.None;
  821. }
  822.  
  823. protected override void OnMouseUp(MouseEventArgs e)
  824. {
  825. base.OnMouseUp(e);
  826. this.State = MouseState.Over;
  827. }
  828.  
  829. protected override void OnPaint(PaintEventArgs e)
  830. {
  831. Bitmap image = new Bitmap(base.Width, base.Height);
  832. Graphics graphics = Graphics.FromImage(image);
  833. LinearGradientBrush brush = new LinearGradientBrush(new Point(0, 0), new Point(0, base.Height), this.C3, this.C4);
  834. graphics.FillRectangle(brush, 0, 0, base.Width, base.Height);
  835. brush.Dispose();
  836. if (base.Enabled)
  837. {
  838. switch (this.State)
  839. {
  840. case MouseState.Over:
  841. graphics.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), new Rectangle(0, 0, base.Width, base.Height));
  842. break;
  843.  
  844. case MouseState.Down:
  845. graphics.FillRectangle(new SolidBrush(Color.FromArgb(10, Color.Black)), new Rectangle(0, 0, base.Width, base.Height));
  846. break;
  847. }
  848. }
  849. StringFormat format = new StringFormat {
  850. LineAlignment = StringAlignment.Center,
  851. Alignment = StringAlignment.Center
  852. };
  853. switch (base.Enabled)
  854. {
  855. case false:
  856. graphics.DrawString(this.Text, this.Font, Brushes.Gray, new Rectangle(0, 0, base.Width - 1, base.Height - 1), format);
  857. break;
  858.  
  859. case true:
  860. graphics.DrawString(this.Text, this.Font, ConversionFunctions.ToBrush(0x71, 170, 0xba), new Rectangle(0, 0, base.Width - 1, base.Height - 1), format);
  861. break;
  862. }
  863. format.Dispose();
  864. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C1), 0, 0, base.Width - 1, base.Height - 1);
  865. graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), 1, 1, base.Width - 3, base.Height - 3);
  866. e.Graphics.DrawImage(image, 0, 0);
  867. graphics.Dispose();
  868. image.Dispose();
  869. }
  870.  
  871. private MouseState State
  872. {
  873. get
  874. {
  875. return this.ms;
  876. }
  877. set
  878. {
  879. this.ms = value;
  880. base.Invalidate();
  881. }
  882. }
  883.  
  884. public override string Text
  885. {
  886. get
  887. {
  888. return base.Text;
  889. }
  890. set
  891. {
  892. base.Text = value;
  893. base.Invalidate();
  894. }
  895. }
  896.  
  897. public enum MouseState
  898. {
  899. None,
  900. Over,
  901. Down
  902. }
  903. }
  904. internal static class ConversionFunctions
  905. {
  906. public static Brush ToBrush(Color Color)
  907. {
  908. return new SolidBrush(Color);
  909. }
  910.  
  911. public static Brush ToBrush(Pen Pen)
  912. {
  913. return new SolidBrush(Pen.Color);
  914. }
  915.  
  916. public static Brush ToBrush(int A, Color C)
  917. {
  918. return new SolidBrush(Color.FromArgb(A, C));
  919. }
  920.  
  921. public static Brush ToBrush(int R, int G, int B)
  922. {
  923. return new SolidBrush(Color.FromArgb(R, G, B));
  924. }
  925.  
  926. public static Brush ToBrush(int A, int R, int G, int B)
  927. {
  928. return new SolidBrush(Color.FromArgb(A, R, G, B));
  929. }
  930.  
  931. public static Pen ToPen(Color Color)
  932. {
  933. return new Pen(new SolidBrush(Color));
  934. }
  935.  
  936. public static Pen ToPen(SolidBrush Brush)
  937. {
  938. return new Pen(Brush);
  939. }
  940.  
  941. public static Pen ToPen(int A, Color C)
  942. {
  943. return new Pen(new SolidBrush(Color.FromArgb(A, C)));
  944. }
  945.  
  946. public static Pen ToPen(int R, int G, int B)
  947. {
  948. return new Pen(new SolidBrush(Color.FromArgb(R, G, B)));
  949. }
  950.  
  951. public static Pen ToPen(int A, int R, int G, int B)
  952. {
  953. return new Pen(new SolidBrush(Color.FromArgb(A, R, G, B)));
  954. }
  955. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement