-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBlue.vb
1280 lines (1058 loc) · 45.4 KB
/
Blue.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports System.ComponentModel, System.Drawing.Drawing2D, System.Windows.Forms
'----------------------------
'The Blue and White GUI Theme
'Creator: FuckFace
'Version: 1.0
'Created: 14/04/2014
'Changed: 26/04/2014
'----------------------------
Class BaWGUIButton : Inherits Control
#Region " Declarations "
Private State As Integer
Private Shape As GraphicsPath
Private InactiveGB, ActiveGB, ActiveContourGB, PressedGB, PressedContourGB As LinearGradientBrush
Private R1, R2 As Rectangle
Private P1, P2, P3, P4 As Pen
Private B1, B2, B3 As SolidBrush
Private CSF As StringFormat = New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}
#End Region
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
BackColor = Color.Transparent
DoubleBuffered = True
Font = New Font("Arial", 12)
Size = New Size(130, 45)
P1 = New Pen(Color.FromArgb(185, 185, 185))
' P2 is in the OnResize event.
' P3 is in the OnResize event.
P4 = New Pen(Color.FromArgb(135, 182, 233))
B1 = New SolidBrush(Color.FromArgb(114, 114, 114))
B2 = New SolidBrush(Color.FromArgb(246, 247, 250))
B3 = New SolidBrush(Color.FromArgb(25, 55, 82))
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
State = 2
Invalidate()
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
State = 1
Invalidate()
MyBase.OnMouseEnter(e)
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
State = 0
Invalidate()
MyBase.OnMouseLeave(e)
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
State = 1
Invalidate()
MyBase.OnMouseUp(e)
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
Invalidate() : MyBase.OnTextChanged(e)
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
If Width > 0 AndAlso Height > 0 Then
Shape = New GraphicsPath
R1 = New Rectangle(0, 0, Width, Height)
R2 = New Rectangle(0, 1, Width, Height)
InactiveGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(249, 249, 249) _
, Color.FromArgb(222, 222, 222), 90)
ActiveGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(171, 210, 244) _
, Color.FromArgb(84, 153, 228), 90)
ActiveContourGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(121, 180, 235) _
, Color.FromArgb(70, 137, 201), 90)
PressedGB = New LinearGradientBrush(New Rectangle(0, 1, Width, Height), Color.FromArgb(97, 162, 228) _
, Color.FromArgb(114, 173, 233), 90)
PressedContourGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(74, 141, 208) _
, Color.FromArgb(114, 173, 230), 90)
P2 = New Pen(ActiveContourGB)
P3 = New Pen(PressedContourGB)
With Shape
.AddArc(0, 0, 10, 10, 180, 90)
.AddArc(Width - 11, 0, 10, 10, -90, 90)
.AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
.AddArc(0, Height - 11, 10, 10, 90, 90)
.CloseAllFigures()
End With
End If
Invalidate()
MyBase.OnResize(e)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
Select Case State
Case 0 'Inactive
.FillPath(InactiveGB, Shape)
.DrawPath(P1, Shape)
.DrawString(Text, Font, B1, R1, CSF)
Case 1 'Active
.FillPath(ActiveGB, Shape)
.DrawPath(P2, Shape)
.DrawString(Text, Font, Brushes.DarkSlateGray, R2, CSF)
.DrawString(Text, Font, B2, R1, CSF)
Case 2 'Pressed
.FillPath(PressedGB, Shape)
.DrawPath(P3, Shape)
.DrawLine(P4, 1, 1, Width - 2, 1)
.DrawString(Text, Font, Brushes.White, R2, CSF)
.DrawString(Text, Font, B3, R1, CSF)
End Select
End With
MyBase.OnPaint(e)
End Sub
End Class
<DefaultEvent("CheckedChanged")> Public Class BaWGUICheckBox : Inherits Control
#Region " Declarations "
Private MFont As New Font("Marlett", 16)
Private Shape As GraphicsPath
Private GB As LinearGradientBrush
Private P1 As Pen
Private R1, R2 As Rectangle
Private B1, B2 As SolidBrush
Private CSF As StringFormat = New StringFormat() With {.LineAlignment = StringAlignment.Center}
Event CheckedChanged(ByVal sender As Object)
Private _Checked As Boolean
#End Region
#Region " Properties "
<Category("Appearance")> _
Property Checked As Boolean
Get
Return _Checked
End Get
Set(ByVal value As Boolean)
_Checked = value
RaiseEvent CheckedChanged(Me)
Invalidate()
End Set
End Property
#End Region
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
BackColor = Color.Transparent
DoubleBuffered = True
Font = New Font("Arial", 12)
Size = New Size(185, 26)
P1 = New Pen(Color.FromArgb(160, 160, 160))
B1 = New SolidBrush(Color.FromArgb(114, 114, 114))
B2 = New SolidBrush(Color.FromArgb(110, 175, 235))
End Sub
Protected Overrides Sub OnClick(ByVal e As EventArgs)
_Checked = Not _Checked
RaiseEvent CheckedChanged(Me)
Invalidate()
MyBase.OnClick(e)
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
Invalidate() : MyBase.OnTextChanged(e)
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
If Width > 0 AndAlso Height > 0 Then
Shape = New GraphicsPath
R1 = New Rectangle(30, 0, Width, Height)
R2 = New Rectangle(0, 0, Width, Height)
GB = New LinearGradientBrush(New Rectangle(0, 0, 25, 25), Color.FromArgb(244, 245, 244) _
, Color.FromArgb(227, 227, 227), 90)
With Shape
.AddArc(0, 0, 10, 10, 180, 90)
.AddArc(14, 0, 10, 10, -90, 90)
.AddArc(14, 14, 10, 10, 0, 90)
.AddArc(0, 14, 10, 10, 90, 90)
.CloseAllFigures()
End With
Height = 26
End If
Invalidate()
MyBase.OnResize(e)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
.FillPath(GB, Shape)
.DrawPath(P1, Shape)
.DrawString(Text, Font, B1, R1, CSF)
If Checked Then
.DrawString("a", MFont, B2, R2, CSF)
End If
End With
MyBase.OnPaint(e)
End Sub
End Class
Public Class BaWGUIComboBox : Inherits ComboBox
#Region " Declarations "
Private Side, Button, Arrow1, Arrow2 As GraphicsPath
Private SideGB, ButtonOGB, ButtonGB As LinearGradientBrush
Private R1 As Rectangle
Private P1, P2, P3, P4 As Pen
Private B1, B2, B3 As SolidBrush
Private CSF As StringFormat = New StringFormat() With {.LineAlignment = StringAlignment.Center}
Private _StartIndex As Integer = 0
#End Region
#Region " Properties "
Private Property StartIndex As Integer
Get
Return _StartIndex
End Get
Set(ByVal value As Integer)
_StartIndex = value
Try
MyBase.SelectedIndex = value
Catch
End Try
Invalidate()
End Set
End Property
#End Region
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
BackColor = Color.Transparent
DoubleBuffered = True
DrawMode = DrawMode.OwnerDrawFixed
DropDownStyle = ComboBoxStyle.DropDownList
Font = New Font("Arial", 12)
ForeColor = Color.Black
ItemHeight = 39
StartIndex = 0
P1 = New Pen(Color.FromArgb(180, 180, 180))
P3 = New Pen(Color.FromArgb(110, 170, 230))
P4 = New Pen(Color.FromArgb(50, 130, 215))
B1 = New SolidBrush(Color.FromArgb(100, 130, 160))
B2 = New SolidBrush(Color.FromArgb(114, 114, 114))
B3 = New SolidBrush(Color.FromArgb(246, 247, 250))
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
If Width > 0 AndAlso Height > 0 Then
Side = New GraphicsPath
Button = New GraphicsPath
Arrow1 = New GraphicsPath
Arrow2 = New GraphicsPath
ButtonOGB = New LinearGradientBrush(New Rectangle(Width - 51, 0, Width, Height), Color.FromArgb(125, 180, 235) _
, Color.FromArgb(45, 125, 200), 90)
ButtonGB = New LinearGradientBrush(New Rectangle(Width - 50, 0, Width, Height), Color.FromArgb(175, 215, 240) _
, Color.FromArgb(70, 145, 215), 90)
SideGB = New LinearGradientBrush(New Rectangle(0, 0, Width - 50, Height), Color.FromArgb(253, 253, 253) _
, Color.FromArgb(223, 223, 223), 90)
R1 = New Rectangle(12, 0, Width, Height)
P2 = New Pen(ButtonOGB)
With Side
.AddArc(0, 0, 10, 10, 180, 90)
.AddLine(Width - 50, 0, Width - 50, Height - 1)
.AddArc(0, Height - 11, 10, 10, 90, 90)
.CloseFigure()
End With
With Button
.AddLine(Width - 51, Height - 1, Width - 51, 0)
.AddArc(Width - 11, 0, 10, 10, -90, 90)
.AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
.CloseFigure()
End With
With Arrow1
.AddLine(Width - 35, 21, Width - 19, 21)
.AddLine(Width - 19, 21, Width - 27, 11)
.CloseFigure()
End With
With Arrow2
.AddLine(Width - 35, 26, Width - 19, 26)
.AddLine(Width - 19, 26, Width - 27, 36)
.CloseFigure()
End With
End If
Invalidate()
MyBase.OnResize(e)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
.FillPath(SideGB, Side)
.DrawPath(P1, Side)
.FillPath(ButtonGB, Button)
.DrawPath(P2, Button)
.FillPath(B1, Arrow1)
.FillPath(B1, Arrow2)
.DrawString(Text, Font, B2, R1, CSF)
End With
MyBase.OnPaint(e)
End Sub
Private Sub DrawItm(ByVal sender As Object, ByVal e As DrawItemEventArgs) Handles Me.DrawItem
If e.Index < 0 Then Exit Sub
e.DrawBackground()
Dim NormalGB As LinearGradientBrush = New LinearGradientBrush(e.Bounds, Color.FromArgb(251, 251, 251) _
, Color.FromArgb(237, 237, 237), 90)
Dim OverGB As LinearGradientBrush = New LinearGradientBrush(e.Bounds, Color.FromArgb(155, 200, 240) _
, Color.FromArgb(75, 144, 225), 90)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
.FillRectangle(OverGB, e.Bounds)
.DrawLine(P3, e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Y)
.DrawLine(P4, e.Bounds.X, e.Bounds.Y + 38, e.Bounds.Width - 1, e.Bounds.Y + 38)
.DrawString(Text, Font, Brushes.DarkSlateGray _
, New Rectangle(e.Bounds.X + 12, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), CSF)
.DrawString(Text, Font, B3, New Rectangle(e.Bounds.X + 12, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), CSF)
Else
.FillRectangle(NormalGB, e.Bounds)
.DrawLine(P1, e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Y)
.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), Font, B2 _
, New Rectangle(e.Bounds.X + 12, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), CSF)
End If
End With
End Sub
End Class
Public Class BaWGUIProgressBar : Inherits Control
#Region " Declarations "
Private OPath, IPath, Indicator As GraphicsPath
Private FillValue As Integer
Private OGB, IGB, IOGB, IndicatorGB As LinearGradientBrush
Private P1, P2, P3 As Pen
Private B1 As SolidBrush
Private TB As New TextureBrush(Image.FromStream(New System.IO.MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAACUElEQVQYGa3BwY1dVRBF0X2q6mExtWDgAQEQIDmRDzn0wBISYtL9771Vx/81CBNAr6Xffv9jbEAC8WRukrh5jBBgbiED5mYbSZjAFrf6/PlnelrDPyRhm5swIQMmUoREBk/GNjdJgBiER9QvX35in8E2Bsx30lDRRIiqoFJkBhFgG9uAwMEguqG+/vkX3WZsbgYskEQGXAlVyVVBVZApxCDANm2YgbPNOkN9/fuBARMYc5NERHBl8qmSa4pyED1IwzsZD3QPezVrN2dD8MFqzYVsJJ4aMaChqvgUw4/xRqoIJ27hEIOw4fSwz7B2s07TberNCTPIjQJSSWXRmXQFO0wTyMkgGDEjdg/7HHbD2uYcmDF1zmA30ASgK1AlUQWZWMHhyWIQbnHarDZ7iXXE2qJHYFGeg+YA5gpxKbhkYoaQcAxjwMKIGbHW4W1t9m5OmxnAxojgg1WvB4GpK0iJSpGCwPQsZgYIPGIs9mleXw9vj81pA8IGI5CoZbgqqUx0JY6iBWNjGww2jM3eh7Wa18dm78YWtgAB5laugAy4iongYGyBjQfaQfewT/NYzVrN3mYc2DwFQtwkU0FTAakBNzR0G9kMwZ7g7Obx2KxHs1bTBpRgnpqbAiJE8MHqh7hIBTHAiOHJ4BmOmz2wVvN4O+zddPMkYLB5FyEyxBWi3laxG0oCjLiJGTg9PPZh78M+5rTBAoTNO8nIphS0Tb28vBASGAKDzM0ztGEkZoYZY/Mv8Z25RYgMqF+/FE8WAyOk4D8ShLANBO8k/s9usAEDwzcn97xOZ2JTrwAAAABJRU5ErkJggg=="))), WrapMode.Tile)
Private _Value As Integer = 0
Private _Maximum As Integer = 100
#End Region
#Region " Properties "
<Category("Control")>
Public Property Maximum As Integer
Get
Return _Maximum
End Get
Set(ByVal value As Integer)
If value < _Value Then _Value = value
_Maximum = value
FillValue = CInt((_Value / _Maximum) * (Width - 50))
ChangePaths()
Invalidate()
End Set
End Property
<Category("Control")>
Public Property Value As Integer
Get
Select Case _Value
Case 0
Return 0
FillValue = CInt((_Value / _Maximum) * (Width - 50))
ChangePaths()
Invalidate()
Case Else
Return _Value
FillValue = CInt((_Value / _Maximum) * (Width - 50))
ChangePaths()
Invalidate()
End Select
End Get
Set(ByVal value As Integer)
If value > _Maximum Then value = _Maximum
_Value = value
FillValue = CInt((_Value / _Maximum) * (Width - 50))
ChangePaths()
Invalidate()
End Set
End Property
#End Region
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
BackColor = Color.Transparent
DoubleBuffered = True
Font = New Font("Arial", 16)
MinimumSize = New Size(60, 80)
TB.TranslateTransform(0, -5, MatrixOrder.Prepend)
P3 = New Pen(Color.FromArgb(190, 190, 190))
B1 = New SolidBrush(Color.FromArgb(84, 83, 81))
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
FillValue = CInt((_Value / _Maximum) * (Width - 50))
OPath = New GraphicsPath
With OPath
.AddArc(14, Height - 31, 20, 20, 180, 90)
.AddArc(Width - 44, Height - 31, 20, 20, -90, 90)
.AddArc(Width - 44, Height - 21, 20, 20, 0, 90)
.AddArc(14, Height - 21, 20, 20, 90, 90)
.CloseAllFigures()
End With
ChangePaths()
Height = 80
Invalidate()
MyBase.OnResize(e)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
Select Case _Value
Case 0
.FillPath(IGB, OPath)
.DrawPath(P1, OPath)
Case Else
.FillPath(IGB, OPath)
.DrawPath(P1, OPath)
.FillPath(TB, IPath)
.DrawPath(P2, IPath)
.FillPath(IndicatorGB, Indicator)
.DrawPath(P3, Indicator)
Select Case _Value
Case Is < 10
.DrawString(_Value & "%", Font, B1, FillValue + 6, 7)
Case Is < 100
.DrawString(_Value & "%", Font, B1, FillValue - 5, 7)
Case Else
.DrawString(_Value & "%", Font, B1, FillValue - 11, 7)
End Select
End Select
End With
MyBase.OnPaint(e)
End Sub
Private Sub ChangePaths()
If Width > 0 AndAlso Height > 0 Then
IPath = New GraphicsPath
Indicator = New GraphicsPath
OGB = New LinearGradientBrush(New Rectangle(Width - 44, Height - 31, 31, 31), Color.FromArgb(173, 173, 173) _
, Color.FromArgb(195, 195, 195), 90)
IGB = New LinearGradientBrush(New Rectangle(Width - 43, Height - 30, 30, 30), Color.FromArgb(201, 201, 201) _
, Color.FromArgb(225, 225, 225), 90)
IOGB = New LinearGradientBrush(New Rectangle(19, Height - 26, Width - 6, Height - 26) _
, Color.FromArgb(125, 175, 225), Color.FromArgb(55, 130, 205), -90)
IndicatorGB = New LinearGradientBrush(New Rectangle(FillValue - 11, 0, FillValue + 19, 45) _
, Color.FromArgb(232, 232, 232), Color.FromArgb(202, 202, 202), 90)
P1 = New Pen(OGB)
P2 = New Pen(IOGB)
If FillValue >= 13 Then
With IPath
.AddArc(19, Height - 26, 20, 20, 180, 90)
.AddArc(FillValue, Height - 26, 20, 20, -90, 90)
.AddArc(FillValue, Height - 26, 20, 20, 0, 90)
.AddArc(19, Height - 26, 20, 20, 90, 90)
End With
End If
With Indicator
.AddArc(FillValue - 11, 0, 8, 8, 180, 90)
.AddArc(FillValue + 40, 0, 8, 8, -90, 90)
.AddArc(FillValue + 40, 27, 8, 8, 0, 90)
.AddLine(FillValue + 24, 35, FillValue + 19, 45)
.AddLine(FillValue + 14, 35, FillValue - 3, 35)
.AddArc(FillValue - 11, 27, 8, 8, 90, 90)
.CloseFigure()
End With
End If
End Sub
Public Sub Increment(ByVal Amount As Integer)
Value += Amount
End Sub
End Class
<DefaultEvent("CheckedChanged")> Public Class BaWGUIRadioButton : Inherits Control
#Region " Declarations "
Private GB As LinearGradientBrush
Private R1 As Rectangle
Private P1 As Pen
Private B1, B2 As SolidBrush
Private CSF As StringFormat = New StringFormat() With {.LineAlignment = StringAlignment.Center}
Event CheckedChanged(ByVal sender As Object)
Private _Checked As Boolean
Private _Group As Integer = 1
#End Region
#Region " Properties "
<Category("Appearance")> _
Property Checked As Boolean
Get
Return _Checked
End Get
Set(ByVal value As Boolean)
_Checked = value
InvalidateControls()
RaiseEvent CheckedChanged(Me)
Invalidate()
End Set
End Property
<Category("Custom")> _
Property Group As Integer
Get
Return _Group
End Get
Set(ByVal value As Integer)
_Group = value
End Set
End Property
#End Region
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
BackColor = Color.Transparent
DoubleBuffered = True
Font = New Font("Arial", 12)
Size = New Size(200, 26)
P1 = New Pen(Color.FromArgb(160, 160, 160))
B1 = New SolidBrush(Color.FromArgb(114, 114, 114))
B2 = New SolidBrush(Color.FromArgb(95, 165, 230))
End Sub
Private Sub InvalidateControls()
If Not IsHandleCreated OrElse Not _Checked Then Return
For Each C As Control In Parent.Controls
If C IsNot Me AndAlso TypeOf C Is BaWGUIRadioButton AndAlso DirectCast(C, BaWGUIRadioButton).Group = _Group Then
DirectCast(C, BaWGUIRadioButton).Checked = False
End If
Next
End Sub
Protected Overrides Sub OnClick(ByVal e As EventArgs)
If Not _Checked Then Checked = True
MyBase.OnClick(e)
End Sub
Protected Overrides Sub OnCreateControl()
InvalidateControls()
MyBase.OnCreateControl()
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
Invalidate() : MyBase.OnTextChanged(e)
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
Height = 26
R1 = New Rectangle(30, 0, Width, Height)
GB = New LinearGradientBrush(New Rectangle(0, 0, 25, 25), Color.FromArgb(244, 245, 244) _
, Color.FromArgb(227, 227, 227), 90)
Invalidate()
MyBase.OnResize(e)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
.FillEllipse(GB, 0, 0, 25, 25)
.DrawEllipse(P1, 0, 0, 24, 24)
.DrawString(Text, Font, B1, R1, CSF)
If Checked Then
.FillEllipse(B2, 8, 8, 8, 8)
End If
End With
MyBase.OnPaint(e)
End Sub
End Class
<DefaultEvent("TextChanged")> Public Class BaWGUITextBox : Inherits Control
#Region " Declarations "
Private Side, Button As GraphicsPath
Private ButtonOGB, ButtonGB As LinearGradientBrush
Private P1, P2 As Pen
Private B1 As SolidBrush
Private WithEvents TBox As TextBox
Private _MaxLength As Integer = 32767
Private _ReadOnly As Boolean
Private _UseSystemPasswordChar As Boolean
Private _Multiline As Boolean
Private _Image As Image
#End Region
#Region " Properties "
<Category("Options")> _
Overrides Property Font As Font
Get
Return MyBase.Font
End Get
Set(ByVal value As Font)
MyBase.Font = value
If TBox IsNot Nothing Then
TBox.Font = value
TBox.Location = New Point(3, 5)
TBox.Width = Width - 6
If Not _Multiline Then
Height = TBox.Height + 11
End If
End If
End Set
End Property
<Category("Appearance")> _
Property Image As Image
Get
Return _Image
End Get
Set(ByVal value As Image)
_Image = value
End Set
End Property
<Category("Options")> _
Property MaxLength As Integer
Get
Return _MaxLength
End Get
Set(ByVal value As Integer)
_MaxLength = value
If TBox IsNot Nothing Then
TBox.MaxLength = value
End If
End Set
End Property
<Category("Options")> _
Property Multiline As Boolean
Get
Return _Multiline
End Get
Set(ByVal value As Boolean)
_Multiline = value
If TBox IsNot Nothing Then
TBox.Multiline = value
If value Then
TBox.Height = Height - 11
Else
Height = TBox.Height + 11
End If
End If
End Set
End Property
<Category("Options")> _
Property [ReadOnly] As Boolean
Get
Return _ReadOnly
End Get
Set(ByVal value As Boolean)
_ReadOnly = value
If TBox IsNot Nothing Then
TBox.ReadOnly = value
End If
End Set
End Property
<Category("Options")> _
Overrides Property Text As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
If TBox IsNot Nothing Then
TBox.Text = value
End If
End Set
End Property
<Category("Options")> _
Property UseSystemPasswordChar As Boolean
Get
Return _UseSystemPasswordChar
End Get
Set(ByVal value As Boolean)
_UseSystemPasswordChar = value
If TBox IsNot Nothing Then
TBox.UseSystemPasswordChar = value
End If
End Set
End Property
#End Region
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
BackColor = Color.Transparent
DoubleBuffered = True
Font = New Font("Arial", 16)
Size = New Size(125, 53)
TBox = New TextBox
With TBox
.BackColor = Color.FromArgb(245, 245, 245)
.BorderStyle = BorderStyle.None
.Cursor = Cursors.IBeam
.Font = Font
.ForeColor = Color.FromArgb(185, 185, 185)
.Height = Height - 11
.Location = New Point(5, 5)
.MaxLength = _MaxLength
.Multiline = _Multiline
.ReadOnly = _ReadOnly
.Text = Text
.UseSystemPasswordChar = _UseSystemPasswordChar
.Width = Width - 10
End With
P1 = New Pen(Color.FromArgb(180, 180, 180))
B1 = New SolidBrush(Color.FromArgb(245, 245, 245))
End Sub
Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs) Handles TBox.KeyDown
If e.Control AndAlso e.KeyCode = Keys.A Then
TBox.SelectAll()
e.SuppressKeyPress = True
End If
If e.Control AndAlso e.KeyCode = Keys.C Then
TBox.Copy()
e.SuppressKeyPress = True
End If
End Sub
Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs) Handles TBox.TextChanged
Text = TBox.Text
End Sub
Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
If Not Controls.Contains(TBox) Then
Controls.Add(TBox)
End If
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
If Width > 0 AndAlso Height > 0 Then
If Controls.Contains(TBox) AndAlso Not _Multiline AndAlso _Image IsNot Nothing Then
TBox.Location = New Point(20, 14)
TBox.Width = Width - 81
Height = 53
ElseIf Controls.Contains(TBox) AndAlso _Multiline Then
TBox.Location = New Point(5, 5)
TBox.Width = Width - 10
TBox.Height = Height - 11
ElseIf Controls.Contains(TBox) AndAlso Not _Multiline Then
TBox.Location = New Point(5, 5)
TBox.Width = Width - 10
TBox.Height = Height - 11
Height = 53
End If
Side = New GraphicsPath
Button = New GraphicsPath
ButtonOGB = New LinearGradientBrush(New Rectangle(Width - 51, 0, Width, Height), Color.FromArgb(125, 180, 235) _
, Color.FromArgb(45, 125, 200), 90)
ButtonGB = New LinearGradientBrush(New Rectangle(Width - 50, 0, Width, Height), Color.FromArgb(175, 215, 240) _
, Color.FromArgb(70, 145, 215), 90)
P2 = New Pen(ButtonOGB)
With Side
.AddArc(0, 0, 10, 10, 180, 90)
.AddArc(Width - 11, 0, 10, 10, -90, 90)
.AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
.AddArc(0, Height - 11, 10, 10, 90, 90)
.CloseFigure()
End With
With Button
.AddLine(Width - 51, Height - 1, Width - 51, 0)
.AddArc(Width - 11, 0, 10, 10, -90, 90)
.AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
.CloseFigure()
End With
End If
Invalidate()
MyBase.OnResize(e)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
.FillPath(B1, Side)
.DrawPath(P1, Side)
If Not _Multiline AndAlso _Image IsNot Nothing Then
.FillPath(ButtonGB, Button)
.DrawPath(P2, Button)
.DrawImage(_Image, Width - 42, 11, 32, 32)
End If
End With
MyBase.OnPaint(e)
End Sub
End Class
Class BaWGUIThemeContainer : Inherits ContainerControl
#Region " Declarations "
Private OverCls, OverMax, OverMin As Boolean
Private XF, PF, MF As Font
Private Base, Header As GraphicsPath
Private BaseGB, HeaderGB, HeaderOutlineGB, ButtonOuterGB, ButtonInnerGB, ButtonOInnerGB As LinearGradientBrush
Private R1, R2 As Rectangle
Private P1, P2, P3 As Pen
Private B1, B2, B3 As SolidBrush
Private CSF As StringFormat = New StringFormat() With {.Alignment = StringAlignment.Center}
Private _DrawButtonStrings As Boolean = True
#End Region
#Region " Properties "
<Category("Drawing")> _
Property DrawButtonStrings As Boolean
Get
Return _DrawButtonStrings
End Get
Set(ByVal value As Boolean)
_DrawButtonStrings = value
End Set
End Property
#End Region
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
BackColor = Color.White
Dock = DockStyle.Fill
DoubleBuffered = True
Font = New Font("Arial", 12, FontStyle.Bold)
XF = New Font("Tahoma", 12)
PF = New Font("Arial", 16)
MF = New Font("Arial", 20)
P1 = New Pen(Color.FromArgb(128, 128, 128))
' P2 is in the OnSizeChanged event.
P3 = New Pen(Color.FromArgb(180, 217, 246))
B1 = New SolidBrush(Color.FromArgb(58, 118, 181))
B2 = New SolidBrush(Color.FromArgb(71, 132, 191))
B3 = New SolidBrush(Color.FromArgb(128, 0, 0, 0))
End Sub
Protected Overrides Sub CreateHandle()
FindForm.FormBorderStyle = FormBorderStyle.None
If FindForm.TransparencyKey = Nothing Then FindForm.TransparencyKey = Color.Fuchsia
MyBase.CreateHandle()
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
If e.Button = MouseButtons.Left Then
If OverMin Then
FindForm.WindowState = FormWindowState.Minimized
ElseIf OverMax Then
If FindForm.WindowState = FormWindowState.Maximized Then FindForm.WindowState = FormWindowState.Normal _
Else FindForm.WindowState = FormWindowState.Maximized
ElseIf OverCls Then
FindForm.Close()
Else
If New Rectangle(FindForm.Location.X, FindForm.Location.Y, Width, 50).IntersectsWith(New Rectangle(MousePosition.X, MousePosition.Y, 1, 1)) AndAlso _
Not FindForm.WindowState = FormWindowState.Maximized Then
Capture = False
Dim M As Message = Message.Create(FindForm.Handle, 161, New IntPtr(2), IntPtr.Zero)
DefWndProc(M)
End If
End If
End If
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
If e.Location.X >= 33 AndAlso e.Location.Y >= 19 AndAlso e.Location.X <= 120 AndAlso e.Location.Y <= 37 Then
If e.Location.X >= 33 AndAlso e.Location.X <= 51 Then
OverCls = True : Invalidate()
Else
OverCls = False : Invalidate()
End If
If e.Location.X >= 104 Then
OverMax = True : Invalidate()
Else
OverMax = False : Invalidate()
End If
If e.Location.X >= 68 AndAlso e.Location.X <= 86 Then
OverMin = True : Invalidate()
Else
OverMin = False : Invalidate()
End If
Else
OverMin = False : OverMax = False : OverCls = False
Invalidate()
End If
MyBase.OnMouseMove(e)
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
Invalidate() : MyBase.OnTextChanged(e)
End Sub
Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
If Width > 0 AndAlso Height > 0 Then
Base = New GraphicsPath
Header = New GraphicsPath
R1 = New Rectangle(-1, CInt((50 - Font.Size) / 2 - 1), Width, Height)
R2 = New Rectangle(0, CInt((50 - Font.Size) / 2 - 2), Width, Height)
BaseGB = New LinearGradientBrush(New Rectangle(0, 50, Width, Height) _
, Color.FromArgb(236, 236, 236), Color.FromArgb(232, 232, 232), 90)