netrosly

Origin Theme

Aug 9th, 2014
948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 15.29 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3. Imports System.IO
  4. '|||||||||||||||||||||||||||||||||||||
  5. '||Origin Theme|||||||||||||||||||||||
  6. '||Made by Nettro|||||||||||||||||||||
  7. '||Date: Aug 09, 2014|||||||||||||||||
  8. '|||||||||||||||||||||||||||||||||||||
  9. Partial Class originForm
  10.     Inherits UserControl
  11.     Public Sub New()
  12.         Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  13.         DoubleBuffered = True
  14.  
  15.     End Sub
  16.     Private BottomMessage As String = "Create an account "
  17.     Protected Overrides Sub OnHandleCreated(e As EventArgs)
  18.         FindForm().FormBorderStyle = FormBorderStyle.None
  19.         Me.Dock = DockStyle.Fill
  20.         Me.BackColor = Color.FromArgb(45, 45, 45)
  21.         FindForm.TransparencyKey = Color.FromArgb(45, 45, 45)
  22.  
  23.         MyBase.OnHandleCreated(e)
  24.     End Sub
  25.     <PropertyTab("BottomMessage")> _
  26.     <DisplayName("BottomMessage")> _
  27.     Public Property BM() As String
  28.         Get
  29.             Return BottomMessage
  30.         End Get
  31.         Set(value As String)
  32.             BottomMessage = value
  33.         End Set
  34.     End Property
  35.     '\/Edit Default Image here, or insert your own Image through MyProject Resources
  36.     Private IconImage As Bitmap = My.Resources.logo_origin_transparent
  37.     Private IconShow As Boolean = True
  38.     Private Smooth As Boolean = True
  39.     Private ImageLocX As Integer = 55
  40.     Private ImageLocY As Integer = 55
  41.     Private ImageSizeX As Integer = 143
  42.     Private ImageSizeY As Integer = 48
  43.  
  44.     <PropertyTab("IconShow")> _
  45.  <DisplayName("IconShow")> _
  46.     Public Property Icons() As Boolean
  47.         Get
  48.             Return IconShow
  49.         End Get
  50.         Set(value As Boolean)
  51.             IconShow = value
  52.         End Set
  53.     End Property
  54.     <PropertyTab("IconImage")> _
  55.     <DisplayName("IconImage")> _
  56.     Public Property ImageIcon() As Bitmap
  57.         Get
  58.             Return IconImage
  59.         End Get
  60.         Set(value As Bitmap)
  61.             IconImage = value
  62.         End Set
  63.     End Property
  64.     <PropertyTab("ImageLocX")> _
  65.    <DisplayName("ImageLocX")> _
  66.     Public Property ImageLocX2() As Integer
  67.         Get
  68.             Return ImageLocX
  69.         End Get
  70.         Set(value As Integer)
  71.             ImageLocX = value
  72.         End Set
  73.     End Property
  74.     <PropertyTab("ImageLocY")> _
  75.   <DisplayName("ImageLocY")> _
  76.     Public Property ImageLocY2() As Integer
  77.         Get
  78.             Return ImageLocY
  79.         End Get
  80.         Set(value As Integer)
  81.             ImageLocY = value
  82.         End Set
  83.     End Property
  84.     <PropertyTab("ImageWidth")> _
  85.   <DisplayName("ImageWidth")> _
  86.     Public Property ImageWidth2() As Integer
  87.         Get
  88.             Return ImageSizeX
  89.         End Get
  90.         Set(value As Integer)
  91.             ImageSizeX = value
  92.         End Set
  93.     End Property
  94.     <PropertyTab("ImageHeight")> _
  95.   <DisplayName("ImageHeight")> _
  96.     Public Property ImageHeight2() As Integer
  97.         Get
  98.             Return ImageSizeY
  99.         End Get
  100.         Set(value As Integer)
  101.             ImageSizeY = value
  102.         End Set
  103.     End Property
  104.     <PropertyTab("Smoothing")> _
  105.  <DisplayName("Smoothing")> _
  106.     Public Property SmoothEdges() As Boolean
  107.         Get
  108.             Return Smooth
  109.         End Get
  110.         Set(value As Boolean)
  111.             Smooth = value
  112.         End Set
  113.     End Property
  114.  
  115.  
  116.     Private PT1, PT2 As PointF
  117.     Private SZ1, SZ2 As SizeF
  118.     Dim X, Y As Integer
  119.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  120.  
  121.         Dim bm As New Bitmap(Me.Width, Me.Height)
  122.         Dim g As Graphics = Graphics.FromImage(bm)
  123.         Dim g2 As Graphics = Graphics.FromImage(bm)
  124.         Me.Padding = New Padding(13, 39, 13, 24)
  125.         Dim rect As New Rectangle(0, 0, Me.Width, (Me.Height - 35))
  126.         Dim brush As New LinearGradientBrush(rect, Color.FromArgb(250, 250, 250), Color.FromArgb(206, 206, 206), 90.0!)
  127.         'Begin
  128.  
  129.         'Main Form
  130.         If Smooth = True Then
  131.             g.SmoothingMode = SmoothingMode.HighQuality
  132.         End If
  133.         Dim rect2 As New Rectangle(0, 0, Me.Width, (Me.Height - 35))
  134.         Dim Path As GraphicsPath = RoundRec(0, 0, Width, Height - 35, 24)
  135.         g.FillPath(New LinearGradientBrush(rect2, Color.FromArgb(250, 250, 250), Color.FromArgb(206, 206, 206), 90.0!), Path)
  136.         If IconShow = True Then
  137.             g.DrawImage(IconImage, New Rectangle(ImageLocX, ImageLocY, ImageSizeX, ImageSizeY))
  138.         End If
  139.         '  g.DrawPath(New Pen(Color.Black), Path)
  140.  
  141.         ' e.Graphics.FillRectangle(brush, brush.Rectangle)
  142.  
  143.         'Blend Ends
  144.         rect = New Rectangle(0, (Me.Height - 55), Me.Width, 55)
  145.         brush = New LinearGradientBrush(rect, Color.FromArgb(206, 206, 206), Color.FromArgb(206, 206, 206), 90.0!)
  146.         g.FillRectangle(brush, brush.Rectangle)
  147.         'Seprator 1
  148.         rect = New Rectangle(0, (Me.Height - 40), Me.Width, 40)
  149.         brush = New LinearGradientBrush(rect, Color.FromArgb(190, 190, 190), Color.FromArgb(190, 190, 190), 90.0!)
  150.         g.FillRectangle(brush, brush.Rectangle)
  151.         ' White Seprator
  152.         rect = New Rectangle(0, (Me.Height - 38), Me.Width, 38)
  153.         brush = New LinearGradientBrush(rect, Color.FromArgb(227, 227, 227), Color.FromArgb(227, 227, 227), 90.0!)
  154.         g.FillRectangle(brush, brush.Rectangle)
  155.         'Seprator 2
  156.         rect = New Rectangle(0, (Me.Height - 37), Me.Width, 37)
  157.         brush = New LinearGradientBrush(rect, Color.FromArgb(190, 190, 190), Color.FromArgb(190, 190, 190), 90.0!)
  158.         g.FillRectangle(brush, brush.Rectangle)
  159.         'Bottom Part
  160.         rect = New Rectangle(0, (Me.Height - 32), Me.Width, 32)
  161.         brush = New LinearGradientBrush(rect, Color.FromArgb(195, 195, 195), Color.FromArgb(195, 195, 195), 90.0!)
  162.         g.FillRectangle(brush, brush.Rectangle)
  163.         'Button Text
  164.         g.DrawString(BottomMessage, New Font("Arial", 8, FontStyle.Bold), New SolidBrush(Color.FromArgb(45, 45, 45)), rect, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  165.         'Close Button ~ By Mava
  166.         If New Rectangle(Width - 22, 5, 15, 15).Contains(New Point(X, Y)) Then
  167.             g.SmoothingMode = SmoothingMode.HighQuality
  168.             g.FillEllipse(New SolidBrush(Color.FromArgb(95, 95, 95)), New Rectangle(Width - 24, 6, 16, 16))
  169.             g.DrawString("r", New Font("Webdings", 8), New SolidBrush(Color.FromArgb(250, 250, 250)), New Point(Width - 23, 5))
  170.         Else
  171.             g.SmoothingMode = SmoothingMode.HighQuality
  172.             g.FillEllipse(New SolidBrush(Color.FromArgb(85, 85, 85)), New Rectangle(Width - 24, 6, 16, 16))
  173.             g.DrawString("r", New Font("Webdings", 8), New SolidBrush(Color.FromArgb(250, 250, 250)), New Point(Width - 23, 5))
  174.         End If
  175.  
  176.         'End
  177.         e.Graphics.DrawImage(DirectCast(bm.Clone(), Bitmap), 0, 0)
  178.         g.Dispose()
  179.         bm.Dispose()
  180.         MyBase.OnPaint(e)
  181.        
  182.     End Sub
  183.  
  184.    
  185.     Public Function RoundRec(ByVal X As Integer, ByVal Y As Integer, _
  186.      ByVal Width As Integer, ByVal Height As Integer, ByVal diameter As Integer) As System.Drawing.Drawing2D.GraphicsPath
  187.  
  188.         ''the 'diameter' pwwwsarameter changes the size of the rounded region
  189.  
  190.         Dim graphics_path As New System.Drawing.Drawing2D.GraphicsPath
  191.  
  192.         Dim BaseRect As New RectangleF(X, Y, Width, Height)
  193.         Dim ArcRect As New RectangleF(BaseRect.Location, New SizeF(diameter, diameter))
  194.  
  195.  
  196.         'top left Arc
  197.         graphics_path.AddArc(ArcRect, 180, 90)
  198.         graphics_path.AddLine(X + CInt(diameter / 2), _
  199.         Y, X + Width - CInt(diameter / 2), Y)
  200.  
  201.         ' top right arc
  202.         ArcRect.X = BaseRect.Right - diameter
  203.         graphics_path.AddArc(ArcRect, 270, 90)
  204.         graphics_path.AddLine(X + Width, _
  205.         Y + CInt(diameter / 2 + 30), X + Width, _
  206.                          Y + Height - CInt(diameter / 2 + 30))
  207.  
  208.         ' bottom right arc
  209.         ArcRect.Y = BaseRect.Bottom - diameter
  210.         graphics_path.AddArc(ArcRect, 0, 90)
  211.         graphics_path.AddLine(X + CInt(diameter / 2), _
  212.         Y + Height, X + Width - CInt(diameter / 2), _
  213.                          Y + Height)
  214.  
  215.  
  216.         ' bottom left arc
  217.         ArcRect.X = BaseRect.Left
  218.         graphics_path.AddArc(ArcRect, 90, 90)
  219.         graphics_path.AddLine(X, Y + CInt(diameter / 2), _
  220.         X, Y + Height - CInt(diameter / 2))
  221.         Return graphics_path
  222.  
  223.     End Function
  224. #Region "ThemeDraggable"
  225.  
  226.     Private savePoint As New Point(0, 0)
  227.     Private isDragging As Boolean = False
  228.  
  229.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  230.         Dim dragRect As New Rectangle(0, 0, Me.Width, 30)
  231.         If dragRect.Contains(New Point(e.X, e.Y)) Then
  232.             isDragging = True
  233.             savePoint = New Point(e.X, e.Y)
  234.         End If
  235.         Dim clickRect As New Rectangle(Me.Width - 24, 10, 13, 12)
  236.         If clickRect.Contains(New Point(e.X, e.Y)) Then
  237.             Environment.[Exit](0)
  238.         End If
  239.         MyBase.OnMouseDown(e)
  240.     End Sub
  241.  
  242.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  243.         isDragging = False
  244.         MyBase.OnMouseUp(e)
  245.     End Sub
  246.  
  247.     Private mouseX As Integer
  248.     Private mouseY As Integer
  249.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  250.         mouseX = e.X
  251.         mouseY = e.Y
  252.         If New Rectangle(Width - 22, 5, 15, 15).Contains(New Point(X, Y)) Then
  253.             FindForm.Close()
  254.         End If
  255.         If isDragging Then
  256.             Dim screenPoint As Point = PointToScreen(e.Location)
  257.  
  258.             FindForm().Location = New Point(screenPoint.X - Me.savePoint.X, screenPoint.Y - Me.savePoint.Y)
  259.         End If
  260.         MyBase.OnMouseMove(e)
  261.         Invalidate()
  262.     End Sub
  263.  
  264. #End Region
  265.  
  266.    
  267. End Class
  268. Partial Public Class NotifactionMSG
  269.     Inherits Panel
  270.     Public Sub New()
  271.         Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  272.         DoubleBuffered = True
  273.     End Sub
  274.     Protected Overrides Sub OnHandleCreated(e As EventArgs)
  275.         MyBase.OnHandleCreated(e)
  276.     End Sub
  277.     Private NoteMsg As String = "An unknown error has occurred. Please restart Origin and try again."
  278.     Private NoteFont As Font = New Font("Arial", 11, FontStyle.Bold)
  279.     <PropertyTab("NoteFont")> _
  280.  <DisplayName("NoteFont")> _
  281.     Public Property NM() As Font
  282.         Get
  283.             Return NoteFont
  284.         End Get
  285.         Set(value As Font)
  286.             NoteFont = value
  287.         End Set
  288.     End Property
  289.     <PropertyTab("NoteMessage")> _
  290. <DisplayName("NoteMessage")> _
  291.     Public Property NF() As String
  292.         Get
  293.             Return NoteMsg
  294.         End Get
  295.         Set(value As String)
  296.             NoteMsg = value
  297.         End Set
  298.     End Property
  299.     Enum Style
  300.         _Error
  301.         _Notice
  302.     End Enum
  303.  
  304.     Private _Style As Style
  305.     Public Property AlertStyle As Style
  306.         Get
  307.             Return _Style
  308.         End Get
  309.         Set(ByVal value As Style)
  310.             _Style = value
  311.             Invalidate()
  312.         End Set
  313.     End Property
  314.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  315.  
  316.         Dim bm As New Bitmap(Me.Width, Me.Height)
  317.         Dim g As Graphics = Graphics.FromImage(bm)
  318.         Dim g2 As Graphics = Graphics.FromImage(bm)
  319.         Me.Padding = New Padding(13, 39, 13, 24)
  320.         Dim rect As New Rectangle(0, 0, Me.Width, (Me.Height - 35))
  321.         Dim brush As New LinearGradientBrush(rect, Color.FromArgb(250, 250, 250), Color.FromArgb(206, 206, 206), 90.0!)
  322.         'Begin
  323.         If Me.Height Or Me.Width >= 30 Then
  324.  
  325.             Select Case _Style
  326.                 Case Style._Error
  327.                     g.SmoothingMode = SmoothingMode.HighQuality
  328.                     g.DrawRectangle(New Pen(Color.FromArgb(223, 66, 32)), New Rectangle(0, 0, Me.Width, Me.Height))
  329.                     g.FillRectangle(New SolidBrush(Color.FromArgb(223, 66, 32)), New Rectangle(0, 0, Me.Width, Me.Height))
  330.                     g.DrawImage(Base64ToImage("iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIJSURBVFhH7Zg9S8RAEED9KddoYWthoxxaKAqKCoocaiFYiApaCZbaXit2thb+Af+DpVhZeNzpiaIoWIjVei8YCMfsZj8SZDGBB0eymXmEzczkBu4nayomKuGyqYTLphIum/8l3JoeUu2lEfWwXlePWzOqu7uonvZXEvjNOa6xhrVSDFe8hFuzw6rTGFPd7Xn1dLBqBWu5h3ulmLY4C7eXR3vJ50QpG7iXGFJsG6yFW1ODqrNWFyV8IBYxpVwmrIQJ/LAxISYOgZiu0lbCRT7Zfogt5dSRK8x+kxIVicueNgrzRrtUgpeTPfV5dZnwdnosrpEgh231MApThqQEOpBMD6SlNTo6jXHRoR+tMIXe5elCiHB3Z8GquWiF6U5SYBMhwkBOySWLVpiWKgU1ESpMTskli1aYOUAKauL5aPNXV6n386a4xgQ5JZcsWuFkkBGC5pEeLlUihZySSxatcDJ1CUHzSA8fYXJKLlkKF/6+u02EpWu5hAj7bokQ4aAt4fPSwdfNtbdw0EvnU9aA9vzaPBSv5RFU1nwaB6JsCfi4OBPXmAhqHNG1Zohq+AHX8dKXwsZLiGqAT4nqEwmi+wgFAhf5pInlKgvWwinstyj+SMnCG00ZonZKUhKs5R7baqDDSziFQk93oqUyByQDE1NeD35zjmussWkKNgQJ/wWVcNlUwmUTmXBN/QCoe2Fr5J6flQAAAABJRU5ErkJggg=="), New Rectangle(Me.Width / 4 - 65, Me.Height / 2 - 22, 44, 44))
  331.                     g.DrawString(NoteMsg, NoteFont, New SolidBrush(Color.FromArgb(250, 250, 250)), New Rectangle(Me.Width / 4 - 10, Me.Height / 2 - 40, 220, 80), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  332.                 Case Style._Notice
  333.                     g.SmoothingMode = SmoothingMode.HighQuality
  334.                     g.DrawRectangle(New Pen(Color.FromArgb(38, 157, 207)), New Rectangle(0, 0, Me.Width, Me.Height))
  335.                     g.FillRectangle(New SolidBrush(Color.FromArgb(38, 157, 207)), New Rectangle(0, 0, Me.Width, Me.Height))
  336.                     g.DrawImage(Base64ToImage("iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAH/SURBVFhH7ZjPKwVRFMf9NTaUtbIhLC2IDXtra2t7ayUsJA8JsbCxsLGgR7yX915Kkli8nWyvPi+3NH3nx713Jk1m6lOvmTvnfJrunHPm9fWv102ZqISLphIumv8jPLh5a4a3783EXtNMHT6auZO2mT/t9OA357jGGtaqGD44Cw9t3ZnR3YaZOWqZhbNOJljLPdyrYrrgJDyy82CmHUSjcC8xVOysZBIe2Lg147WmlPCBWMRUudJIFSbw5H5+shZi+kinCuf5ZKMQW+VMIlGY/aYS5Ynrno4V5o12qQRLF8/moN3tsXL1KtcoyOFSPWKFKUMqQRxI2gNptSaOsVpDOiikMIXe5elCiPDscStzc5HCdCcVOIkQYSCncokihWmpKmgSocLkVC5RpDBzgAqaxOL504+uMas3b3JNEuRULlGkMMOLCpqGPVyqhIWcyiWKFGbiUkHTsIePMDmVS5RchZvdr56wupZGkLDvlggRDtoSPi8dXL9/egsHvXQ+ZQ1oz8uXL/JaGkFlzadxIMqWgLW7D7kmiaDGUbrWDKUafsB1vPQlt/ESSjXAW0r1iQSl+wgFAuf5pInlIwuZhC3st1L8kfIb3mjKELVTSSlYyz0u1SAOZ2ELhZ7uREtlDmB4YeICfnOOa6zJ2hSy4C38V1TCRVMJF00lXDQlE66bb+YGhyafMUw8AAAAAElFTkSuQmCC"), New Rectangle(Me.Width / 4 - 65, Me.Height / 2 - 22, 44, 44))
  337.                     g.DrawString(NoteMsg, NoteFont, New SolidBrush(Color.FromArgb(250, 250, 250)), New Rectangle(Me.Width / 4 - 10, Me.Height / 2 - 40, 220, 80), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  338.             End Select
  339.         End If
  340.         'end
  341.         e.Graphics.DrawImage(DirectCast(bm.Clone(), Bitmap), 0, 0)
  342.         g.Dispose()
  343.         bm.Dispose()
  344.         MyBase.OnPaint(e)
  345.     End Sub
  346.     Public Function Base64ToImage(base64String As String) As Image
  347.         'I did not write this Function
  348.         ' Convert Base64 String to byte[]
  349.         Dim imageBytes As Byte() = Convert.FromBase64String(base64String)
  350.         Dim ms As New MemoryStream(imageBytes, 0, imageBytes.Length)
  351.  
  352.         ' Convert byte[] to Image
  353.         ms.Write(imageBytes, 0, imageBytes.Length)
  354.         Dim image__1 As Image = Image.FromStream(ms, True)
  355.         Return image__1
  356.     End Function
  357. End Class
Advertisement
Add Comment
Please, Sign In to add comment