Advertisement
LaPanthere

Sidewinder Theme

Aug 15th, 2015
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 23.23 KB | None | 0 0
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4.  
  5. //Sidewinder Theme.
  6. //Made by AeroRev9.
  7. //Converted by LaPanthere
  8. public static class Helpers
  9. {
  10.  
  11.     public enum MouseState : byte
  12.     {
  13.         None = 0,
  14.         Over = 1,
  15.         Down = 2
  16.     }
  17.  
  18.     public static Rectangle FullRectangle(Size S, bool Subtract)
  19.     {
  20.         if (Subtract)
  21.         {
  22.             return new Rectangle(0, 0, S.Width - 1, S.Height - 1);
  23.         }
  24.         else
  25.         {
  26.             return new Rectangle(0, 0, S.Width, S.Height);
  27.         }
  28.     }
  29.  
  30.     public static Color GreyColor(uint G)
  31.     {
  32.         return Color.FromArgb((int)G, (int)G, (int)G);
  33.     }
  34.  
  35.     public static void CenterString(Graphics G, string T, Font F, Color C, Rectangle R)
  36.     {
  37.         SizeF TS = G.MeasureString(T, F);
  38.  
  39.         using (SolidBrush B = new SolidBrush(C))
  40.         {
  41.             G.DrawString(T, F, B, new Point(R.Width / 2 - (((int)TS.Width) / 2), ((int)R.Height) / 2 - (((int)TS.Height) / 2)));
  42.         }
  43.     }
  44.  
  45.  
  46.     public static void FillRoundRect(Graphics G, Rectangle R, int Curve, Color C)
  47.     {
  48.         using (SolidBrush B = new SolidBrush(C))
  49.         {
  50.             G.FillPie(B, R.X, R.Y, Curve, Curve, 180, 90);
  51.             G.FillPie(B, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
  52.             G.FillPie(B, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
  53.             G.FillPie(B, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
  54.             G.FillRectangle(B, Convert.ToInt32(R.X + Curve / 2), R.Y, R.Width - Curve, Convert.ToInt32(Curve / 2));
  55.             G.FillRectangle(B, R.X, Convert.ToInt32(R.Y + Curve / 2), R.Width, R.Height - Curve);
  56.             G.FillRectangle(B, Convert.ToInt32(R.X + Curve / 2), Convert.ToInt32(R.Y + R.Height - Curve / 2), R.Width - Curve, Convert.ToInt32(Curve / 2));
  57.         }
  58.  
  59.     }
  60.  
  61.  
  62.     public static void DrawRoundRect(Graphics G, Rectangle R, int Curve, Color C)
  63.     {
  64.         using (Pen P = new Pen(C))
  65.         {
  66.             G.DrawArc(P, R.X, R.Y, Curve, Curve, 180, 90);
  67.             G.DrawLine(P, Convert.ToInt32(R.X + Curve / 2), R.Y, Convert.ToInt32(R.X + R.Width - Curve / 2), R.Y);
  68.             G.DrawArc(P, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
  69.             G.DrawLine(P, R.X, Convert.ToInt32(R.Y + Curve / 2), R.X, Convert.ToInt32(R.Y + R.Height - Curve / 2));
  70.             G.DrawLine(P, Convert.ToInt32(R.X + R.Width), Convert.ToInt32(R.Y + Curve / 2), Convert.ToInt32(R.X + R.Width), Convert.ToInt32(R.Y + R.Height - Curve / 2));
  71.             G.DrawLine(P, Convert.ToInt32(R.X + Curve / 2), Convert.ToInt32(R.Y + R.Height), Convert.ToInt32(R.X + R.Width - Curve / 2), Convert.ToInt32(R.Y + R.Height));
  72.             G.DrawArc(P, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
  73.             G.DrawArc(P, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
  74.         }
  75.  
  76.     }
  77.  
  78.     public enum Direction : byte
  79.     {
  80.         Up = 0,
  81.         Down = 1,
  82.         Left = 2,
  83.         Right = 3
  84.     }
  85.  
  86.     public static void DrawTriangle(Graphics G, Rectangle Rect, Direction D, Color C)
  87.     {
  88.         int halfWidth = Rect.Width / 2;
  89.         int halfHeight = Rect.Height / 2;
  90.         Point p0 = Point.Empty;
  91.         Point p1 = Point.Empty;
  92.         Point p2 = Point.Empty;
  93.  
  94.         switch (D)
  95.         {
  96.             case Direction.Up:
  97.                 p0 = new Point(Rect.Left + halfWidth, Rect.Top);
  98.                 p1 = new Point(Rect.Left, Rect.Bottom);
  99.                 p2 = new Point(Rect.Right, Rect.Bottom);
  100.  
  101.                 break;
  102.             case Direction.Down:
  103.                 p0 = new Point(Rect.Left + halfWidth, Rect.Bottom);
  104.                 p1 = new Point(Rect.Left, Rect.Top);
  105.                 p2 = new Point(Rect.Right, Rect.Top);
  106.  
  107.                 break;
  108.             case Direction.Left:
  109.                 p0 = new Point(Rect.Left, Rect.Top + halfHeight);
  110.                 p1 = new Point(Rect.Right, Rect.Top);
  111.                 p2 = new Point(Rect.Right, Rect.Bottom);
  112.  
  113.                 break;
  114.             case Direction.Right:
  115.                 p0 = new Point(Rect.Right, Rect.Top + halfHeight);
  116.                 p1 = new Point(Rect.Left, Rect.Bottom);
  117.                 p2 = new Point(Rect.Left, Rect.Top);
  118.  
  119.                 break;
  120.         }
  121.  
  122.         using (SolidBrush B = new SolidBrush(C))
  123.         {
  124.             G.FillPolygon(B, new Point[] {
  125.                 p0,
  126.                 p1,
  127.                 p2
  128.             });
  129.         }
  130.  
  131.     }
  132.  
  133. }
  134.  
  135. public class SideWinderTab : TabControl
  136. {
  137.  
  138.     #region " Helpers "
  139.  
  140.  
  141.  
  142.     #endregion
  143.  
  144.     #region " Drawing "
  145.     private Graphics G;
  146.     private Rectangle Rect;
  147.     private int LastIndex;
  148.  
  149.     private Color BackgroundC = Color.FromArgb(102, 105, 112);
  150.     private int _Index = -1;
  151.     private int Index
  152.     {
  153.         get { return _Index; }
  154.         set
  155.         {
  156.             _Index = value;
  157.             Invalidate();
  158.         }
  159.     }
  160.  
  161.     public SideWinderTab()
  162.     {
  163.         DoubleBuffered = true;
  164.         ItemSize = new Size(40, 170);
  165.         Alignment = TabAlignment.Left;
  166.         SizeMode = TabSizeMode.Fixed;
  167.         Dock = DockStyle.Fill;
  168.     }
  169.  
  170.     protected override void OnControlAdded(ControlEventArgs e)
  171.     {
  172.         base.OnControlAdded(e);
  173.         e.Control.BackColor = Color.White;
  174.         e.Control.ForeColor = Color.FromArgb(72, 75, 82);
  175.         e.Control.Font = new Font("Segoe UI", 10);
  176.     }
  177.  
  178.     protected override void OnCreateControl()
  179.     {
  180.         base.OnCreateControl();
  181.         SetStyle(ControlStyles.UserPaint, true);
  182.     }
  183.  
  184.     protected override void OnPaint(PaintEventArgs e)
  185.     {
  186.         G = e.Graphics;
  187.         G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  188.         G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  189.  
  190.         base.OnPaint(e);
  191.  
  192.         G.Clear(Color.FromArgb(72, 75, 82));
  193.  
  194.  
  195.         for (int i = 0; i <= TabPages.Count - 1; i++)
  196.         {
  197.             Rect = GetTabRect(i);
  198.  
  199.  
  200.             if (string.IsNullOrEmpty((string)TabPages[i].Tag))
  201.             {
  202.  
  203.                 if (SelectedIndex == i)
  204.                 {
  205.                     //Fill selected
  206.                     using (SolidBrush B = new SolidBrush(Color.FromArgb(90, 93, 100)))
  207.                     {
  208.                         G.FillRectangle(B, new Rectangle(Rect.X, Rect.Y + 2, Rect.Width, Rect.Height));
  209.                     }
  210.  
  211.                     //Triangles
  212.                     Helpers.DrawTriangle(G, new Rectangle(Rect.X + 158, (int)(Rect.Y + 8.5), 16, 25), Helpers.Direction.Left, Color.FromArgb(62, 65, 72));
  213.                     Helpers.DrawTriangle(G, new Rectangle(Rect.X + 160, (int)(Rect.Y + 8.5), 16, 25), Helpers.Direction.Left, TabPages[i].BackColor);
  214.  
  215.  
  216.                 }
  217.                 else
  218.                 {
  219.                     //Fill not selected
  220.                     using (SolidBrush B = new SolidBrush(Color.FromArgb(72, 75, 82)))
  221.                     {
  222.                         G.FillRectangle(B, Rect);
  223.                     }
  224.  
  225.                 }
  226.  
  227.                 //OverFill not selected
  228.  
  229.                 if (!(Index == -1) & !(SelectedIndex == Index))
  230.                 {
  231.                     using (SolidBrush B = new SolidBrush(Color.FromArgb(82, 85, 92)))
  232.                     {
  233.                         G.FillRectangle(B, GetTabRect(Index));
  234.                     }
  235.  
  236.                     //OverText
  237.                     using (SolidBrush B = new SolidBrush(Color.FromArgb(218, 220, 217)))
  238.                     {
  239.                         G.DrawString(TabPages[Index].Text, new Font("Segoe UI", 10), B, new Point(GetTabRect(Index).X + 55, GetTabRect(Index).Y + 12));
  240.                     }
  241.  
  242.                     //Images
  243.                     if ((ImageList != null))
  244.                     {
  245.                         if (!(TabPages[Index].ImageIndex < 0))
  246.                         {
  247.                             G.DrawImage(ImageList.Images[TabPages[Index].ImageIndex], new Rectangle(GetTabRect(Index).X + 25, GetTabRect(Index).Y + ((GetTabRect(Index).Height / 2) - 9), 18, 18));
  248.                         }
  249.                     }
  250.  
  251.                 }
  252.  
  253.  
  254.                 if (!(i == Index))
  255.                 {
  256.                     //Texts
  257.                     using (SolidBrush B = new SolidBrush(Color.FromArgb(218, 220, 217)))
  258.                     {
  259.                         G.DrawString(TabPages[i].Text, new Font("Segoe UI", 10), B, new Point(Rect.X + 55, Rect.Y + 12));
  260.                     }
  261.  
  262.                     //Images
  263.                     if ((ImageList != null))
  264.                     {
  265.                         if (!(TabPages[i].ImageIndex < 0))
  266.                         {
  267.                             G.DrawImage(ImageList.Images[TabPages[i].ImageIndex], new Rectangle(Rect.X + 25, Rect.Y + ((Rect.Height / 2) - 9), 18, 18));
  268.                         }
  269.                     }
  270.  
  271.                 }
  272.             }
  273.             else
  274.             {
  275.                 //Headers
  276.                 using (SolidBrush B = new SolidBrush(Color.FromArgb(158, 160, 157)))
  277.                 {
  278.                     G.DrawString(TabPages[i].Text.ToUpper(), new Font("Segoe UI semibold", 9), B, new Point(Rect.X + 25, Rect.Y + 18));
  279.                 }
  280.  
  281.             }
  282.  
  283.         }
  284.  
  285.     }
  286.  
  287.     protected override void OnSelecting(TabControlCancelEventArgs e)
  288.     {
  289.         base.OnSelecting(e);
  290.  
  291.         if ((e.TabPage != null))
  292.         {
  293.             if (!string.IsNullOrEmpty((string)e.TabPage.Tag))
  294.             {
  295.                 e.Cancel = true;
  296.             }
  297.             else
  298.             {
  299.                 Index = -1;
  300.             }
  301.         }
  302.  
  303.     }
  304.  
  305.     protected override void OnMouseMove(MouseEventArgs e)
  306.     {
  307.         base.OnMouseMove(e);
  308.  
  309.         for (int i = 0; i <= TabPages.Count - 1; i++)
  310.         {
  311.             if (GetTabRect(i).Contains(e.Location) & !(SelectedIndex == i) & string.IsNullOrEmpty((string)TabPages[i].Tag))
  312.             {
  313.                 Index = i;
  314.                 break; // TODO: might not be correct. Was : Exit For
  315.             }
  316.         }
  317.     }
  318.  
  319.     protected override void OnMouseLeave(EventArgs e)
  320.     {
  321.         base.OnMouseLeave(e);
  322.         Index = -1;
  323.     }
  324.  
  325.     #endregion
  326.  
  327. }
  328.  
  329. public class SideWinderProgress : Control
  330. {
  331.  
  332.     #region " Drawing "
  333.  
  334.     private int _Val = 0;
  335.     private int _Min = 0;
  336.  
  337.     private int _Max = 100;
  338.     public int Value
  339.     {
  340.         get { return _Val; }
  341.         set
  342.         {
  343.             _Val = value;
  344.             Invalidate();
  345.         }
  346.     }
  347.  
  348.     public int Minimum
  349.     {
  350.         get { return _Min; }
  351.         set
  352.         {
  353.             _Min = value;
  354.             Invalidate();
  355.         }
  356.     }
  357.  
  358.     public int Maximum
  359.     {
  360.         get { return _Max; }
  361.         set
  362.         {
  363.             _Max = value;
  364.             Invalidate();
  365.         }
  366.     }
  367.  
  368.     public SideWinderProgress()
  369.     {
  370.         DoubleBuffered = true;
  371.     }
  372.  
  373.  
  374.     protected override void OnPaint(PaintEventArgs e)
  375.     {
  376.         Graphics G = e.Graphics;
  377.         //G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  378.         G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  379.  
  380.         base.OnPaint(e);
  381.  
  382.         G.Clear(Color.White);
  383.  
  384.         if (!(Value == 0))
  385.         {
  386.             Helpers.FillRoundRect(G, new Rectangle(0, 0, Value / (Maximum * Width) - 1, Height - 1), 8, Color.FromArgb(213, 228, 150));
  387.         }
  388.  
  389.         Helpers.DrawRoundRect(G, Helpers.FullRectangle(Size, true), 8, Color.FromArgb(232, 235, 242));
  390.  
  391.     }
  392.  
  393.     #endregion
  394.  
  395. }
  396.  
  397. public class SideWinderAlert : Control
  398. {
  399.  
  400.     #region " Drawing "
  401.  
  402.     private Graphics G;
  403.  
  404.     private Style _Alert;
  405.     public bool Centered { get; set; }
  406.     public bool Field { get; set; }
  407.  
  408.     public enum Style : byte
  409.     {
  410.         Notice = 0,
  411.         Informations = 1,
  412.         Warning = 2,
  413.         Success = 3
  414.     }
  415.  
  416.     public Style Alert
  417.     {
  418.         get { return _Alert; }
  419.         set
  420.         {
  421.             _Alert = value;
  422.             Invalidate();
  423.         }
  424.     }
  425.  
  426.     public SideWinderAlert()
  427.     {
  428.         DoubleBuffered = true;
  429.     }
  430.  
  431.     protected override void OnPaint(PaintEventArgs e)
  432.     {
  433.         G = e.Graphics;
  434.         G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  435.         G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  436.  
  437.         base.OnPaint(e);
  438.  
  439.         G.Clear(Parent.BackColor);
  440.  
  441.         switch (Alert)
  442.         {
  443.  
  444.             case Style.Notice:
  445.  
  446.                 if (Field)
  447.                 {
  448.                     Helpers.FillRoundRect(G, new Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(217, 237, 247));
  449.                     Helpers.DrawRoundRect(G, new Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(188, 232, 241));
  450.  
  451.                     Helpers.DrawTriangle(G, new Rectangle(0, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(188, 232, 241));
  452.                     Helpers.DrawTriangle(G, new Rectangle(2, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(217, 237, 247));
  453.  
  454.                     if (Centered)
  455.                     {
  456.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(58, 135, 173), new Rectangle(20, 0, Width, Height));
  457.                     }
  458.                     else
  459.                     {
  460.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(58, 135, 173)))
  461.                         {
  462.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(35, 9));
  463.                         }
  464.                     }
  465.  
  466.                 }
  467.                 else
  468.                 {
  469.                     Helpers.FillRoundRect(G, Helpers.FullRectangle(Size, true), 4, Color.FromArgb(217, 237, 247));
  470.                     Helpers.DrawRoundRect(G, new Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(188, 232, 241));
  471.  
  472.                     if (Centered)
  473.                     {
  474.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(58, 135, 173), Helpers.FullRectangle(Size, false));
  475.                     }
  476.                     else
  477.                     {
  478.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(58, 135, 173)))
  479.                         {
  480.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(12, 9));
  481.                         }
  482.                     }
  483.                 }
  484.  
  485.                 break;
  486.  
  487.             case Style.Informations:
  488.  
  489.                 if (Field)
  490.                 {
  491.                     Helpers.FillRoundRect(G, new Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(252, 248, 227));
  492.                     Helpers.DrawRoundRect(G, new Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(251, 238, 213));
  493.  
  494.                     Helpers.DrawTriangle(G, new Rectangle(0, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(251, 238, 213));
  495.                     Helpers.DrawTriangle(G, new Rectangle(2, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(252, 248, 227));
  496.  
  497.                     if (Centered)
  498.                     {
  499.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(192, 152, 83), new Rectangle(20, 0, Width, Height));
  500.                     }
  501.                     else
  502.                     {
  503.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(192, 152, 83)))
  504.                         {
  505.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(35, 9));
  506.                         }
  507.                     }
  508.  
  509.                 }
  510.                 else
  511.                 {
  512.                     Helpers.FillRoundRect(G, Helpers.FullRectangle(Size, true), 4, Color.FromArgb(252, 248, 227));
  513.                     Helpers.DrawRoundRect(G, new Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(251, 238, 213));
  514.  
  515.                     if (Centered)
  516.                     {
  517.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(192, 152, 83), Helpers.FullRectangle(Size, false));
  518.                     }
  519.                     else
  520.                     {
  521.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(192, 152, 83)))
  522.                         {
  523.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(12, 9));
  524.                         }
  525.                     }
  526.                 }
  527.  
  528.                 break;
  529.             case Style.Warning:
  530.  
  531.                 if (Field)
  532.                 {
  533.                     Helpers.FillRoundRect(G, new Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(242, 222, 222));
  534.                     Helpers.DrawRoundRect(G, new Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(238, 211, 215));
  535.  
  536.                     Helpers.DrawTriangle(G, new Rectangle(0, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(238, 211, 215));
  537.                     Helpers.DrawTriangle(G, new Rectangle(2, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(242, 222, 222));
  538.  
  539.                     if (Centered)
  540.                     {
  541.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(185, 74, 72), new Rectangle(20, 0, Width, Height));
  542.                     }
  543.                     else
  544.                     {
  545.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(185, 74, 72)))
  546.                         {
  547.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(35, 9));
  548.                         }
  549.                     }
  550.  
  551.                 }
  552.                 else
  553.                 {
  554.                     Helpers.FillRoundRect(G, Helpers.FullRectangle(Size, true), 4, Color.FromArgb(242, 222, 222));
  555.                     Helpers.DrawRoundRect(G, new Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(238, 211, 215));
  556.  
  557.                     if (Centered)
  558.                     {
  559.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(185, 74, 72), Helpers.FullRectangle(Size, false));
  560.                     }
  561.                     else
  562.                     {
  563.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(185, 74, 72)))
  564.                         {
  565.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(12, 9));
  566.                         }
  567.                     }
  568.                 }
  569.  
  570.                 break;
  571.             default:
  572.  
  573.                 if (Field)
  574.                 {
  575.                     Helpers.FillRoundRect(G, new Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(223, 240, 216));
  576.                     Helpers.DrawRoundRect(G, new Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(214, 233, 198));
  577.  
  578.                     Helpers.DrawTriangle(G, new Rectangle(0, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(214, 233, 198));
  579.                     Helpers.DrawTriangle(G, new Rectangle(2, 7, 20, 20), Helpers.Direction.Left, Color.FromArgb(223, 240, 216));
  580.  
  581.                     if (Centered)
  582.                     {
  583.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(70, 136, 71), new Rectangle(20, 0, Width, Height));
  584.                     }
  585.                     else
  586.                     {
  587.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(70, 136, 71)))
  588.                         {
  589.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(35, 9));
  590.                         }
  591.                     }
  592.  
  593.                 }
  594.                 else
  595.                 {
  596.                     Helpers.FillRoundRect(G, Helpers.FullRectangle(Size, true), 4, Color.FromArgb(223, 240, 216));
  597.                     Helpers.DrawRoundRect(G, new Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(214, 233, 198));
  598.  
  599.                     if (Centered)
  600.                     {
  601.                         Helpers.CenterString(G, Text, new Font("Segoe UI", 10), Color.FromArgb(70, 136, 71), Helpers.FullRectangle(Size, false));
  602.                     }
  603.                     else
  604.                     {
  605.                         using (SolidBrush B = new SolidBrush(Color.FromArgb(70, 136, 71)))
  606.                         {
  607.                             G.DrawString(Text, new Font("Segoe UI", 10), B, new Point(12, 9));
  608.                         }
  609.                     }
  610.                 }
  611.                 break;
  612.         }
  613.  
  614.     }
  615.  
  616.     protected override void OnResize(EventArgs e)
  617.     {
  618.         base.OnResize(e);
  619.         if (!Field)
  620.         {
  621.             Height = 37;
  622.         }
  623.     }
  624.  
  625.     #endregion
  626.  
  627. }
  628.  
  629. public class SideWinderBlock : GroupBox
  630. {
  631.  
  632.     #region " Drawing "
  633.  
  634.  
  635.     private Graphics G;
  636.     public SideWinderBlock()
  637.     {
  638.         DoubleBuffered = true;
  639.     }
  640.  
  641.     protected override void OnCreateControl()
  642.     {
  643.         base.OnCreateControl();
  644.         SetStyle(ControlStyles.UserPaint, true);
  645.     }
  646.  
  647.     protected override void OnPaint(PaintEventArgs e)
  648.     {
  649.         G = e.Graphics;
  650.         G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  651.         G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  652.  
  653.         base.OnPaint(e);
  654.  
  655.         G.Clear(Color.White);
  656.  
  657.         using (Pen P = new Pen(Color.FromArgb(220, 220, 220)) { DashStyle = System.Drawing.Drawing2D.DashStyle.Dash })
  658.         {
  659.  
  660.             G.DrawRectangle(P, Helpers.FullRectangle(Size, true));
  661.         }
  662.  
  663.     }
  664.  
  665.  
  666.     #endregion
  667.  
  668.  
  669. }
  670.  
  671. public class SideWinderSeparator : Control
  672. {
  673.  
  674.     #region " Drawing "
  675.  
  676.  
  677.     private Graphics G;
  678.     public SideWinderSeparator()
  679.     {
  680.         DoubleBuffered = true;
  681.     }
  682.  
  683.     protected override void OnPaint(PaintEventArgs e)
  684.     {
  685.         G = e.Graphics;
  686.         G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  687.         G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  688.  
  689.         base.OnPaint(e);
  690.  
  691.         using (Pen P = new Pen(Color.FromArgb(232, 235, 242)) { DashStyle = System.Drawing.Drawing2D.DashStyle.Dash })
  692.         {
  693.             G.DrawLine(P, new Point(0, 0), new Point(Width, 0));
  694.         }
  695.  
  696.     }
  697.  
  698.     #endregion
  699.  
  700. }
  701.  
  702. public class SideWinderBlockQuote : Control
  703. {
  704.  
  705.     #region " Drawing "
  706.  
  707.  
  708.     private Graphics G;
  709.     public string Title { get; set; }
  710.  
  711.     public string Description { get; set; }
  712.  
  713.     public SideWinderBlockQuote()
  714.     {
  715.         DoubleBuffered = true;
  716.     }
  717.  
  718.     protected override void OnPaint(PaintEventArgs e)
  719.     {
  720.         G = e.Graphics;
  721.         G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  722.         G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
  723.  
  724.         base.OnPaint(e);
  725.  
  726.         using (Pen P = new Pen(Color.FromArgb(102, 105, 112), 3))
  727.         {
  728.             G.DrawLine(P, new Point(3, 0), new Point(3, Height));
  729.         }
  730.  
  731.         if (!string.IsNullOrEmpty(Title))
  732.         {
  733.             using (SolidBrush B = new SolidBrush(Color.FromArgb(112, 115, 122)))
  734.             {
  735.                 G.DrawString(Title.ToUpper(), new Font("Segoe UI semibold", 11), B, new Point(13, 0));
  736.             }
  737.         }
  738.  
  739.         using (SolidBrush B = new SolidBrush(Color.FromArgb(92, 95, 112)))
  740.         {
  741.             G.DrawString(Description, new Font("Segoe UI", 10), B, new Point(13, 23));
  742.         }
  743.  
  744.     }
  745.  
  746.     #endregion
  747.  
  748. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement