Professional Documents
Culture Documents
Drawing2D
'
'
'Created By Marvinn (HF)
'Need Any help feel free to mail/pm me (marvinzwolsman@hotmail.com)
'Please give propper credits!
'11/5/2011 22:30 (Dutch/Netherlands)
'
'
Public Class CypherxButton
Inherits Control
Sub New()
Font = New Font("Arial", 8)
ForeColor = Color.White
End Sub
e.Graphics.DrawImage(b.Clone, 0, 0)
End Using
End Using
MyBase.OnPaint(e)
End Sub
g.DrawRectangle(New Pen(New
SolidBrush(Color.FromArgb(15, 10, 5))), New Rectangle(0, 0, Width -
2, Height - 1))
g.DrawRectangle(New Pen(New
SolidBrush(Color.FromArgb(55, 45, 35))), New Rectangle(1, 1, Width -
3, Height - 3))
g.DrawRectangle(New Pen(New
SolidBrush(Color.FromArgb(75, 70, 65)), 2), New Rectangle(3, 3, Width
- 6, Height - 6))
g.FillRectangle(New SolidBrush(Color.FromArgb(200,
Color.FromArgb(75, 70, 65))), BovenHelftBalk)
g.FillRectangle(New SolidBrush(Color.FromArgb(230,
P2)), OnderHelftBalk)
If Minibox Then
Select Case EnteredMinimize
Case True
g.FillRectangle(Brushes.White,
MinimizeRec)
g.DrawRectangle(New
Pen(Color.FromArgb(255, Color.Black), 1), MinimizeRec)
Case False
g.FillRectangle(New
SolidBrush(Color.FromArgb(100, Color.White)), MinimizeRec)
g.DrawRectangle(New
Pen(Color.FromArgb(150, Color.Black), 1), MinimizeRec)
End Select
End If
e.Graphics.DrawImage(b, 0, 0)
End Using
End Using
MyBase.OnPaint(e)
End Sub
MyBase.OnMouseMove(e)
End Sub
End With
End If
End If
MyBase.OnMouseDown(e)
End Sub
#End Region
Function FadeOut()
If TypeOf Parent Is Form Then
With DirectCast(Parent, Form)
For i As Double = 1 To 0.0 Step -0.1
.Opacity = i
Threading.Thread.Sleep(50)
Next
End With
End If
Return True
End Function
End Class
Get
Return _DarkColor
End Get
Set(ByVal value As Color)
_DarkColor = value
Invalidate()
End Set
End Property
#End Region
End Class
Inherits Control
Sub New()
Font = New Font("Arial", 8)
ForeColor = Color.White
MinimumSize = New Size(130, 23)
End Sub
MouseState = State.Wait
Dim ShowPopup As New Threading.Thread(AddressOf ShowAndWait)
ShowPopup.Start()
Invalidate()
MyBase.OnMouseDown(e)
End Sub
Sub ShowAndWait()
Dim pop As New Popup(_Items)
pop.Location = New Point(Location.X, Location.Y + Height + 2)
pop.WaitForInput()
MouseState = State.MouseLeft
If Not pop.SelectedItem = "" Then
Invoke(New UpdateTextD(AddressOf UpdateText),
pop.SelectedItem)
Else
Invoke(New UpdateTextD(AddressOf UpdateText), Text)
End If
End Sub
e.Graphics.DrawImage(b.Clone, 0, 0)
End Using
End Using
MyBase.OnPaint(e)
End Sub
End Sub
Protected Overrides Sub OnHandleCreated(ByVal e As
System.EventArgs)
Console.WriteLine(TopLevelControl.TopLevelControl)
BringToFront()
MyBase.OnHandleCreated(e)
End Sub
Dim MyMousedown As Boolean = False
Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
MyMousedown = True
Invalidate()
_item = Temp_item
Console.WriteLine("Item: " & SelectedItem)
Input = True
Me.Hide()
MyBase.OnMouseDown(e)
End Sub
Sub FixWidth()
Dim G As Graphics = Graphics.FromImage(New Bitmap(1, 1))
Dim LongestWidth As Integer = 0
For Each Str As String In _items
If G.MeasureString(Str, Font).Width > LongestWidth Then
LongestWidth = G.MeasureString(Str, Font).Width
End If
Next
End Sub
Sub FixList()
Dim MyHeight = 23 * _items.Length - 1
Dim AantalRecs As Integer = MyHeight / 23
ListOfRec.Add(New Rectangle(2, 3, Width - 5, 23))
For i As Integer = 1 To AantalRecs
Dim rec As New Rectangle(2, 23 * i, Width - 5, 23)
ListOfRec.Add(rec)
Next
Me.Height = MyHeight + 5
Invalidate()
End Sub
Dim SelectedReg As New Rectangle(0, 0, 0, 0)
Protected Overrides Sub OnMouseMove(ByVal e As
System.Windows.Forms.MouseEventArgs)
Dim Oldrec As Rectangle = SelectedReg
For Each rec As Rectangle In ListOfRec
If rec.Contains(e.Location) Then
SelectedReg = rec
End If
Next
If Not Oldrec = SelectedReg Then
Invalidate()
End If
MyBase.OnMouseMove(e)
End Sub
End Class
'
'
'Created By Aeonhack
'
'
Public Class Draw
Shared Sub Gradient(ByVal g As Graphics, ByVal c1 As Color, ByVal
c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As
Integer, ByVal height As Integer)
Dim R As New Rectangle(x, y, width, height)
Using T As New LinearGradientBrush(R, c1, c2,
LinearGradientMode.Vertical)
g.FillRectangle(T, R)
End Using
End Sub
Shared Sub Gradient(ByVal g As Graphics, ByVal c1 As Color, ByVal
c2 As Color, ByVal r As Rectangle)
Using T As New LinearGradientBrush(R, c1, c2,
LinearGradientMode.Vertical)
g.FillRectangle(T, R)
End Using
End Sub
Shared Sub Blend(ByVal g As Graphics, ByVal c1 As Color, ByVal c2
As Color, ByVal c3 As Color, ByVal c As Single, ByVal d As Integer,
ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal
height As Integer)
Dim v As New ColorBlend(3)
V.Colors = New Color() {c1, c2, c3}
V.Positions = New Single() {0, c, 1}
Dim R As New Rectangle(x, y, width, height)
Using T As New LinearGradientBrush(R, c1, c1, CType(d,
LinearGradientMode))
T.InterpolationColors = v : g.FillRectangle(T, R)
End Using
End Sub
Shared Function RoundedRectangle(ByVal x As Integer, ByVal y As
Integer, ByVal width As Integer, ByVal height As Integer, ByVal
cornerwidth As Integer, ByVal PenWidth As Integer) As GraphicsPath
Dim p As New GraphicsPath
p.StartFigure()
p.AddArc(New Rectangle(x, y, cornerwidth, cornerwidth), 180,
90)
p.AddLine(cornerwidth, y, width - cornerwidth - PenWidth, y)
Return p
End Function
Shared Sub BackGround(ByVal width As Integer, ByVal height As
Integer, ByVal G As Graphics)