Tema visual studio
Enviado por NarvaezG1 • 26 de Febrero de 2016 • Trabajo • 20.937 Palabras (84 Páginas) • 228 Visitas
Imports System.Drawing.Drawing2D, System.ComponentModel
''' <summary>
''' Flat UI Theme
''' Coder: iSynthesis (HF)
''' Version: 1.0.1
''' Date Created: 16/06/2013
''' Date Changed: 18/06/2013
''' UID: 374648
''' </summary>
''' <remarks></remarks>
Module Helpers
#Region " Variables"
Friend G As Graphics, B As Bitmap
Friend _FlatColor As Color = Color.FromArgb(35, 168, 109)
Friend NearSF As New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near}
Friend CenterSF As New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}
#End Region
#Region " Functions"
Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
Dim P As GraphicsPath = New GraphicsPath()
Dim ArcRectangleWidth As Integer = Curve * 2
P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
Return P
End Function
'-- Credit: AeonHack
Public Function DrawArrow(ByVal x As Integer, ByVal y As Integer, ByVal flip As Boolean) As GraphicsPath
Dim GP As New GraphicsPath()
Dim W As Integer = 12
Dim H As Integer = 6
If flip Then
GP.AddLine(x + 1, y, x + W + 1, y)
GP.AddLine(x + W, y, x + H, y + H - 1)
Else
GP.AddLine(x, y + H, x + W, y + H)
GP.AddLine(x + W, y + H, x + H, y)
End If
GP.CloseFigure()
Return GP
End Function
#End Region
End Module
#Region " Mouse States"
Enum MouseState As Byte
None = 0
Over = 1
Down = 2
Block = 3
End Enum
#End Region
Class FormSkin : Inherits ContainerControl
#Region " Variables"
Private W, H As Integer
Private Cap As Boolean = False
Private _HeaderMaximize As Boolean = False
Private MousePoint As New Point(0, 0)
Private MoveHeight = 50
#End Region
#Region " Properties"
#Region " Colors"
<Category("Colors")> _
Public Property HeaderColor() As Color
Get
Return _HeaderColor
End Get
Set(ByVal value As Color)
_HeaderColor = value
End Set
End Property
<Category("Colors")> _
Public Property BaseColor() As Color
Get
Return _BaseColor
End Get
Set(ByVal value As Color)
_BaseColor = value
End Set
End Property
<Category("Colors")> _
Public Property BorderColor() As Color
Get
Return _BorderColor
End Get
Set(ByVal value As Color)
_BorderColor = value
End Set
End Property
<Category("Colors")> _
Public Property FlatColor() As Color
Get
Return _FlatColor
End Get
Set(ByVal value As Color)
_FlatColor = value
End Set
End Property
#End Region
<Category("Options")>
Public Property HeaderMaximize As Boolean
Get
Return _HeaderMaximize
End Get
Set(ByVal value As Boolean)
_HeaderMaximize = value
End Set
End Property
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseDown(e)
If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
Cap = True
MousePoint = e.Location
End If
End Sub
Private Sub FormSkin_MouseDoubleClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseDoubleClick
If HeaderMaximize Then
If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
If FindForm.WindowState = FormWindowState.Normal Then
FindForm.WindowState = FormWindowState.Maximized : FindForm.****************************()
ElseIf FindForm.WindowState = FormWindowState.Maximized Then
FindForm.WindowState = FormWindowState.Normal : FindForm.****************************()
End If
End If
End If
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e) : Cap = False
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
MyBase.OnMouseMove(e)
If Cap Then
Parent.Location = MousePosition - MousePoint
End If
End Sub
Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
...