-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgressBar.ctl
More file actions
1064 lines (873 loc) · 29.7 KB
/
ProgressBar.ctl
File metadata and controls
1064 lines (873 loc) · 29.7 KB
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
VERSION 5.00
Begin VB.UserControl ProgressBar
AutoRedraw = -1 'True
ClientHeight = 300
ClientLeft = 0
ClientTop = 0
ClientWidth = 4425
ScaleHeight = 20
ScaleMode = 3 'Pixel
ScaleWidth = 295
ToolboxBitmap = "ProgressBar.ctx":0000
End
Attribute VB_Name = "ProgressBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public Enum U_TextAlignments
[Left Top] = 1
[Left Middle] = 2
[Left Bottom] = 3
[Center Top] = 4
[Center Middle] = 5
[Center Bottom] = 6
[Right Top] = 7
[Right Middle] = 8
[Right Bottom] = 9
End Enum
Public Enum U_TextEffects
[Normal] = 1
[Embossed] = 2
[Engraved] = 3
[Outline] = 4
[Shadow] = 5
End Enum
Public Enum U_OrientationsS
[Horizontal] = 1
[Vertical] = 2
End Enum
Public Enum U_TextStyles
[PBValue] = 1
[PBPercentage] = 2
[CustomText] = 3
[PBNoneText] = 4
End Enum
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors As RGBQUAD
End Type
Private Type cRGB
Blue As Byte
Green As Byte
Red As Byte
End Type
Enum U_Themes
[IceOrange] = 1
[IceYellow] = 2
[IceGreen] = 3
[IceCyan] = 4
[IceBangel] = 5
[IcePurple] = 6
[IceRed] = 7
[IceBlue] = 8
[Vista] = 9
[Custome] = 10
End Enum
Private Type GRADIENT_RECT
UpperLeft As Long
LowerRight As Long
End Type
Public Enum GRADIENT_DIRECT
[Left to Right] = &H0
[Top to Bottom] = &H1
End Enum
Private Type TRIVERTEX
X As Long
Y As Long
Red As Integer
Green As Integer
Blue As Integer
ALPHA As Integer
End Type
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function RoundRect Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetDIBitsToDevice Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, ByVal NumScans As Long, Bits As Any, BitsInfo As BITMAPINFO, ByVal wUsage As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Private Declare Function GradientFillRect Lib "msimg32" Alias "GradientFill" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Const GRADIENT_FILL_RECT_H As Long = &H0
Const GRADIENT_FILL_RECT_V As Long = &H1
Private Const BI_RGB = 0&
Private Const DIB_RGB_COLORS = 0
Private U_TextStyle As U_TextStyles
Private U_Theme As U_Themes
Private U_Orientation As U_OrientationsS
Private U_Text As String
Private U_TextColor As OLE_COLOR
Private U_TextAlign As U_TextAlignments
Private U_TextFont As Font
Private U_TextEC As OLE_COLOR
Private U_TextEffect As U_TextEffects
Private U_RoundV As Long
Private U_Min As Long
Private U_Value As Long
Private U_Max As Long
Private U_Enabled As Boolean
Private C(16) As Long
Private U_PBSCC1 As OLE_COLOR
Private U_PBSCC2 As OLE_COLOR
Private Sub UserControl_Resize()
Bar_Draw
End Sub
Public Property Let value(ByVal newValue As Long)
Attribute value.VB_Description = "Progressbar Value."
If newValue > U_Max Then newValue = U_Max
If newValue < U_Min Then newValue = U_Min
U_Value = newValue
PropertyChanged "Value"
Bar_Draw
End Property
Public Property Get value() As Long
value = U_Value
End Property
Public Property Let Max(ByVal newValue As Long)
Attribute Max.VB_Description = "Progressbar Max Value."
If newValue < 1 Then newValue = 1
If newValue <= U_Min Then newValue = U_Min + 1
U_Max = newValue
If value > U_Max Then value = U_Max
PropertyChanged "Max"
Bar_Draw
End Property
Public Property Get Max() As Long
Max = U_Max
End Property
Public Property Let Min(ByVal newValue As Long)
Attribute Min.VB_Description = "Progressbar Min Value."
If newValue >= U_Max Then newValue = Max - 1
If newValue < 0 Then newValue = 0
U_Min = newValue
If value < U_Min Then value = U_Min
PropertyChanged "Min"
Bar_Draw
End Property
Public Property Get Min() As Long
Min = U_Min
End Property
Public Property Get RoundedValue() As Long
Attribute RoundedValue.VB_Description = "Progressbar Rounded Corner Value."
RoundedValue = U_RoundV
End Property
Public Property Let RoundedValue(ByVal newValue As Long)
U_RoundV = newValue
PropertyChanged "RoundedValue"
Bar_Draw
End Property
Public Property Get Enabled() As Boolean
Attribute Enabled.VB_Description = "Progressbar Enabled/Disabled."
Enabled = U_Enabled
End Property
Public Property Let Enabled(ByVal newValue As Boolean)
U_Enabled = newValue
PropertyChanged "Enabled"
Bar_Draw
End Property
Private Sub UserControl_InitProperties()
Max = 100
Min = 0
value = 50
RoundedValue = 5
Enabled = True
Theme = 1
TextForeColor = vbBlack
Text = "U11D ProgressBar"
TextAlignment = [Center Middle]
TextEffect = Shadow
TextEffectColor = vbWhite
TextStyle = CustomText
Orientations = Horizontal
Set TextFont = Ambient.Font
End Sub
Public Property Let Theme(ByVal newValue As U_Themes)
Attribute Theme.VB_Description = "Progressbar Styles."
U_Theme = newValue
PropertyChanged "Theme"
Bar_Draw
End Property
Public Property Get Theme() As U_Themes
Theme = U_Theme
End Property
Public Property Let TextStyle(ByVal newValue As U_TextStyles)
Attribute TextStyle.VB_Description = "Progressbar Text Style."
U_TextStyle = newValue
PropertyChanged "TextStyle"
Bar_Draw
End Property
Public Property Get TextStyle() As U_TextStyles
TextStyle = U_TextStyle
End Property
Public Property Get Orientations() As U_OrientationsS
Orientations = U_Orientation
End Property
Public Property Let Orientations(ByVal newValue As U_OrientationsS)
U_Orientation = newValue
PropertyChanged "Orientations"
Bar_Draw
End Property
Public Property Get TextAlignment() As U_TextAlignments
Attribute TextAlignment.VB_Description = "Progressbar Text Alignment."
TextAlignment = U_TextAlign
End Property
Public Property Let TextAlignment(ByVal newValue As U_TextAlignments)
U_TextAlign = newValue
PropertyChanged "TextAlignment"
Bar_Draw
End Property
Public Property Get Text() As String
Attribute Text.VB_Description = "Progressbar Text."
Text = U_Text
End Property
Public Property Let Text(ByVal newValue As String)
U_Text = newValue
PropertyChanged "Text"
Bar_Draw
End Property
Public Property Get TextEffectColor() As OLE_COLOR
Attribute TextEffectColor.VB_Description = "Progressbar Text Effect Color."
TextEffectColor = U_TextEC
End Property
Public Property Let TextEffectColor(ByVal newValue As OLE_COLOR)
U_TextEC = newValue
PropertyChanged "TextEffectColor"
Bar_Draw
End Property
Public Property Get TextEffect() As U_TextEffects
Attribute TextEffect.VB_Description = "Progressbar Text Effect."
TextEffect = U_TextEffect
End Property
Public Property Let TextEffect(ByVal newValue As U_TextEffects)
U_TextEffect = newValue
PropertyChanged "TextEffect"
Bar_Draw
End Property
Public Property Get TextForeColor() As OLE_COLOR
Attribute TextForeColor.VB_Description = "Progressbar Text Color."
TextForeColor = U_TextColor
End Property
Public Property Let TextForeColor(ByVal newValue As OLE_COLOR)
U_TextColor = newValue
PropertyChanged "TextForeColor"
Bar_Draw
End Property
Public Property Get TextFont() As Font
Attribute TextFont.VB_Description = "Progressbar Text Font."
Set TextFont = U_TextFont
End Property
Public Property Set TextFont(ByVal newValue As Font)
Set U_TextFont = newValue
Set UserControl.Font = newValue
PropertyChanged "TextFont"
Bar_Draw
End Property
Public Property Get PBSCustomeColor1() As OLE_COLOR
Attribute PBSCustomeColor1.VB_Description = "Progressbar Style Custome Color 1."
PBSCustomeColor1 = U_PBSCC1
End Property
Public Property Let PBSCustomeColor1(ByVal newValue As OLE_COLOR)
U_PBSCC1 = newValue
PropertyChanged "PBSCustomeColor1"
Bar_Draw
End Property
Public Property Get PBSCustomeColor2() As OLE_COLOR
Attribute PBSCustomeColor2.VB_Description = "Progressbar Style Custome Color 2."
PBSCustomeColor2 = U_PBSCC2
End Property
Public Property Let PBSCustomeColor2(ByVal newValue As OLE_COLOR)
U_PBSCC2 = newValue
PropertyChanged "PBSCustomeColor2"
Bar_Draw
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
On Error Resume Next
With PropBag
Max = .ReadProperty("Max", 100)
Min = .ReadProperty("Min", 0)
value = .ReadProperty("Value", 50)
RoundedValue = .ReadProperty("RoundedValue", 5)
Enabled = .ReadProperty("Enabled", True)
Theme = .ReadProperty("Theme", 1)
TextStyle = .ReadProperty("TextStyle", 1)
Orientations = .ReadProperty("Orientations", Horizontal)
Text = .ReadProperty("Text", Ambient.DisplayName)
TextEffectColor = .ReadProperty("TextEffectColor", RGB(200, 200, 200))
TextEffect = .ReadProperty("TextEffect", 1)
TextAlignment = .ReadProperty("TextAlignment", 5)
Set TextFont = .ReadProperty("TextFont", Ambient.Font)
TextForeColor = .ReadProperty("TextForeColor", 0)
PBSCustomeColor2 = .ReadProperty("PBSCustomeColor2", vbBlack)
PBSCustomeColor1 = .ReadProperty("PBSCustomeColor1", vbBlack)
End With
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
With PropBag
.WriteProperty "Orientations", U_Orientation, Horizontal
.WriteProperty "Max", U_Max, 100
.WriteProperty "Min", U_Min, 0
.WriteProperty "Value", U_Value, 50
.WriteProperty "RoundedValue", U_RoundV, 5
.WriteProperty "Enabled", U_Enabled, True
.WriteProperty "Theme", U_Theme, 1
.WriteProperty "TextStyle", U_TextStyle, 1
.WriteProperty "TextFont", U_TextFont, Ambient.Font
.WriteProperty "TextForeColor", U_TextColor, vbBlack
.WriteProperty "TextAlignment", U_TextAlign, 5
.WriteProperty "Text", U_Text, ""
.WriteProperty "TextEffectColor", U_TextEC, RGB(200, 200, 200)
.WriteProperty "TextEffect", U_TextEffect, 1
.WriteProperty "PBSCustomeColor2", U_PBSCC2, vbBlack
.WriteProperty "PBSCustomeColor1", U_PBSCC1, vbBlack
End With
End Sub
Private Sub Bar_Draw()
On Error Resume Next
Dim I, S, z, Y, q As Long
Dim U_LRECT As Long
U_LRECT = CreateRoundRectRgn(0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight, U_RoundV, U_RoundV)
SetWindowRgn UserControl.hWnd, U_LRECT, True
I = U_Max: S = U_Value: z = U_Max
Y = (S * 100 / z)
q = (Y * UserControl.ScaleWidth / 100)
If Orientations = Vertical Then q = (Y * UserControl.ScaleHeight / 100)
CheckTheme
If Enabled = False Then
Dim II As Byte
For II = 0 To 16
C(II) = ColourTOGray(C(II))
Next II
End If
UserControl.Cls
If U_Orientation = Horizontal Then
GradientTwoColour UserControl.hdc, [Top to Bottom], C(0), C(2), 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight / 2
GradientTwoColour UserControl.hdc, [Top to Bottom], C(4), C(6), 0, UserControl.ScaleHeight / 2, UserControl.ScaleWidth, UserControl.ScaleHeight
'DrawGradientFourColour UserControl.hDC, 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight / 2, c(0), c(1), c(2), c(3)
'DrawGradientFourColour UserControl.hDC, 0, UserControl.ScaleHeight / 2, UserControl.ScaleWidth, UserControl.ScaleHeight / 2 - 1, c(4), c(5), c(6), c(7)
If value >= 1 Then
GradientTwoColour UserControl.hdc, [Top to Bottom], C(8), C(10), 0, 0, q, UserControl.ScaleHeight / 2
GradientTwoColour UserControl.hdc, [Top to Bottom], C(12), C(14), 0, UserControl.ScaleHeight / 2, q, UserControl.ScaleHeight
'DrawGradientFourColour UserControl.hDC, 0, 0, q, UserControl.ScaleHeight / 2, c(8), c(9), c(10), c(11)
'DrawGradientFourColour UserControl.hDC, 0, UserControl.ScaleHeight / 2, q, UserControl.ScaleHeight / 2 - 1, c(12), c(13), c(14), c(15)
End If
ElseIf U_Orientation = Vertical Then
GradientTwoColour UserControl.hdc, [Left to Right], C(0), C(2), 0, 0, UserControl.ScaleWidth / 2, UserControl.ScaleHeight
GradientTwoColour UserControl.hdc, [Left to Right], C(4), C(6), UserControl.ScaleWidth / 2, 0, UserControl.ScaleWidth, UserControl.ScaleHeight
'DrawGradientFourColour UserControl.hDC, 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight / 2, c(0), c(1), c(2), c(3)
'DrawGradientFourColour UserControl.hDC, 0, UserControl.ScaleHeight / 2, UserControl.ScaleWidth, UserControl.ScaleHeight / 2 - 1, c(4), c(5), c(6), c(7)
If value >= 1 Then
GradientTwoColour UserControl.hdc, [Left to Right], C(8), C(10), 0, 0, UserControl.ScaleWidth / 2, q
GradientTwoColour UserControl.hdc, [Left to Right], C(12), C(14), UserControl.ScaleWidth / 2, 0, UserControl.ScaleWidth, q
'DrawGradientFourColour UserControl.hDC, 0, 0, q, UserControl.ScaleHeight / 2, c(8), c(9), c(10), c(11)
'DrawGradientFourColour UserControl.hDC, 0, UserControl.ScaleHeight / 2, q, UserControl.ScaleHeight / 2 - 1, c(12), c(13), c(14), c(15)
End If
End If
UserControl.ForeColor = C(16)
RoundRect UserControl.hdc, 0, 0, UserControl.ScaleWidth - 1, UserControl.ScaleHeight - 1, U_RoundV, U_RoundV
If TextStyle = PBValue Then
DrawCaptionText value, U_TextAlign
ElseIf TextStyle = PBPercentage Then
DrawCaptionText Y & "%", U_TextAlign
ElseIf TextStyle = CustomText Then
DrawCaptionText U_Text, U_TextAlign
ElseIf TextStyle = PBNoneText Then
End If
End Sub
Private Sub CheckTheme()
If Theme = 1 Then
'BACK
C(0) = RGB(248, 246, 242)
C(1) = RGB(248, 246, 242)
C(2) = RGB(233, 227, 211)
C(3) = RGB(233, 227, 211)
'\
C(4) = RGB(226, 215, 182)
C(5) = RGB(226, 215, 182)
C(6) = RGB(239, 233, 215)
C(7) = RGB(239, 233, 215)
'FRONT
C(8) = RGB(251, 244, 223)
C(9) = RGB(251, 244, 223)
C(10) = RGB(239, 213, 133)
C(11) = RGB(239, 213, 133)
'\
C(12) = RGB(203, 166, 57)
C(13) = RGB(203, 166, 57)
C(14) = RGB(237, 224, 187)
C(15) = RGB(237, 224, 187)
'FORE COLOUR
C(16) = RGB(204, 168, 62)
ElseIf Theme = 2 Then
'BACK
C(0) = RGB(247, 248, 242)
C(1) = RGB(247, 248, 242)
C(2) = RGB(231, 233, 211)
C(3) = RGB(231, 233, 211)
'\
C(4) = RGB(222, 226, 182)
C(5) = RGB(222, 226, 182)
C(6) = RGB(237, 239, 215)
C(7) = RGB(237, 239, 215)
'FRONT
C(8) = RGB(249, 251, 223)
C(9) = RGB(249, 251, 223)
C(10) = RGB(230, 239, 133)
C(11) = RGB(230, 239, 133)
'\
C(12) = RGB(190, 203, 57)
C(13) = RGB(190, 203, 57)
C(14) = RGB(233, 237, 187)
C(15) = RGB(233, 237, 187)
'FORE COLOUR
C(16) = RGB(192, 204, 62)
ElseIf Theme = 3 Then
'BACK
C(0) = RGB(242, 248, 243)
C(1) = RGB(242, 248, 243)
C(2) = RGB(211, 233, 213)
C(3) = RGB(211, 233, 213)
'\
C(4) = RGB(182, 226, 186)
C(5) = RGB(182, 226, 186)
C(6) = RGB(215, 239, 217)
C(7) = RGB(215, 239, 217)
'FRONT
C(8) = RGB(223, 251, 225)
C(9) = RGB(223, 251, 225)
C(10) = RGB(133, 239, 142)
C(11) = RGB(133, 239, 142)
'\
C(12) = RGB(57, 203, 70)
C(13) = RGB(57, 203, 70)
C(14) = RGB(187, 237, 191)
C(15) = RGB(187, 237, 191)
'FORE COLOUR
C(16) = RGB(62, 204, 74)
ElseIf Theme = 4 Then
'BACK
C(0) = RGB(242, 248, 247)
C(1) = RGB(242, 248, 247)
C(2) = RGB(211, 233, 231)
C(3) = RGB(211, 233, 231)
'\
C(4) = RGB(182, 226, 222)
C(5) = RGB(182, 226, 222)
C(6) = RGB(215, 239, 237)
C(7) = RGB(215, 239, 237)
'FRONT
C(8) = RGB(223, 251, 249)
C(9) = RGB(223, 251, 249)
C(10) = RGB(133, 239, 230)
C(11) = RGB(133, 239, 230)
'\
C(12) = RGB(57, 203, 190)
C(13) = RGB(57, 203, 190)
C(14) = RGB(187, 237, 233)
C(15) = RGB(187, 237, 233)
'FORE COLOUR
C(16) = RGB(62, 204, 192)
ElseIf Theme = 5 Then
'BACK
C(0) = RGB(243, 242, 248)
C(1) = RGB(243, 242, 248)
C(2) = RGB(213, 211, 233)
C(3) = RGB(213, 211, 233)
'\
C(4) = RGB(186, 182, 226)
C(5) = RGB(186, 182, 226)
C(6) = RGB(217, 215, 239)
C(7) = RGB(217, 215, 239)
'FRONT
C(8) = RGB(225, 223, 251)
C(9) = RGB(225, 223, 251)
C(10) = RGB(142, 133, 239)
C(11) = RGB(142, 133, 239)
'\
C(12) = RGB(70, 57, 203)
C(13) = RGB(70, 57, 203)
C(14) = RGB(191, 187, 237)
C(15) = RGB(191, 187, 237)
'FORE COLOUR
C(16) = RGB(74, 62, 204)
ElseIf Theme = 6 Then
'BACK
C(0) = RGB(248, 242, 247)
C(1) = RGB(248, 242, 247)
C(2) = RGB(233, 211, 231)
C(3) = RGB(233, 211, 231)
'\
C(4) = RGB(226, 182, 222)
C(5) = RGB(226, 182, 222)
C(6) = RGB(239, 215, 237)
C(7) = RGB(239, 215, 237)
'FRONT
C(8) = RGB(251, 223, 249)
C(9) = RGB(251, 223, 249)
C(10) = RGB(239, 133, 230)
C(11) = RGB(239, 133, 230)
'\
C(12) = RGB(203, 57, 190)
C(13) = RGB(203, 57, 190)
C(14) = RGB(237, 187, 233)
C(15) = RGB(237, 187, 233)
'FORE COLOUR
C(16) = RGB(204, 62, 192)
ElseIf Theme = 7 Then
'BACK
C(0) = RGB(248, 242, 242)
C(1) = RGB(248, 242, 242)
C(2) = RGB(233, 211, 211)
C(3) = RGB(233, 211, 211)
'\
C(4) = RGB(226, 182, 182)
C(5) = RGB(226, 182, 182)
C(6) = RGB(239, 215, 215)
C(7) = RGB(239, 215, 215)
'FRONT
C(8) = RGB(251, 223, 223)
C(9) = RGB(251, 223, 223)
C(10) = RGB(239, 133, 133)
C(11) = RGB(239, 133, 133)
'\
C(12) = RGB(203, 57, 57)
C(13) = RGB(203, 57, 57)
C(14) = RGB(237, 187, 187)
C(15) = RGB(237, 187, 187)
'FORE COLOUR
C(16) = RGB(204, 62, 62)
ElseIf Theme = 8 Then
'BACK
C(0) = RGB(250, 253, 254)
C(1) = RGB(250, 253, 254)
C(2) = RGB(228, 243, 252)
C(3) = RGB(228, 243, 252)
'\
C(4) = RGB(199, 230, 249)
C(5) = RGB(199, 230, 249)
C(6) = RGB(237, 247, 253)
C(7) = RGB(237, 247, 253)
'FRONT
C(8) = RGB(225, 247, 255)
C(9) = RGB(225, 247, 255)
C(10) = RGB(67, 208, 255)
C(11) = RGB(67, 208, 255)
'\
C(12) = RGB(63, 112, 233)
C(13) = RGB(63, 112, 233)
C(14) = RGB(63, 226, 246)
C(15) = RGB(63, 226, 246)
'FORE COLOUR
C(16) = RGB(23, 139, 211)
ElseIf Theme = 9 Then
'BACK
C(0) = RGB(231, 243, 232)
C(1) = RGB(231, 243, 232)
C(2) = RGB(225, 219, 225)
C(3) = RGB(225, 219, 225)
'\
C(4) = RGB(179, 189, 179)
C(5) = RGB(179, 189, 179)
C(6) = RGB(226, 238, 226)
C(7) = RGB(226, 238, 226)
'FRONT
C(8) = RGB(223, 251, 223)
C(9) = RGB(223, 251, 223)
C(10) = RGB(108, 255, 108)
C(11) = RGB(108, 255, 108)
'\
C(12) = RGB(26, 228, 26)
C(13) = RGB(26, 228, 26)
C(14) = RGB(217, 244, 217)
C(15) = RGB(217, 244, 217)
'FORE COLOUR
C(16) = RGB(188, 184, 188)
ElseIf Theme = 10 Then
'BACK
C(0) = LightenColor(U_PBSCC2, 180)
C(1) = LightenColor(U_PBSCC2, 180)
C(2) = LightenColor(U_PBSCC2, 50)
C(3) = LightenColor(U_PBSCC2, 50)
'\
C(4) = U_PBSCC2
C(5) = U_PBSCC2
C(6) = LightenColor(U_PBSCC2, 80)
C(7) = LightenColor(U_PBSCC2, 80)
'FRONT
C(8) = LightenColor(U_PBSCC1, 180)
C(9) = LightenColor(U_PBSCC1, 180)
C(10) = LightenColor(U_PBSCC1, 50)
C(11) = LightenColor(U_PBSCC1, 50)
'\
C(12) = U_PBSCC1
C(13) = U_PBSCC1
C(14) = LightenColor(U_PBSCC1, 80)
C(15) = LightenColor(U_PBSCC1, 80)
'FORE COLOUR
C(16) = U_PBSCC1
End If
End Sub
Private Sub DrawCaptionText(ByVal TextString As String, ByVal Alignment As U_TextAlignments)
Dim lonStartWidth As Long, lonStartHeight As Long
Dim PBTCN, PBTCS As Long
If Enabled = True Then
PBTCN = U_TextColor
PBTCS = U_TextEC
Else
PBTCN = ColourTOGray(U_TextColor)
PBTCS = ColourTOGray(U_TextEC)
End If
UserControl.ForeColor = PBTCN
If Alignment = 1 Then
lonStartWidth = 1
lonStartHeight = 0
ElseIf Alignment = 2 Then
lonStartWidth = 1
lonStartHeight = (UserControl.ScaleHeight / 2) - (UserControl.TextHeight(TextString) / 2) - 1
ElseIf Alignment = 3 Then
lonStartWidth = 1
lonStartHeight = (UserControl.ScaleHeight - UserControl.TextHeight(TextString)) - 1
ElseIf Alignment = 4 Then
lonStartWidth = (UserControl.ScaleWidth / 2) - (UserControl.TextWidth(TextString) / 2) - 1
lonStartHeight = 0
ElseIf Alignment = 5 Then
lonStartWidth = (UserControl.ScaleWidth / 2) - (UserControl.TextWidth(TextString) / 2) - 1
lonStartHeight = (UserControl.ScaleHeight / 2) - (UserControl.TextHeight(TextString) / 2) - 1
ElseIf Alignment = 6 Then
lonStartWidth = (UserControl.ScaleWidth / 2) - (UserControl.TextWidth(TextString) / 2) - 1
lonStartHeight = (UserControl.ScaleHeight - UserControl.TextHeight(TextString)) - 1
ElseIf Alignment = 7 Then
lonStartWidth = (UserControl.ScaleWidth - UserControl.TextWidth(TextString)) - 3
lonStartHeight = 0
ElseIf Alignment = 8 Then
lonStartWidth = (UserControl.ScaleWidth - UserControl.TextWidth(TextString)) - 3
lonStartHeight = (UserControl.ScaleHeight / 2) - (UserControl.TextHeight(TextString) / 2) - 1
ElseIf Alignment = 9 Then
lonStartWidth = (UserControl.ScaleWidth - UserControl.TextWidth(TextString)) - 3
lonStartHeight = (UserControl.ScaleHeight - UserControl.TextHeight(TextString)) - 1
End If
If U_TextEffect = Normal Then
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = Engraved Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight + 1
UserControl.Print TextString
UserControl.ForeColor = RGB(128, 128, 128)
UserControl.CurrentX = lonStartWidth - 1
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = Embossed Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth - 1
UserControl.CurrentY = lonStartHeight - 1
UserControl.Print TextString
UserControl.ForeColor = RGB(128, 128, 128)
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight + 1
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = Outline Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
UserControl.CurrentX = lonStartWidth - 1
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
UserControl.CurrentY = lonStartHeight - 1
UserControl.CurrentX = lonStartWidth
UserControl.Print TextString
UserControl.CurrentY = lonStartHeight + 1
UserControl.CurrentX = lonStartWidth
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = Shadow Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight + 1
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
End If
End Sub
Public Function DrawGradientFourColour(ObjectHDC As Long, Left As Long, Top As Long, Width As Long, Height As Long, TopLeftColour As Long, TopRightColour As Long, BottomLeftColour As Long, BottomRightColour As Long)
Dim bi24BitInfo As BITMAPINFO
Dim bBytes() As Byte
Dim LeftGrads() As cRGB
Dim RightGrads() As cRGB
Dim MiddleGrads() As cRGB
Dim TopLeft As cRGB
Dim TopRight As cRGB
Dim BottomLeft As cRGB
Dim BottomRight As cRGB
Dim iLoop As Long
Dim bytesWidth As Long
With TopLeft
.Red = Red(TopLeftColour)
.Green = Green(TopLeftColour)
.Blue = Blue(TopLeftColour)
End With
With TopRight
.Red = Red(TopRightColour)
.Green = Green(TopRightColour)
.Blue = Blue(TopRightColour)
End With
With BottomLeft
.Red = Red(BottomLeftColour)
.Green = Green(BottomLeftColour)
.Blue = Blue(BottomLeftColour)
End With
With BottomRight
.Red = Red(BottomRightColour)
.Green = Green(BottomRightColour)
.Blue = Blue(BottomRightColour)
End With
GradateColours LeftGrads, Height, TopLeft, BottomLeft
GradateColours RightGrads, Height, TopRight, BottomRight
With bi24BitInfo.bmiHeader
.biBitCount = 24
.biCompression = BI_RGB
.biPlanes = 1
.biSize = Len(bi24BitInfo.bmiHeader)
.biWidth = Width
.biHeight = 1
End With
ReDim bBytes(1 To bi24BitInfo.bmiHeader.biWidth * bi24BitInfo.bmiHeader.biHeight * 3) As Byte
bytesWidth = (Width) * 3
For iLoop = 0 To Height - 1
GradateColours MiddleGrads, Width, LeftGrads(iLoop), RightGrads(iLoop)
CopyMemory bBytes(1), MiddleGrads(0), bytesWidth
SetDIBitsToDevice ObjectHDC, Left, Top + iLoop, bi24BitInfo.bmiHeader.biWidth, bi24BitInfo.bmiHeader.biHeight, 0, 0, 0, bi24BitInfo.bmiHeader.biHeight, bBytes(1), bi24BitInfo, DIB_RGB_COLORS
Next iLoop
End Function
Private Function GradateColours(cResults() As cRGB, Length As Long, Colour1 As cRGB, Colour2 As cRGB)
Dim fromR As Integer
Dim toR As Integer
Dim fromG As Integer
Dim toG As Integer
Dim fromB As Integer
Dim toB As Integer
Dim stepR As Single
Dim stepG As Single
Dim stepB As Single
Dim iLoop As Long
ReDim cResults(0 To Length)
fromR = Colour1.Red
fromG = Colour1.Green
fromB = Colour1.Blue
toR = Colour2.Red
toG = Colour2.Green
toB = Colour2.Blue
stepR = Divide(toR - fromR, Length)
stepG = Divide(toG - fromG, Length)
stepB = Divide(toB - fromB, Length)
For iLoop = 0 To Length
cResults(iLoop).Red = fromR + (stepR * iLoop)
cResults(iLoop).Green = fromG + (stepG * iLoop)
cResults(iLoop).Blue = fromB + (stepB * iLoop)
Next iLoop
End Function
Private Function Blue(Colour As Long) As Long
Blue = (Colour And &HFF0000) / &H10000
End Function
Private Function Green(Colour As Long) As Long
Green = (Colour And &HFF00&) / &H100
End Function
Private Function Red(Colour As Long) As Long
Red = (Colour And &HFF&)
End Function