View difference between Paste ID: Bci4ftju and 3X556AGk
SHOW: | | - or go back to the newest paste.
1
Imports System, System.IO, System.Collections.Generic, System.Runtime.InteropServices, System.ComponentModel
2
Imports System.Drawing, System.Drawing.Drawing2D, System.Drawing.Imaging, System.Windows.Forms
3
4-
'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
4+
5
    None = 0
6-
'--------------------- [ Theme ] --------------------
6+
7-
'Creator: Recuperare
7+
8-
'Contact: cschaefer2183 (Skype)
8+
9-
'Created: 09.22.2012
9+
10-
'Changed: 09.22.2012
10+
11-
'-------------------- [ /Theme ] ---------------------
11+
12
13-
'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
13+
14
    Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
15
        Dim P As GraphicsPath = New GraphicsPath()
16
        Dim ArcRectangleWidth As Integer = Curve * 2
17
        P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
18
        P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
19
        P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
20
        P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
21
        P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
22
        Return P
23
    End Function
24
    Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
25
        Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
26
        Dim P As GraphicsPath = New GraphicsPath()
27
        Dim ArcRectangleWidth As Integer = Curve * 2
28
        P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
29
        P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
30
        P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
31
        P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
32
        P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
33
        Return P
34
    End Function
35
End Class
36
37
#End Region
38
39
40
Public Class BlackShadesNetForm : Inherits ContainerControl
41
42
#Region " Control Help - Movement & Flicker Control "
43
    Private MouseP As Point = New Point(0, 0)
44
    Private Cap As Boolean = False
45
    Private MoveHeight As Integer
46
    Private pos As Integer = 0
47
48
    Private Sub minimBtnClick() Handles minimBtn.Click
49
        ParentForm.FindForm.WindowState = FormWindowState.Minimized
50
    End Sub
51
    Private Sub closeBtnClick() Handles closeBtn.Click
52
        If CloseButtonExitsApp Then
53
            System.Environment.Exit(0)
54
        Else
55
            ParentForm.FindForm.Close()
56
        End If
57
    End Sub
58
    Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
59
        MyBase.OnMouseDown(e)
60
        If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
61
            Cap = True : MouseP = e.Location
62
        End If
63
    End Sub
64
    Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
65
        MyBase.OnMouseUp(e) : Cap = False
66
    End Sub
67
    Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
68
        MyBase.OnMouseMove(e)
69
        If Cap Then
70
            Parent.Location = MousePosition - MouseP
71
        End If
72
    End Sub
73
    Protected Overrides Sub OnInvalidated(ByVal e As System.Windows.Forms.InvalidateEventArgs)
74
        MyBase.OnInvalidated(e)
75
        ParentForm.FindForm.Text = Text
76
    End Sub
77
    Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
78
    End Sub
79
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
80
        MyBase.OnTextChanged(e)
81
        Invalidate()
82
    End Sub
83
    Protected Overrides Sub OnCreateControl()
84
        MyBase.OnCreateControl()
85
        Me.ParentForm.FormBorderStyle = FormBorderStyle.None
86
        Me.ParentForm.TransparencyKey = Color.Fuchsia
87
    End Sub
88
    Protected Overrides Sub CreateHandle()
89
        MyBase.CreateHandle()
90
    End Sub
91
    Private _closesEnv As Boolean = False
92
    Public Property CloseButtonExitsApp() As Boolean
93
        Get
94
            Return _closesEnv
95
        End Get
96
        Set(ByVal v As Boolean)
97
            _closesEnv = v
98
            Invalidate()
99
        End Set
100
    End Property
101
102
    Private _minimBool As Boolean = True
103
    Public Property MinimizeButton() As Boolean
104
        Get
105
            Return _minimBool
106
        End Get
107
        Set(ByVal v As Boolean)
108
            _minimBool = v
109
            Invalidate()
110
        End Set
111
    End Property
112
113
#End Region
114
115
    Dim WithEvents minimBtn As New BlackShadesNetTopButton With {.Location = New Point(Width - 44, 7)}
116
    Dim WithEvents closeBtn As New BlackShadesNetTopButton With {.Location = New Point(Width - 27, 7)}
117
118
    Sub New()
119
        MyBase.New()
120
        Dock = DockStyle.Fill
121
        MoveHeight = 25
122
        Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
123
        ForeColor = Color.FromArgb(142, 152, 156)
124
        DoubleBuffered = True
125
126
        Controls.Add(closeBtn)
127
128
        closeBtn.Refresh() : minimBtn.Refresh()
129
    End Sub
130
131
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
132
133
        Const curve As Integer = 7
134
        Dim B As New Bitmap(Width, Height)
135
        Dim G As Graphics = Graphics.FromImage(B)
136
137
        If _minimBool Then
138
            Controls.Add(minimBtn)
139
        Else
