Guest User

Sidewinder Theme : AeroRev9

a guest
Aug 13th, 2015
1,562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 20.90 KB | None | 0 0
  1. 'Sidewinder Theme.
  2. 'Made by AeroRev9.
  3.  
  4. Public Module Helpers
  5.  
  6.     Public Enum MouseState As Byte
  7.         None = 0
  8.         Over = 1
  9.         Down = 2
  10.     End Enum
  11.  
  12.     Public Function FullRectangle(S As Size, Subtract As Boolean) As Rectangle
  13.         If Subtract Then
  14.             Return New Rectangle(0, 0, S.Width - 1, S.Height - 1)
  15.         Else
  16.             Return New Rectangle(0, 0, S.Width, S.Height)
  17.         End If
  18.     End Function
  19.  
  20.     Public Function GreyColor(G As UInteger) As Color
  21.         Return Color.FromArgb(G, G, G)
  22.     End Function
  23.  
  24.     Public Sub CenterString(G As Graphics, T As String, F As Font, C As Color, R As Rectangle)
  25.         Dim TS As SizeF = G.MeasureString(T, F)
  26.  
  27.         Using B As New SolidBrush(C)
  28.             G.DrawString(T, F, B, New Point(R.Width / 2 - (TS.Width / 2), R.Height / 2 - (TS.Height / 2)))
  29.         End Using
  30.     End Sub
  31.  
  32.     Public Sub FillRoundRect(G As Graphics, R As Rectangle, Curve As Integer, C As Color)
  33.  
  34.         Using B As New SolidBrush(C)
  35.             G.FillPie(B, R.X, R.Y, Curve, Curve, 180, 90)
  36.             G.FillPie(B, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90)
  37.             G.FillPie(B, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90)
  38.             G.FillPie(B, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90)
  39.             G.FillRectangle(B, CInt(R.X + Curve / 2), R.Y, R.Width - Curve, CInt(Curve / 2))
  40.             G.FillRectangle(B, R.X, CInt(R.Y + Curve / 2), R.Width, R.Height - Curve)
  41.             G.FillRectangle(B, CInt(R.X + Curve / 2), CInt(R.Y + R.Height - Curve / 2), R.Width - Curve, CInt(Curve / 2))
  42.         End Using
  43.  
  44.     End Sub
  45.  
  46.     Public Sub DrawRoundRect(G As Graphics, R As Rectangle, Curve As Integer, C As Color)
  47.  
  48.         Using P As New Pen(C)
  49.             G.DrawArc(P, R.X, R.Y, Curve, Curve, 180, 90)
  50.             G.DrawLine(P, CInt(R.X + Curve / 2), R.Y, CInt(R.X + R.Width - Curve / 2), R.Y)
  51.             G.DrawArc(P, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90)
  52.             G.DrawLine(P, R.X, CInt(R.Y + Curve / 2), R.X, CInt(R.Y + R.Height - Curve / 2))
  53.             G.DrawLine(P, CInt(R.X + R.Width), CInt(R.Y + Curve / 2), CInt(R.X + R.Width), CInt(R.Y + R.Height - Curve / 2))
  54.             G.DrawLine(P, CInt(R.X + Curve / 2), CInt(R.Y + R.Height), CInt(R.X + R.Width - Curve / 2), CInt(R.Y + R.Height))
  55.             G.DrawArc(P, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90)
  56.             G.DrawArc(P, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90)
  57.         End Using
  58.  
  59.     End Sub
  60.  
  61.     Public Enum Direction As Byte
  62.         Up = 0
  63.         Down = 1
  64.         Left = 2
  65.         Right = 3
  66.     End Enum
  67.  
  68.     Public Sub DrawTriangle(G As Graphics, Rect As Rectangle, D As Direction, C As Color)
  69.         Dim halfWidth As Integer = Rect.Width / 2
  70.         Dim halfHeight As Integer = Rect.Height / 2
  71.         Dim p0 As Point = Point.Empty
  72.         Dim p1 As Point = Point.Empty
  73.         Dim p2 As Point = Point.Empty
  74.  
  75.         Select Case D
  76.             Case Direction.Up
  77.                 p0 = New Point(Rect.Left + halfWidth, Rect.Top)
  78.                 p1 = New Point(Rect.Left, Rect.Bottom)
  79.                 p2 = New Point(Rect.Right, Rect.Bottom)
  80.  
  81.             Case Direction.Down
  82.                 p0 = New Point(Rect.Left + halfWidth, Rect.Bottom)
  83.                 p1 = New Point(Rect.Left, Rect.Top)
  84.                 p2 = New Point(Rect.Right, Rect.Top)
  85.  
  86.             Case Direction.Left
  87.                 p0 = New Point(Rect.Left, Rect.Top + halfHeight)
  88.                 p1 = New Point(Rect.Right, Rect.Top)
  89.                 p2 = New Point(Rect.Right, Rect.Bottom)
  90.  
  91.             Case Direction.Right
  92.                 p0 = New Point(Rect.Right, Rect.Top + halfHeight)
  93.                 p1 = New Point(Rect.Left, Rect.Bottom)
  94.                 p2 = New Point(Rect.Left, Rect.Top)
  95.  
  96.         End Select
  97.  
  98.         Using B As New SolidBrush(C)
  99.             G.FillPolygon(B, New Point() {p0, p1, p2})
  100.         End Using
  101.  
  102.     End Sub
  103.  
  104. End Module
  105.  
  106. Public Class SideWinderTab
  107.     Inherits TabControl
  108.  
  109. #Region " Helpers "
  110.  
  111.  
  112.  
  113. #End Region
  114.  
  115. #Region " Drawing "
  116.     Private G As Graphics
  117.     Private Rect As Rectangle
  118.     Private LastIndex As Integer
  119.     Private BackgroundC As Color = Color.FromArgb(102, 105, 112)
  120.  
  121.     Private _Index As Integer = -1
  122.     Private Property Index As Integer
  123.         Get
  124.             Return _Index
  125.         End Get
  126.         Set(value As Integer)
  127.             _Index = value
  128.             Invalidate()
  129.         End Set
  130.     End Property
  131.  
  132.     Sub New()
  133.         DoubleBuffered = True
  134.         ItemSize = New Size(40, 170)
  135.         Alignment = TabAlignment.Left
  136.         SizeMode = TabSizeMode.Fixed
  137.         Dock = DockStyle.Fill
  138.     End Sub
  139.  
  140.     Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
  141.         MyBase.OnControlAdded(e)
  142.         e.Control.BackColor = Color.White
  143.         e.Control.ForeColor = Color.FromArgb(72, 75, 82)
  144.         e.Control.Font = New Font("Segoe UI", 10)
  145.     End Sub
  146.  
  147.     Protected Overrides Sub OnCreateControl()
  148.         MyBase.OnCreateControl()
  149.         SetStyle(ControlStyles.UserPaint, True)
  150.     End Sub
  151.  
  152.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  153.         G = e.Graphics
  154.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  155.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  156.  
  157.         MyBase.OnPaint(e)
  158.  
  159.         G.Clear(Color.FromArgb(72, 75, 82))
  160.  
  161.         For i As Integer = 0 To TabPages.Count - 1
  162.  
  163.             Rect = GetTabRect(i)
  164.  
  165.             If String.IsNullOrEmpty(TabPages(i).Tag) Then
  166.  
  167.                 If SelectedIndex = i Then
  168.  
  169.                     'Fill selected
  170.                     Using B As New SolidBrush(Color.FromArgb(90, 93, 100))
  171.                         G.FillRectangle(B, New Rectangle(Rect.X, Rect.Y + 2, Rect.Width, Rect.Height))
  172.                     End Using
  173.  
  174.                     'Triangles
  175.                     DrawTriangle(G, New Rectangle(Rect.X + 158, Rect.Y + 8.5F, 16, 25), Direction.Left, Color.FromArgb(62, 65, 72))
  176.                     DrawTriangle(G, New Rectangle(Rect.X + 160, Rect.Y + 8.5F, 16, 25), Direction.Left, TabPages(i).BackColor)
  177.  
  178.                 Else
  179.  
  180.                     'Fill not selected
  181.                     Using B As New SolidBrush(Color.FromArgb(72, 75, 82))
  182.                         G.FillRectangle(B, Rect)
  183.                     End Using
  184.  
  185.                 End If
  186.  
  187.                 'OverFill not selected
  188.                 If Not Index = -1 And Not SelectedIndex = Index Then
  189.  
  190.                     Using B As New SolidBrush(Color.FromArgb(82, 85, 92))
  191.                         G.FillRectangle(B, GetTabRect(Index))
  192.                     End Using
  193.  
  194.                     'OverText
  195.                     Using B As New SolidBrush(Color.FromArgb(218, 220, 217))
  196.                         G.DrawString(TabPages(Index).Text, New Font("Segoe UI", 10), B, New Point(GetTabRect(Index).X + 55, GetTabRect(Index).Y + 12))
  197.                     End Using
  198.  
  199.                     'Images
  200.                     If Not IsNothing(ImageList) Then
  201.                         If Not TabPages(Index).ImageIndex < 0 Then
  202.                             G.DrawImage(ImageList.Images(TabPages(Index).ImageIndex), New Rectangle(GetTabRect(Index).X + 25, GetTabRect(Index).Y + ((GetTabRect(Index).Height / 2) - 9), 18, 18))
  203.                         End If
  204.                     End If
  205.  
  206.                 End If
  207.  
  208.                 If Not i = Index Then
  209.  
  210.                     'Texts
  211.                     Using B As New SolidBrush(Color.FromArgb(218, 220, 217))
  212.                         G.DrawString(TabPages(i).Text, New Font("Segoe UI", 10), B, New Point(Rect.X + 55, Rect.Y + 12))
  213.                     End Using
  214.  
  215.                     'Images
  216.                     If Not IsNothing(ImageList) Then
  217.                         If Not TabPages(i).ImageIndex < 0 Then
  218.                             G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Rectangle(Rect.X + 25, Rect.Y + ((Rect.Height / 2) - 9), 18, 18))
  219.                         End If
  220.                     End If
  221.  
  222.                 End If
  223.             Else
  224.                 'Headers
  225.                 Using B As New SolidBrush(Color.FromArgb(158, 160, 157))
  226.                     G.DrawString(TabPages(i).Text.ToUpper, New Font("Segoe UI semibold", 9), B, New Point(Rect.X + 25, Rect.Y + 18))
  227.                 End Using
  228.  
  229.             End If
  230.  
  231.         Next
  232.  
  233.     End Sub
  234.  
  235.     Protected Overrides Sub OnSelecting(e As TabControlCancelEventArgs)
  236.         MyBase.OnSelecting(e)
  237.  
  238.         If Not IsNothing(e.TabPage) Then
  239.             If Not String.IsNullOrEmpty(e.TabPage.Tag) Then
  240.                 e.Cancel = True
  241.             Else
  242.                 Index = -1
  243.             End If
  244.         End If
  245.  
  246.     End Sub
  247.  
  248.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  249.         MyBase.OnMouseMove(e)
  250.  
  251.         For i As Integer = 0 To TabPages.Count - 1
  252.             If GetTabRect(i).Contains(e.Location) And Not SelectedIndex = i And String.IsNullOrEmpty(TabPages(i).Tag) Then
  253.                 Index = i
  254.                 Exit For
  255.             End If
  256.         Next
  257.     End Sub
  258.  
  259.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  260.         MyBase.OnMouseLeave(e)
  261.         Index = -1
  262.     End Sub
  263.  
  264. #End Region
  265.  
  266. End Class
  267.  
  268. Public Class SideWinderProgress
  269.     Inherits Control
  270.  
  271. #Region " Drawing "
  272.  
  273.     Private _Val As Integer = 0
  274.     Private _Min As Integer = 0
  275.     Private _Max As Integer = 100
  276.  
  277.     Public Property Value As Integer
  278.         Get
  279.             Return _Val
  280.         End Get
  281.         Set(value As Integer)
  282.             _Val = value
  283.             Invalidate()
  284.         End Set
  285.     End Property
  286.  
  287.     Public Property Minimum As Integer
  288.         Get
  289.             Return _Min
  290.         End Get
  291.         Set(value As Integer)
  292.             _Min = value
  293.             Invalidate()
  294.         End Set
  295.     End Property
  296.  
  297.     Public Property Maximum As Integer
  298.         Get
  299.             Return _Max
  300.         End Get
  301.         Set(value As Integer)
  302.             _Max = value
  303.             Invalidate()
  304.         End Set
  305.     End Property
  306.  
  307.     Sub New()
  308.         DoubleBuffered = True
  309.     End Sub
  310.  
  311.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  312.  
  313.         Dim G As Graphics = e.Graphics
  314.         'G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  315.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  316.  
  317.         MyBase.OnPaint(e)
  318.  
  319.         G.Clear(Color.White)
  320.  
  321.         If Not Value = 0 Then
  322.             FillRoundRect(G, New Rectangle(0, 0, Value / Maximum * Width - 1, Height - 1), 8, Color.FromArgb(213, 228, 150))
  323.         End If
  324.  
  325.         DrawRoundRect(G, FullRectangle(Size, True), 8, Color.FromArgb(232, 235, 242))
  326.  
  327.     End Sub
  328.  
  329. #End Region
  330.  
  331. End Class
  332.  
  333. Public Class SideWinderAlert
  334.     Inherits Control
  335.  
  336. #Region " Drawing "
  337.  
  338.     Private G As Graphics
  339.     Private _Alert As Style
  340.  
  341.     Public Property Centered As Boolean
  342.     Public Property Field As Boolean
  343.  
  344.     Enum Style As Byte
  345.         Notice = 0
  346.         Informations = 1
  347.         Warning = 2
  348.         Success = 3
  349.     End Enum
  350.  
  351.     Public Property Alert As Style
  352.         Get
  353.             Return _Alert
  354.         End Get
  355.         Set(value As Style)
  356.             _Alert = value
  357.             Invalidate()
  358.         End Set
  359.     End Property
  360.  
  361.     Sub New()
  362.         DoubleBuffered = True
  363.     End Sub
  364.  
  365.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  366.         G = e.Graphics
  367.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  368.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  369.  
  370.         MyBase.OnPaint(e)
  371.  
  372.         G.Clear(Parent.BackColor)
  373.  
  374.         Select Case Alert
  375.  
  376.             Case Style.Notice
  377.  
  378.                 If Field Then
  379.                     FillRoundRect(G, New Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(217, 237, 247))
  380.                     DrawRoundRect(G, New Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(188, 232, 241))
  381.  
  382.                     DrawTriangle(G, New Rectangle(0, 7, 20, 20), Direction.Left, Color.FromArgb(188, 232, 241))
  383.                     DrawTriangle(G, New Rectangle(2, 7, 20, 20), Direction.Left, Color.FromArgb(217, 237, 247))
  384.  
  385.                     If Centered Then
  386.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(58, 135, 173), New Rectangle(20, 0, Width, Height))
  387.                     Else
  388.                         Using B As New SolidBrush(Color.FromArgb(58, 135, 173))
  389.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(35, 9))
  390.                         End Using
  391.                     End If
  392.  
  393.                 Else
  394.                     FillRoundRect(G, FullRectangle(Size, True), 4, Color.FromArgb(217, 237, 247))
  395.                     DrawRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(188, 232, 241))
  396.  
  397.                     If Centered Then
  398.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(58, 135, 173), FullRectangle(Size, False))
  399.                     Else
  400.                         Using B As New SolidBrush(Color.FromArgb(58, 135, 173))
  401.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(12, 9))
  402.                         End Using
  403.                     End If
  404.                 End If
  405.  
  406.  
  407.             Case Style.Informations
  408.  
  409.                 If Field Then
  410.                     FillRoundRect(G, New Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(252, 248, 227))
  411.                     DrawRoundRect(G, New Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(251, 238, 213))
  412.  
  413.                     DrawTriangle(G, New Rectangle(0, 7, 20, 20), Direction.Left, Color.FromArgb(251, 238, 213))
  414.                     DrawTriangle(G, New Rectangle(2, 7, 20, 20), Direction.Left, Color.FromArgb(252, 248, 227))
  415.  
  416.                     If Centered Then
  417.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(192, 152, 83), New Rectangle(20, 0, Width, Height))
  418.                     Else
  419.                         Using B As New SolidBrush(Color.FromArgb(192, 152, 83))
  420.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(35, 9))
  421.                         End Using
  422.                     End If
  423.  
  424.                 Else
  425.                     FillRoundRect(G, FullRectangle(Size, True), 4, Color.FromArgb(252, 248, 227))
  426.                     DrawRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(251, 238, 213))
  427.  
  428.                     If Centered Then
  429.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(192, 152, 83), FullRectangle(Size, False))
  430.                     Else
  431.                         Using B As New SolidBrush(Color.FromArgb(192, 152, 83))
  432.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(12, 9))
  433.                         End Using
  434.                     End If
  435.                 End If
  436.  
  437.             Case Style.Warning
  438.  
  439.                 If Field Then
  440.                     FillRoundRect(G, New Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(242, 222, 222))
  441.                     DrawRoundRect(G, New Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(238, 211, 215))
  442.  
  443.                     DrawTriangle(G, New Rectangle(0, 7, 20, 20), Direction.Left, Color.FromArgb(238, 211, 215))
  444.                     DrawTriangle(G, New Rectangle(2, 7, 20, 20), Direction.Left, Color.FromArgb(242, 222, 222))
  445.  
  446.                     If Centered Then
  447.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(185, 74, 72), New Rectangle(20, 0, Width, Height))
  448.                     Else
  449.                         Using B As New SolidBrush(Color.FromArgb(185, 74, 72))
  450.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(35, 9))
  451.                         End Using
  452.                     End If
  453.  
  454.                 Else
  455.                     FillRoundRect(G, FullRectangle(Size, True), 4, Color.FromArgb(242, 222, 222))
  456.                     DrawRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(238, 211, 215))
  457.  
  458.                     If Centered Then
  459.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(185, 74, 72), FullRectangle(Size, False))
  460.                     Else
  461.                         Using B As New SolidBrush(Color.FromArgb(185, 74, 72))
  462.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(12, 9))
  463.                         End Using
  464.                     End If
  465.                 End If
  466.  
  467.             Case Else
  468.  
  469.                 If Field Then
  470.                     FillRoundRect(G, New Rectangle(20, 0, Width - 20, Height - 1), 4, Color.FromArgb(223, 240, 216))
  471.                     DrawRoundRect(G, New Rectangle(20, 0, Width - 21, Height - 1), 4, Color.FromArgb(214, 233, 198))
  472.  
  473.                     DrawTriangle(G, New Rectangle(0, 7, 20, 20), Direction.Left, Color.FromArgb(214, 233, 198))
  474.                     DrawTriangle(G, New Rectangle(2, 7, 20, 20), Direction.Left, Color.FromArgb(223, 240, 216))
  475.  
  476.                     If Centered Then
  477.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(70, 136, 71), New Rectangle(20, 0, Width, Height))
  478.                     Else
  479.                         Using B As New SolidBrush(Color.FromArgb(70, 136, 71))
  480.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(35, 9))
  481.                         End Using
  482.                     End If
  483.  
  484.                 Else
  485.                     FillRoundRect(G, FullRectangle(Size, True), 4, Color.FromArgb(223, 240, 216))
  486.                     DrawRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 4, Color.FromArgb(214, 233, 198))
  487.  
  488.                     If Centered Then
  489.                         CenterString(G, Text, New Font("Segoe UI", 10), Color.FromArgb(70, 136, 71), FullRectangle(Size, False))
  490.                     Else
  491.                         Using B As New SolidBrush(Color.FromArgb(70, 136, 71))
  492.                             G.DrawString(Text, New Font("Segoe UI", 10), B, New Point(12, 9))
  493.                         End Using
  494.                     End If
  495.                 End If
  496.         End Select
  497.  
  498.     End Sub
  499.  
  500.     Protected Overrides Sub OnResize(e As EventArgs)
  501.         MyBase.OnResize(e)
  502.         If Not Field Then
  503.             Height = 37
  504.         End If
  505.     End Sub
  506.  
  507. #End Region
  508.  
  509. End Class
  510.  
  511. Public Class SideWinderBlock
  512.     Inherits GroupBox
  513.  
  514. #Region " Drawing "
  515.  
  516.     Private G As Graphics
  517.  
  518.     Sub New()
  519.         DoubleBuffered = True
  520.     End Sub
  521.  
  522.     Protected Overrides Sub OnCreateControl()
  523.         MyBase.OnCreateControl()
  524.         SetStyle(ControlStyles.UserPaint, True)
  525.     End Sub
  526.  
  527.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  528.         G = e.Graphics
  529.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  530.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  531.  
  532.         MyBase.OnPaint(e)
  533.  
  534.         G.Clear(Color.White)
  535.  
  536.         Using P As New Pen(Color.FromArgb(220, 220, 220)) With {
  537.             .DashStyle = Drawing2D.DashStyle.Dash}
  538.  
  539.             G.DrawRectangle(P, FullRectangle(Size, True))
  540.         End Using
  541.  
  542.     End Sub
  543.  
  544.  
  545. #End Region
  546.  
  547.  
  548. End Class
  549.  
  550. Public Class SideWinderSeparator
  551.     Inherits Control
  552.  
  553. #Region " Drawing "
  554.  
  555.     Private G As Graphics
  556.  
  557.     Sub New()
  558.         DoubleBuffered = True
  559.     End Sub
  560.  
  561.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  562.         G = e.Graphics
  563.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  564.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  565.  
  566.         MyBase.OnPaint(e)
  567.  
  568.         Using P As New Pen(Color.FromArgb(232, 235, 242)) With {
  569.             .DashStyle = Drawing2D.DashStyle.Dash}
  570.             G.DrawLine(P, New Point(0, 0), New Point(Width, 0))
  571.         End Using
  572.  
  573.     End Sub
  574.  
  575. #End Region
  576.  
  577. End Class
  578.  
  579. Public Class SideWinderBlockQuote
  580.     Inherits Control
  581.  
  582. #Region " Drawing "
  583.  
  584.     Private G As Graphics
  585.  
  586.     Public Property Title As String
  587.  
  588.     Public Property Description As String
  589.  
  590.     Sub New()
  591.         DoubleBuffered = True
  592.     End Sub
  593.  
  594.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  595.         G = e.Graphics
  596.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  597.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  598.  
  599.         MyBase.OnPaint(e)
  600.  
  601.         Using P As New Pen(Color.FromArgb(102, 105, 112), 3)
  602.             G.DrawLine(P, New Point(3, 0), New Point(3, Height))
  603.         End Using
  604.  
  605.         If Not String.IsNullOrEmpty(Title) Then
  606.             Using B As New SolidBrush(Color.FromArgb(112, 115, 122))
  607.                 G.DrawString(Title.ToUpper, New Font("Segoe UI semibold", 11), B, New Point(13, 0))
  608.             End Using
  609.         End If
  610.  
  611.         Using B As New SolidBrush(Color.FromArgb(92, 95, 112))
  612.             G.DrawString(Description, New Font("Segoe UI", 10), B, New Point(13, 23))
  613.         End Using
  614.  
  615.     End Sub
  616.  
  617. #End Region
  618.  
  619. End Class
Advertisement
Add Comment
Please, Sign In to add comment