140
            Controls.Remove(minimBtn)
141
        End If
142
143
        minimBtn.Location = New Point(Width - 44, 7)
144
        closeBtn.Location = New Point(Width - 27, 7)
145
146
        G.SmoothingMode = SmoothingMode.Default
147
        Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
148
        Dim TransparencyKey As Color = Me.ParentForm.TransparencyKey
149
        Dim d As New Draw()
150
        MyBase.OnPaint(e)
151
152
        G.Clear(TransparencyKey)
153
154
        G.FillPath(New SolidBrush(Color.FromArgb(42, 47, 49)), d.RoundRect(ClientRectangle, curve))
155
156
157
        'DRAW GRADIENTED BORDER
158
        Dim innerGradLeft As New LinearGradientBrush(New Rectangle(1, 1, Width / 2 - 1, Height - 3), _
159
                                             Color.FromArgb(102, 108, 112), Color.FromArgb(204, 216, 224), 0S)
160
        Dim innerGradRight As New LinearGradientBrush(New Rectangle(1, 1, Width / 2 - 1, Height - 3), _
161
                                     Color.FromArgb(204, 216, 224), Color.FromArgb(102, 108, 112), 0S)
162
        G.DrawPath(New Pen(innerGradLeft), d.RoundRect(New Rectangle(1, 1, Width / 2 + 3, Height - 3), curve))
163
        G.DrawPath(New Pen(innerGradRight), d.RoundRect(New Rectangle(Width / 2 - 5, 1, Width / 2 + 3, Height - 3), curve))
164
165
166
        G.FillPath(New SolidBrush(Color.FromArgb(42, 47, 49)), d.RoundRect(New Rectangle(2, 2, Width - 5, Height - 5), curve))
167
168
169
        Dim topGradLeft As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, 25), Color.FromArgb(42, 46, 48), _
170
                                                   Color.FromArgb(93, 98, 101), 0S)
171
        Dim topGradRight As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, 25), Color.FromArgb(93, 98, 101), _
172
                                           Color.FromArgb(42, 46, 48), 0S)
173
        G.FillPath(topGradLeft, d.RoundRect(New Rectangle(2, 2, Width / 2 + 2, 25), curve))
174
        G.FillPath(topGradRight, d.RoundRect(New Rectangle(Width / 2 - 3, 2, Width / 2 - 1, 25), curve))
175
176
        G.FillRectangle(New SolidBrush(Color.FromArgb(42, 47, 49)), New Rectangle(2, 23, Width - 5, 10))
177
178
        G.DrawPath(New Pen(Color.FromArgb(42, 46, 48)), d.RoundRect(New Rectangle(2, 2, Width - 5, Height - 5), curve))
179
        G.DrawPath(New Pen(Color.FromArgb(9, 11, 12)), d.RoundRect(ClientRectangle, curve))
180
181
        G.DrawString(Text, Font, Brushes.White, New Rectangle(curve, curve - 2, Width - 1, 22), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
182
183
        e.Graphics.DrawImage(B.Clone(), 0, 0)
184
        G.Dispose() : B.Dispose()
185
    End Sub
186
End Class
187
188
Public Class BlackShadesNetButton : Inherits Control
189
190
#Region " Control Help - MouseState & Flicker Control"
191
    Private State As MouseState = MouseState.None
192
    Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
193
        MyBase.OnMouseEnter(e)
194
        State = MouseState.Over
195
        Invalidate()
196
    End Sub
197
    Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
198
        MyBase.OnMouseDown(e)
199
        State = MouseState.Down
200
        Invalidate()
201
    End Sub
202
    Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
203
        MyBase.OnMouseLeave(e)
204
        State = MouseState.None
205
        Invalidate()
206
    End Sub
207
    Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
208
        MyBase.OnMouseUp(e)
209
        State = MouseState.Over
210
        Invalidate()
211
    End Sub
212
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
213
    End Sub
214
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
215
        MyBase.OnTextChanged(e)
216
        Invalidate()
217
    End Sub
218
    Private _align As StringAlignment = StringAlignment.Center
219
    Public Shadows Property TextAlignment() As StringAlignment
220
        Get
221
            Return _align
222
        End Get
223
        Set(ByVal v As StringAlignment)
224
            _align = v
225
            Invalidate()
226
        End Set
227
    End Property
228
229
#End Region
230
231
    Sub New()
232
        MyBase.New()
233
        BackColor = Color.FromArgb(38, 38, 38)
234
        Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
235
        'ForeColor = Color.FromArgb(142, 152, 156)
236
        ForeColor = Color.White
237
        DoubleBuffered = True
238
        Size = New Size(75, 23)
239
    End Sub
240
241
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
242
        Dim B As New Bitmap(Width, Height)
243
        Dim G As Graphics = Graphics.FromImage(B)
244
245
        Const curve As Integer = 3
246
        Dim ClientRectangle = New Rectangle(0, 0, Width - 1, Height - 1)
247
248
        Dim d As New Draw()
249
        G.SmoothingMode = SmoothingMode.HighQuality
250
        'G.Clear(Color.FromArgb(20, 20, 20))
251
        'Dim bg As Color = Parent.FindForm.BackColor
252
        G.Clear(Color.FromArgb(42, 47, 49))
253
254
        Select Case State
255
            Case MouseState.None 'Mouse None
256
                G.FillPath(New SolidBrush(Color.FromArgb(32, 36, 38)), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
257
                Dim gloss As New LinearGradientBrush(New Rectangle(1, 1, Width - 5, Height / 2 - 3), Color.FromArgb(70, Color.White), Color.Transparent, 90S)
258
                G.FillPath(gloss, d.RoundRect(New Rectangle(0, 0, Width - 1, Height / 2 - 3), curve))
259
                Dim borderRect As New LinearGradientBrush(ClientRectangle, Color.FromArgb(36, 31, 43), Color.FromArgb(61, 65, 68), 90S)
260
                G.DrawPath(New Pen(Color.FromArgb(99, 103, 105)), d.RoundRect(New Rectangle(0, 1, Width - 1, Height - 3), curve))
261
                G.DrawPath(New Pen(borderRect), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
262
                G.DrawPath(New Pen(Color.FromArgb(27, 31, 33)), d.RoundRect(New Rectangle(1, 0, Width - 3, Height - 3), curve))
263
            Case MouseState.Over 'Mouse Hover
264
                G.FillPath(New SolidBrush(Color.FromArgb(32, 36, 38)), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
265
                Dim gloss As New LinearGradientBrush(New Rectangle(1, 1, Width - 5, Height / 2 - 3), Color.FromArgb(70, Color.White), Color.Transparent, 90S)
266
                G.FillPath(gloss, d.RoundRect(New Rectangle(0, 0, Width - 1, Height / 2 - 3), curve))
267
                Dim borderRect As New LinearGradientBrush(ClientRectangle, Color.FromArgb(36, 31, 43), Color.FromArgb(61, 65, 68), 90S)
268
                G.DrawPath(New Pen(Color.FromArgb(99, 103, 105)), d.RoundRect(New Rectangle(0, 1, Width - 1, Height - 3), curve))
269
                G.DrawPath(New Pen(Color.FromArgb(100, 99, 103, 105)), d.RoundRect(New Rectangle(2, 2, Width - 5, Height - 6), curve))
270
                G.DrawPath(New Pen(borderRect), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
271
                G.DrawPath(New Pen(Color.FromArgb(27, 31, 33)), d.RoundRect(New Rectangle(1, 0, Width - 3, Height - 3), curve))
272
                G.DrawPath(New Pen(Color.FromArgb(0, 186, 255)), d.RoundRect(New Rectangle(1, 1, Width - 3, Height - 4), curve))
273
            Case MouseState.Down 'Mouse Down
274
                G.FillPath(New SolidBrush(Color.FromArgb(32, 36, 38)), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
275
                Dim topGrad As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height / 2 - 1), Color.FromArgb(32, 36, 38), Color.FromArgb(57, 57, 57), 90S)
276
                G.FillPath(topGrad, d.RoundRect(New Rectangle(0, 0, Width - 1, Height / 2 + 1), curve))
277
                Dim botGrad As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height / 2 - 1), Color.FromArgb(57, 57, 57), Color.FromArgb(32, 36, 38), 90S)
278
                G.FillPath(botGrad, d.RoundRect(New Rectangle(0, Height / 2 - 1, Width - 1, Height / 2 + 2), curve))
279
                G.DrawLine(New Pen(Color.FromArgb(57, 57, 57)), 0, Convert.ToInt32(Height / 2 - 1), Width - 1, Convert.ToInt32(Height / 2 - 1))
280
281
                Dim borderRect As New LinearGradientBrush(ClientRectangle, Color.FromArgb(36, 31, 43), Color.FromArgb(61, 65, 68), 90S)
282
                G.DrawPath(New Pen(borderRect), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
283
                G.DrawPath(New Pen(Color.FromArgb(27, 31, 33)), d.RoundRect(New Rectangle(1, 0, Width - 3, Height - 3), curve))
284
285
        End Select
286
287
        'G.DrawRectangle(Pens.Black, ClientRectangle)
288
289
        'G.DrawString(Text, Font, Brushes.Black, New Rectangle(-1, -2, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
290
        G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(-1, -1, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
291
292
        e.Graphics.DrawImage(B.Clone(), 0, 0)
293
        G.Dispose() : B.Dispose()
294
    End Sub
295
End Class
296
297
Public Class BlackShadesNetTopButton : Inherits Control
298
#Region " Control Help - MouseState & Flicker Control"
299
300
    Private State As MouseState = MouseState.None
301
302
    Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
303
        MyBase.OnMouseEnter(e)
304
        State = MouseState.Over
305
        Invalidate()
306
    End Sub
307
    Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
308
        MyBase.OnMouseDown(e)
309
        State = MouseState.Down
310
        Invalidate()
311
    End Sub
312
    Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
313
        MyBase.OnMouseLeave(e)
314
        State = MouseState.None
315
        Invalidate()
316
    End Sub
317
    Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
318
        MyBase.OnMouseUp(e)
319
        State = MouseState.Over
320
        Invalidate()
321
    End Sub
322
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
323
    End Sub
324
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
325
        MyBase.OnTextChanged(e)
326
        Invalidate()
327
    End Sub
328
#End Region
329
330
    Sub New()
331
        MyBase.New()
332
        BackColor = Color.FromArgb(38, 38, 38)
333
        Font = New Font("Verdana", 8.25F)
334
        Size = New Size(15, 11)
335
        DoubleBuffered = True
336
        Focus()
337
    End Sub
338
339
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
340
        Dim B As New Bitmap(Width, Height)
341
        Dim G As Graphics = Graphics.FromImage(B)
342
        Dim d As New Draw()
343
344
        Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
345
346
        Size = New Size(15, 11)
347
        G.Clear(Color.FromArgb(49, 53, 55))
348
349
        Select Case State
350
            Case MouseState.None 'Mouse None
351
                Dim border As New LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 44, 47, 51), Color.FromArgb(80, 64, 69, 71), 90S)
352
                G.FillPath(border, d.RoundRect(ClientRectangle, 1))
353
                Dim bodyGrad As New LinearGradientBrush(New Rectangle(2, 2, Width - 6, Height - 6), Color.FromArgb(90, 97, 101), Color.FromArgb(63, 69, 73), 90S)
354
                G.FillPath(bodyGrad, d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
355
                G.DrawPath(New Pen(Color.FromArgb(30, 32, 35)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
356
            Case MouseState.Over
357
                Dim border As New LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 44, 47, 51), Color.FromArgb(80, 64, 69, 71), 90S)
358
                G.FillPath(border, d.RoundRect(ClientRectangle, 1))
359
                Dim bodyGrad As New LinearGradientBrush(New Rectangle(2, 2, Width - 6, Height - 6), Color.FromArgb(90, 97, 101), Color.FromArgb(63, 69, 73), 90S)
360
                G.FillPath(bodyGrad, d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
361
                G.DrawPath(New Pen(Color.FromArgb(30, 32, 35)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
362
                G.DrawPath(New Pen(Color.FromArgb(200, 0, 186, 255)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
363
            Case MouseState.Down
364
                Dim border As New LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 44, 47, 51), Color.FromArgb(80, 64, 69, 71), 90S)
365
                G.FillPath(border, d.RoundRect(ClientRectangle, 1))
366
                Dim bodyGrad As New LinearGradientBrush(New Rectangle(2, 2, Width - 6, Height - 6), Color.FromArgb(90, 97, 101), Color.FromArgb(63, 69, 73), 135S)
367
                G.FillPath(bodyGrad, d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
368
                G.DrawPath(New Pen(Color.FromArgb(30, 32, 35)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
369
        End Select
370
371
        e.Graphics.DrawImage(B.Clone(), 0, 0)
372
        G.Dispose() : B.Dispose()
373
    End Sub
374
End Class
375
376
Public Class BlackShadesNetMultiLineTextBox : Inherits Control
377
    Dim WithEvents txtbox As New TextBox
378
379
#Region " Control Help - Properties & Flicker Control "
380
    Private _maxchars As Integer = 32767
381
    Public Property MaxCharacters() As Integer
382
        Get
383
            Return _maxchars
384
        End Get
385
        Set(ByVal v As Integer)
386
            _maxchars = v
387
            Invalidate()
388
        End Set
389
    End Property
390
    Private _align As HorizontalAlignment
391
    Public Shadows Property TextAlignment() As HorizontalAlignment
392
        Get
393
            Return _align
394
        End Get
395
        Set(ByVal v As HorizontalAlignment)
396
            _align = v
397
            Invalidate()
398
        End Set
399
    End Property
400
401
402
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
403
    End Sub
404
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
405
        MyBase.OnTextChanged(e)
406
        Invalidate()
407
    End Sub
408
    Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
409
        MyBase.OnBackColorChanged(e)
410
        txtbox.BackColor = BackColor
411
        Invalidate()
412
    End Sub
413
    Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
414
        MyBase.OnForeColorChanged(e)
415
        txtbox.ForeColor = ForeColor
416
        Invalidate()
417
    End Sub
418
    Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
419
        MyBase.OnSizeChanged(e)
420
        txtbox.Size = New Size(Width - 10, Height - 11)
421
    End Sub
422
    Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
423
        MyBase.OnFontChanged(e)
424
        txtbox.Font = Font
425
    End Sub
426
    Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
427
        MyBase.OnGotFocus(e)
428
        txtbox.Focus()
429
    End Sub
430
    Sub TextChngTxtBox() Handles txtbox.TextChanged
431
        Text = txtbox.Text
432
    End Sub
433
    Sub TextChng() Handles MyBase.TextChanged
434
        txtbox.Text = Text
435
    End Sub
436
    Sub NewTextBox()
437
        With txtbox
438
            .Multiline = True
439
            .BackColor = BackColor
440
            .ForeColor = ForeColor
441
            .Text = String.Empty
442
            .TextAlign = HorizontalAlignment.Center
443
            .BorderStyle = BorderStyle.None
444
            .Location = New Point(3, 4)
445
            .Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
446
            .Size = New Size(Width - 10, Height - 10)
447
        End With
448
        txtbox.Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
449
    End Sub
450
#End Region
451
452
    Sub New()
453
        MyBase.New()
454
455
        NewTextBox()
456
        Controls.Add(txtbox)
457
458
        Text = ""
459
        BackColor = Color.FromArgb(36, 40, 42)
460
        ForeColor = Color.FromArgb(142, 152, 156)
461
        Size = New Size(135, 35)
462
        DoubleBuffered = True
463
    End Sub
464
465
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
466
        Dim B As New Bitmap(Width, Height)
467
        Dim G As Graphics = Graphics.FromImage(B)
468
        G.SmoothingMode = SmoothingMode.HighQuality
469
        Dim d As New Draw()
470
        Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
471
472
        txtbox.TextAlign = TextAlignment
473
474
        G.Clear(Color.FromArgb(36, 40, 42))
475
476
        G.FillRectangle(New SolidBrush(Color.FromArgb(36, 40, 42)), ClientRectangle)
477
        G.DrawRectangle(New Pen(Color.FromArgb(53, 57, 60)), ClientRectangle)
478
479
        e.Graphics.DrawImage(B.Clone(), 0, 0)
480
        G.Dispose() : B.Dispose()
481
    End Sub
482
End Class
483
484
Public Class BlackShadesNetTextBox : Inherits Control
485
    Dim WithEvents txtbox As New TextBox
486
487
#Region " Control Help - Properties & Flicker Control "
488
    Private _passmask As Boolean = False
489
    Public Shadows Property UseSystemPasswordChar() As Boolean
490
        Get
491
            Return _passmask
492
        End Get
493
        Set(ByVal v As Boolean)
494
            txtbox.UseSystemPasswordChar = UseSystemPasswordChar
495
            _passmask = v
496
            Invalidate()
497
        End Set
498
    End Property
499
    Private _maxchars As Integer = 32767
500
    Public Shadows Property MaxLength() As Integer
501
        Get
502
            Return _maxchars
503
        End Get
504
        Set(ByVal v As Integer)
505
            _maxchars = v
506
            txtbox.MaxLength = MaxLength
507
            Invalidate()
508
        End Set
509
    End Property
510
    Private _align As HorizontalAlignment
511
    Public Shadows Property TextAlignment() As HorizontalAlignment
512
        Get
513
            Return _align
514
        End Get
515
        Set(ByVal v As HorizontalAlignment)
516
            _align = v
517
            Invalidate()
518
        End Set
519
    End Property
520
521
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
522
    End Sub
523
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
524
        MyBase.OnTextChanged(e)
525
        Invalidate()
526
    End Sub
527
    Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
528
        MyBase.OnBackColorChanged(e)
529
        txtbox.BackColor = BackColor
530
        Invalidate()
531
    End Sub
532
    Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
533
        MyBase.OnForeColorChanged(e)
534
        txtbox.ForeColor = ForeColor
535
        Invalidate()
536
    End Sub
537
    Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
538
        MyBase.OnFontChanged(e)
539
        txtbox.Font = Font
540
    End Sub
541
    Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
542
        MyBase.OnGotFocus(e)
543
        txtbox.Focus()
544
    End Sub
545
    Sub TextChngTxtBox() Handles txtbox.TextChanged
546
        Text = txtbox.Text
547
    End Sub
548
    Sub TextChng() Handles MyBase.TextChanged
549
        txtbox.Text = Text
550
    End Sub
551
    Sub NewTextBox()
552
        With txtbox
553
            .Multiline = False
554
            .BackColor = Color.FromArgb(43, 43, 43)
555
            .ForeColor = ForeColor
556
            .Text = String.Empty
557
            .TextAlign = HorizontalAlignment.Center
558
            .BorderStyle = BorderStyle.None
559
            .Location = New Point(5, 4)
560
            .Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
561
            .Size = New Size(Width - 10, Height - 11)
562
            .UseSystemPasswordChar = UseSystemPasswordChar
563
        End With
564
565
    End Sub
566
#End Region
567
568
    Sub New()
569
        MyBase.New()
570
571
        NewTextBox()
572
        Controls.Add(txtbox)
573
574
        Text = ""
575
        BackColor = Color.FromArgb(36, 40, 42)
576
        ForeColor = Color.FromArgb(142, 152, 156)
577
        Size = New Size(135, 35)
578
        DoubleBuffered = True
579
    End Sub
580
581
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
582
        Dim B As New Bitmap(Width, Height)
583
        Dim G As Graphics = Graphics.FromImage(B)
584
        G.SmoothingMode = SmoothingMode.HighQuality
585
        Dim d As New Draw()
586
        Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
587
588
        Height = txtbox.Height + 11
589
        With txtbox
590
            .Width = Width - 10
591
            .TextAlign = TextAlignment
592
            .UseSystemPasswordChar = UseSystemPasswordChar
593
        End With
594
595
        G.Clear(Color.FromArgb(36, 40, 42))
596
597
        G.FillRectangle(New SolidBrush(Color.FromArgb(36, 40, 42)), ClientRectangle)
598
        G.DrawRectangle(New Pen(Color.FromArgb(53, 57, 60)), ClientRectangle)
599
600
        e.Graphics.DrawImage(B.Clone(), 0, 0)
601
        G.Dispose() : B.Dispose()
602
    End Sub
603
End Class
604
605
Public Class BlackShadesNetRichTextBox : Inherits Control
606
    Dim WithEvents txtbox As New RichTextBox
607
608
#Region " Control Help - Properties & Flicker Control "
609
610
611
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
612
    End Sub
613
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
614
        MyBase.OnTextChanged(e)
615
        Invalidate()
616
    End Sub
617
    Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
618
        MyBase.OnBackColorChanged(e)
619
        txtbox.BackColor = BackColor
620
        Invalidate()
621
    End Sub
622
    Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
623
        MyBase.OnForeColorChanged(e)
624
        txtbox.ForeColor = ForeColor
625
        Invalidate()
626
    End Sub
627
    Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
628
        MyBase.OnSizeChanged(e)
629
        txtbox.Size = New Size(Width - 10, Height - 11)
630
    End Sub
631
    Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
632
        MyBase.OnFontChanged(e)
633
        txtbox.Font = Font
634
    End Sub
635
    Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
636
        MyBase.OnGotFocus(e)
637
        txtbox.Focus()
638
    End Sub
639
    Sub TextChngTxtBox() Handles txtbox.TextChanged
640
        Text = txtbox.Text
641
    End Sub
642
    Sub TextChng() Handles MyBase.TextChanged
643
        txtbox.Text = Text
644
    End Sub
645
    Sub NewTextBox()
646
        With txtbox
647
            .Multiline = True
648
            .BackColor = BackColor
649
            .ForeColor = ForeColor
650
            .Text = String.Empty
651
            .BorderStyle = BorderStyle.None
652
            .Location = New Point(3, 4)
653
            .Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
654
            .Size = New Size(Width - 10, Height - 10)
655
        End With
656
        txtbox.Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
657
    End Sub
658
#End Region
659
660
    Sub New()
661
        MyBase.New()
662
663
        NewTextBox()
664
        Controls.Add(txtbox)
665
666
        Text = ""
667
        BackColor = Color.FromArgb(36, 40, 42)
668
        ForeColor = Color.FromArgb(142, 152, 156)
669
        Size = New Size(135, 35)
670
        DoubleBuffered = True
671
    End Sub
672
673
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
674
        Dim B As New Bitmap(Width, Height)
675
        Dim G As Graphics = Graphics.FromImage(B)
676
        G.SmoothingMode = SmoothingMode.HighQuality
677
        Dim d As New Draw()
678
        Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
679
680
        G.Clear(Color.FromArgb(36, 40, 42))
681
682
        G.DrawRectangle(New Pen(Color.FromArgb(30, 33, 35), 2), ClientRectangle)
683
        G.DrawLine(New Pen(Color.FromArgb(83, 90, 94)), Width - 1, 0, Width - 1, Height)
684
        G.DrawLine(New Pen(Color.FromArgb(83, 90, 94)), 0, Height - 1, Width - 1, Height - 1)
685
686
        e.Graphics.DrawImage(B.Clone(), 0, 0)
687
        G.Dispose() : B.Dispose()
688
    End Sub
689
End Class
690
691
<DefaultEvent("CheckedChanged")> Public Class BlackShadesNetCheckBox : Inherits Control
692
693
#Region " Control Help - MouseState & Flicker Control"
694
    Private State As MouseState = MouseState.None
695
    Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
696
        MyBase.OnMouseEnter(e)
697
        State = MouseState.Over
698
        Invalidate()
699
    End Sub
700
    Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
701
        MyBase.OnMouseDown(e)
702
        State = MouseState.Down
703
        Invalidate()
704
    End Sub
705
    Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
706
        MyBase.OnMouseLeave(e)
707
        State = MouseState.None
708
        Invalidate()
709
    End Sub
710
    Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
711
        MyBase.OnMouseUp(e)
712
        State = MouseState.Over
713
        Invalidate()
714
    End Sub
715
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
716
    End Sub
717
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
718
        MyBase.OnTextChanged(e)
719
        Invalidate()
720
    End Sub
721
    Private _Checked As Boolean
722
    Property Checked() As Boolean
723
        Get
724
            Return _Checked
725
        End Get
726
        Set(ByVal value As Boolean)
727
            _Checked = value
728
            Invalidate()
729
        End Set
730
    End Property
731
    Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
732
        MyBase.OnResize(e)
733
        Height = 14
734
    End Sub
735
    Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
736
        _Checked = Not _Checked
737
        RaiseEvent CheckedChanged(Me)
738
        MyBase.OnClick(e)
739
    End Sub
740
    Event CheckedChanged(ByVal sender As Object)
741
#End Region
742
743
    Sub New()
744
        MyBase.New()
745
        BackColor = Color.FromArgb(20, 20, 20)
746
        ForeColor = Color.White
747
        Size = New Size(145, 16)
748
    End Sub
749
750
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
751
        Dim B As New Bitmap(Width, Height)
752
        Dim G As Graphics = Graphics.FromImage(B)
753
        Dim d As New Draw()
754
755
        Dim checkBoxRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
756
757
        G.Clear(Color.FromArgb(42, 47, 49))
758
759
        Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(36, 40, 42), Color.FromArgb(64, 71, 74), 90S)
760
        G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
761
        G.DrawRectangle(New Pen(Color.FromArgb(42, 47, 49)), New Rectangle(1, 1, Height - 3, Height - 3))
762
        G.DrawRectangle(New Pen(Color.FromArgb(102, 108, 112)), checkBoxRectangle)
763
764
765
        If Checked Then
766
            Dim chkPoly As Rectangle = New Rectangle(checkBoxRectangle.X + checkBoxRectangle.Width / 4, checkBoxRectangle.Y + checkBoxRectangle.Height / 4, checkBoxRectangle.Width \ 2, checkBoxRectangle.Height \ 2)
767
            Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y + chkPoly.Height \ 2), _
768
                           New Point(chkPoly.X + chkPoly.Width \ 2, chkPoly.Y + chkPoly.Height), _
769
                           New Point(chkPoly.X + chkPoly.Width, chkPoly.Y)}
770
            G.SmoothingMode = SmoothingMode.HighQuality
771
            Dim P1 As New Pen(Color.FromArgb(250, 255, 255, 255), 2)
772
            Dim chkGrad As New LinearGradientBrush(chkPoly, Color.FromArgb(200, 200, 200), Color.FromArgb(255, 255, 255), 0S)
773
            For i = 0 To Poly.Length - 2
774
                G.DrawLine(P1, Poly(i), Poly(i + 1))
775
            Next
776
        End If
777
        G.DrawString(Text, Font, New SolidBrush(ForeColor), New Point(18, -1), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
778
779
        e.Graphics.DrawImage(B.Clone(), 0, 0)
780
        G.Dispose() : B.Dispose()
781
782
    End Sub
783
784
End Class
785
786
<DefaultEvent("CheckedChanged")> Public Class BlackShadesNetRadioButton : Inherits Control
787
788
#Region " Control Help - MouseState & Flicker Control"
789
    Private R1 As Rectangle
790
    Private G1 As LinearGradientBrush
791
792
    Private State As MouseState = MouseState.None
793
    Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
794
        MyBase.OnMouseEnter(e)
795
        State = MouseState.Over
796
        Invalidate()
797
    End Sub
798
    Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
799
        MyBase.OnMouseDown(e)
800
        State = MouseState.Down
801
        Invalidate()
802
    End Sub
803
    Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
804
        MyBase.OnMouseLeave(e)
805
        State = MouseState.None
806
        Invalidate()
807
    End Sub
808
    Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
809
        MyBase.OnMouseUp(e)
810
        State = MouseState.Over
811
        Invalidate()
812
    End Sub
813
    Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
814
        MyBase.OnResize(e)
815
        Height = 16
816
    End Sub
817
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
818
    End Sub
819
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
820
        MyBase.OnTextChanged(e)
821
        Invalidate()
822
    End Sub
823
    Private _Checked As Boolean
824
    Property Checked() As Boolean
825
        Get
826
            Return _Checked
827
        End Get
828
        Set(ByVal value As Boolean)
829
            _Checked = value
830
            InvalidateControls()
831
            RaiseEvent CheckedChanged(Me)
832
            Invalidate()
833
        End Set
834
    End Property
835
    Protected Overrides Sub OnClick(ByVal e As EventArgs)
836
        If Not _Checked Then Checked = True
837
        MyBase.OnClick(e)
838
    End Sub
839
    Event CheckedChanged(ByVal sender As Object)
840
    Protected Overrides Sub OnCreateControl()
841
        MyBase.OnCreateControl()
842
        InvalidateControls()
843
    End Sub
844
    Private Sub InvalidateControls()
845
        If Not IsHandleCreated OrElse Not _Checked Then Return
846
847
        For Each C As Control In Parent.Controls
848
            If C IsNot Me AndAlso TypeOf C Is BlackShadesNetRadioButton Then
849
                DirectCast(C, BlackShadesNetRadioButton).Checked = False
850
            End If
851
        Next
852
    End Sub
853
#End Region
854
855
    Sub New()
856
        MyBase.New()
857
        BackColor = Color.FromArgb(42, 47, 49)
858
        ForeColor = Color.White
859
        Size = New Size(150, 16)
860
    End Sub
861
862
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
863
        Dim B As New Bitmap(Width, Height)
864
        Dim G As Graphics = Graphics.FromImage(B)
865
        Dim d As New Draw()
866
        Dim radioBtnRectangle = New Rectangle(0, 0, Height - 1, Height - 1)
867
868
        G.SmoothingMode = SmoothingMode.HighQuality
869
        G.Clear(BackColor)
870
871
        Dim bgGrad As New LinearGradientBrush(radioBtnRectangle, Color.FromArgb(36, 40, 42), Color.FromArgb(66, 70, 72), 90S)
872
        G.FillEllipse(bgGrad, radioBtnRectangle)
873
874
        G.DrawEllipse(New Pen(Color.FromArgb(44, 48, 50)), New Rectangle(1, 1, Height - 3, Height - 3))
875
        G.DrawEllipse(New Pen(Color.FromArgb(102, 108, 112)), radioBtnRectangle)
876
877
        If Checked Then
878
            Dim chkGrad As New LinearGradientBrush(New Rectangle(4, 4, Height - 9, Height - 8), Color.White, Color.Black, 90S)
879
            G.FillEllipse(chkGrad, New Rectangle(4, 4, Height - 9, Height - 9))
880
        End If
881
882
        G.DrawString(Text, Font, Brushes.White, New Point(18, 0), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
883
884
        e.Graphics.DrawImage(B.Clone(), 0, 0)
885
        G.Dispose() : B.Dispose()
886
    End Sub
887
888
End Class
889
890
Public Class BlackShadesNetGroupBox : Inherits ContainerControl
891
#Region " Control Help - Properties & Flicker Control"
892
    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
893
    End Sub
894
    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
895
        MyBase.OnTextChanged(e)
896
        Invalidate()
897
    End Sub
898
#End Region
899
900
    Sub New()
901
        MyBase.New()
902
        BackColor = Color.FromArgb(33, 33, 33)
903
        Size = New Size(200, 100)
904
    End Sub
905
906
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
907
        Dim B As New Bitmap(Width, Height)
908
        Dim G As Graphics = Graphics.FromImage(B)
909
910
        G.SmoothingMode = SmoothingMode.HighSpeed
911
        Const curve As Integer = 3
912
        Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
913
        Dim TransparencyKey As Color = Me.ParentForm.TransparencyKey
914
        Dim d As New Draw()
915
        MyBase.OnPaint(e)
916
917
        G.Clear(Color.FromArgb(42, 47, 49))
918
919
920
921
        G.DrawPath(New Pen(Color.FromArgb(67, 75, 78)), d.RoundRect(New Rectangle(2, 7, Width - 5, Height - 9), curve))
922
        Dim outerBorder As New LinearGradientBrush(ClientRectangle, Color.FromArgb(30, 32, 32), Color.Transparent, 90S)
923
        G.DrawPath(New Pen(outerBorder), d.RoundRect(New Rectangle(1, 6, Width - 3, Height - 9), curve))
924
        Dim innerBorder As New LinearGradientBrush(New Rectangle(3, 7, Width - 7, Height - 10), Color.Transparent, Color.FromArgb(30, 32, 32), 90S)
925
        G.DrawPath(New Pen(innerBorder), d.RoundRect(New Rectangle(3, 7, Width - 7, Height - 10), curve))
926
927
        G.FillRectangle(New SolidBrush(Color.FromArgb(42, 47, 49)), New Rectangle(8, 0, Text.Length * 6, 11))
928
929
        G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(8, 0, Width - 1, 11), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
930
931
        e.Graphics.DrawImage(B.Clone(), 0, 0)
932
        G.Dispose() : B.Dispose()
933
    End Sub
934
End Class