yangyin
2025-03-27 b0de14c2670b9ff0079dacfb4b7457b438368f11
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
#region Imports
 
using DPumpHydr.WinFrmUI.RLT.Enum.Cyber;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Windows.Forms;
using static DPumpHydr.WinFrmUI.RLT.Util.CyberLibrary;
using Timer = System.Windows.Forms.Timer;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Controls
{
    #region CyberScrollBar
 
    [DefaultEvent("ValueChanged")]
    [ToolboxBitmap(typeof(VScrollBar))]
    [Description("Enables the component to scroll horizontally/vertically through content (use event generation).")]
    public partial class CyberScrollBar : UserControl
    {
        #region Variables
 
        private float h = 0;
        private Rectangle rectangle_region = new();
        private Rectangle rectangle_value = new();
        private GraphicsPath graphicsPath = new();
        private Size size_cyberscrollbar = new();
 
        #endregion
 
        #region Property Region
 
        private int tmp_value_scroll;
        [Category("Value")]
        [Description("Meaning")]
        public int Value
        {
            get => tmp_value_scroll;
            set
            {
                if (tmp_value_scroll == value)
                {
                    return;
                }
 
                tmp_value_scroll = value;
                Refresh();
                OnScroll();
            }
        }
 
        private Orientation tmp_orientation;
        [Category("Value")]
        [Description("System.Windows.Forms.Orientation")]
        public Orientation OrientationValue
        {
            get => tmp_orientation;
            set
            {
                if (value == Orientation.Vertical)
                {
                    Size = new Size(Size.Width, Size.Height);
                    if (RoundingInt != 0)
                    {
                        RoundingInt /= 10;
                    }
                }
                else
                {
                    Size = new Size(Size.Height, Size.Width);
                    if (RoundingInt != 0)
                    {
                        RoundingInt *= 10;
                    }
                }
                tmp_orientation = value;
                Refresh();
            }
        }
 
        [Category("Value")]
        [Description("Values for how much it will scroll")]
        [DefaultValue(1)]
        public int SmallStep { get; set; }
 
        private int tmp_thumbSize;
        [Category("Value")]
        [Description("Slider size")]
        public int ThumbSize
        {
            get => tmp_thumbSize;
            set
            {
                tmp_thumbSize = value;
                Refresh();
            }
        }
 
        private int tmp_value_maximum;
        [Category("Value")]
        [Description("MAX Value")]
        public int Maximum
        {
            get => tmp_value_maximum;
            set
            {
                if (value > Minimum)
                {
                    tmp_value_maximum = value;
                    Value = 0;
                    Refresh();
                }
            }
        }
 
        private int tmp_value_minimum;
        [Category("Value")]
        [Description("MIN Value")]
        public int Minimum
        {
            get => tmp_value_minimum;
            set
            {
                if (value < Minimum)
                {
                    tmp_value_minimum = value;
                    Value = 0;
                    Refresh();
                }
            }
        }
 
        private bool tmp_rgb_status;
        [Category("Cyber")]
        [Description("RGB On/Off")]
        public bool RGB
        {
            get => tmp_rgb_status;
            set
            {
                tmp_rgb_status = value;
 
                if (tmp_rgb_status == true)
                {
                    timer_rgb.Stop();
                    if (!DrawEngine.GlobalRGB.Enabled)
                    {
                        timer_rgb.Tick += (Sender, EventArgs) =>
                        {
                            h += 4;
                            if (h >= 360)
                            {
                                h = 0;
                            }
 
                            Refresh();
                        };
                        timer_rgb.Start();
                    }
                }
                else
                {
                    timer_rgb.Stop();
                    Refresh();
                }
            }
        }
 
        private readonly Timer timer_rgb = new() { Interval = 300 };
        [Category("Timers")]
        [Description("RGB refresh rate value (redrawing in effect)")]
        public int Timer_RGB
        {
            get => timer_rgb.Interval;
            set => timer_rgb.Interval = value;
        }
 
        private Color tmp_color_fscrollbar;
        [Category("Cyber")]
        [Description("Fill color")]
        public Color ColorScrollBar
        {
            get => tmp_color_fscrollbar;
            set
            {
                tmp_color_fscrollbar = value;
                Refresh();
 
            }
        }
 
        private int tmp_color_fscrollbar_transparency;
        [Category("Value")]
        [Description("Fill transparency value")]
        public int ColorScrollBar_Transparency
        {
            get => tmp_color_fscrollbar_transparency;
            set
            {
                if (value is >= 10 and <= 255)
                {
                    tmp_color_fscrollbar_transparency = value;
                    Refresh();
                }
            }
        }
 
        private bool tmp_rounding_status;
        [Category("Cyber")]
        [Description("On/Off Rounding")]
        public bool Rounding
        {
            get => tmp_rounding_status;
            set
            {
                tmp_rounding_status = value;
                Refresh();
 
            }
        }
 
        private int tmp_rounding_int;
        [Category("Cyber")]
        [Description("Percentage rounding")]
        public int RoundingInt
        {
            get => tmp_rounding_int;
            set
            {
                if (value is >= 0 and <= 100)
                {
                    tmp_rounding_int = value;
                    Refresh();
 
                }
            }
        }
 
        private Color tmp_color_background;
        [Category("Cyber")]
        [Description("Background color")]
        public Color ColorBackground
        {
            get => tmp_color_background;
            set
            {
                tmp_color_background = value;
                Refresh();
 
            }
        }
 
        private bool tmp_background;
        [Category("Cyber")]
        [Description("Background On/Off")]
        public bool Background
        {
            get => tmp_background;
            set
            {
                tmp_background = value;
                Refresh();
 
            }
        }
 
        private bool tmp_background_pen;
        [Category("BorderStyle")]
        [Description("On/Off Border")]
        public bool BackgroundPen
        {
            get => tmp_background_pen;
            set
            {
                tmp_background_pen = value;
                OnSizeChanged(null);
                Refresh();
            }
        }
 
        private float tmp_background_width_pen;
        [Category("BorderStyle")]
        [Description("Border size")]
        public float Background_WidthPen
        {
            get => tmp_background_width_pen;
            set
            {
                tmp_background_width_pen = value;
                OnSizeChanged(null);
                Refresh();
            }
        }
 
        private Color tmp_color_background_pen;
        [Category("BorderStyle")]
        [Description("Border color")]
        public Color ColorBackground_Pen
        {
            get => tmp_color_background_pen;
            set
            {
                tmp_color_background_pen = value;
                Refresh();
            }
        }
 
        private bool tmp_lighting;
        [Category("Lighting")]
        [Description("On/Off backlight")]
        public bool Lighting
        {
            get => tmp_lighting;
            set
            {
                tmp_lighting = value;
                OnSizeChanged(null);
                Refresh();
            }
        }
 
        private Color tmp_color_lighting;
        [Category("Lighting")]
        [Description("Backlight / Shadow Color")]
        public Color ColorLighting
        {
            get => tmp_color_lighting;
            set
            {
                tmp_color_lighting = value;
                Refresh();
            }
        }
 
        private int tmp_alpha;
        [Category("Lighting")]
        [Description("Lighting alpha")]
        public int Alpha
        {
            get => tmp_alpha;
            set
            {
                tmp_alpha = value;
                Refresh();
            }
        }
 
        private int tmp_pen_width;
        [Category("Lighting")]
        [Description("Lighting width")]
        public int PenWidth
        {
            get => tmp_pen_width;
            set
            {
                tmp_pen_width = value;
                OnSizeChanged(null);
                Refresh();
            }
        }
 
        private bool tmp_lineargradient_background_status;
        [Category("LinearGradient")]
        [Description("On/Off background gradient")]
        public bool LinearGradient_Background
        {
            get => tmp_lineargradient_background_status;
            set
            {
                tmp_lineargradient_background_status = value;
                Refresh();
            }
        }
 
        private Color tmp_color_1_for_gradient_background;
        [Category("LinearGradient")]
        [Description("Color #1 for background gradient")]
        public Color ColorBackground_1
        {
            get => tmp_color_1_for_gradient_background;
            set
            {
                tmp_color_1_for_gradient_background = value;
                Refresh();
            }
        }
 
        private Color tmp_color_2_for_gradient_background;
        [Category("LinearGradient")]
        [Description("Color #2 for background gradient")]
        public Color ColorBackground_2
        {
            get => tmp_color_2_for_gradient_background;
            set
            {
                tmp_color_2_for_gradient_background = value;
                Refresh();
            }
        }
 
        private bool tmp_lineargradient_value_status;
        [Category("LinearGradient")]
        [Description("On/Off slider gradient")]
        public bool LinearGradient_Value
        {
            get => tmp_lineargradient_value_status;
            set
            {
                tmp_lineargradient_value_status = value;
                Refresh();
            }
        }
 
        private Color tmp_color_1_for_gradient_value;
        [Category("LinearGradient")]
        [Description("Color #1 for slider gradient")]
        public Color ColorBackground_Value_1
        {
            get => tmp_color_1_for_gradient_value;
            set
            {
                tmp_color_1_for_gradient_value = value;
                Refresh();
            }
        }
 
        private Color tmp_color_2_for_gradient_value;
        [Category("LinearGradient")]
        [Description("Color #2 for slider gradient")]
        public Color ColorBackground_Value_2
        {
            get => tmp_color_2_for_gradient_value;
            set
            {
                tmp_color_2_for_gradient_value = value;
                Refresh();
            }
        }
 
        private bool tmp_lineargradient_pen_status;
        [Category("LinearGradient")]
        [Description("On/Off border gradient")]
        public bool LinearGradientPen
        {
            get => tmp_lineargradient_pen_status;
            set
            {
                tmp_lineargradient_pen_status = value;
                Refresh();
            }
        }
 
        private Color tmp_color_1_for_gradient_pen;
        [Category("LinearGradient")]
        [Description("Color #1 for border gradient")]
        public Color ColorPen_1
        {
            get => tmp_color_1_for_gradient_pen;
            set
            {
                tmp_color_1_for_gradient_pen = value;
                Refresh();
            }
        }
 
        private Color tmp_color_2_for_gradient_pen;
        [Category("LinearGradient")]
        [Description("Color #2 for border gradient")]
        public Color ColorPen_2
        {
            get => tmp_color_2_for_gradient_pen;
            set
            {
                tmp_color_2_for_gradient_pen = value;
                Refresh();
            }
        }
 
        private SmoothingMode tmp_smoothing_mode;
        [Category("Cyber")]
        [Description("Mode <graphics.SmoothingMode>")]
        public SmoothingMode SmoothingMode
        {
            get => tmp_smoothing_mode;
            set
            {
                if (value != SmoothingMode.Invalid)
                {
                    tmp_smoothing_mode = value;
                }
 
                Refresh();
            }
        }
 
        private TextRenderingHint tmp_text_rendering_hint;
        [Category("Cyber")]
        [Description("Mode <graphics.TextRenderingHint>")]
        public TextRenderingHint TextRenderingHint
        {
            get => tmp_text_rendering_hint;
            set
            {
                tmp_text_rendering_hint = value;
                Refresh();
            }
        }
 
        private StateStyle tmp_cyberscrollbar_style = StateStyle.Default;
        [Category("Cyber")]
        [Description("ScrollBar style")]
        public StateStyle CyberScrollBarStyle
        {
            get => tmp_cyberscrollbar_style;
            set
            {
                tmp_cyberscrollbar_style = value;
                switch (tmp_cyberscrollbar_style)
                {
                    case StateStyle.Default:
                        Size = new Size(26, 300);
                        BackColor = Color.Transparent;
                        ForeColor = Color.FromArgb(245, 245, 245);
 
                        Value = 0;
                        Minimum = 0;
                        Maximum = 100;
                        OrientationValue = Orientation.Vertical;
                        ThumbSize = 60;
                        SmallStep = 1;
                        RGB = false;
                        Background = true;
                        BackgroundPen = true;
                        Background_WidthPen = 3F;
                        Rounding = true;
                        RoundingInt = 7;
                        Timer_RGB = 300;
                        ColorScrollBar = Color.FromArgb(29, 200, 238);
                        ColorScrollBar_Transparency = 255;
                        ColorBackground = Color.FromArgb(37, 52, 68);
                        ColorBackground_Pen = Color.FromArgb(29, 200, 238);
                        Lighting = false;
                        ColorLighting = Color.FromArgb(29, 200, 238);
                        Alpha = 50;
                        PenWidth = 10;
                        LinearGradient_Background = false;
                        ColorBackground_1 = Color.FromArgb(37, 52, 68);
                        ColorBackground_2 = Color.FromArgb(41, 63, 86);
                        LinearGradientPen = false;
                        ColorPen_1 = Color.FromArgb(37, 52, 68);
                        ColorPen_2 = Color.FromArgb(41, 63, 86);
                        LinearGradient_Value = false;
                        ColorBackground_Value_1 = Color.FromArgb(28, 200, 238);
                        ColorBackground_Value_2 = Color.FromArgb(100, 208, 232);
                        SmoothingMode = SmoothingMode.HighQuality;
                        TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                        break;
                    case StateStyle.Custom:
                        break;
                    case StateStyle.Random:
                        HelpEngine.GetRandom random = new();
                        Background = random.Bool();
                        Rounding = random.Bool();
                        if (Rounding)
                        {
                            RoundingInt = random.Int(2, 10);
                        }
 
                        if (Background)
                        {
                            ColorBackground = random.ColorArgb(random.Int(0, 255));
                        }
 
                        BackgroundPen = random.Bool();
 
                        if (BackgroundPen)
                        {
                            Background_WidthPen = random.Float(1, 3);
                            ColorBackground_Pen = random.ColorArgb(random.Int(0, 255));
                        }
 
                        Lighting = random.Bool();
                        if (Lighting)
                        {
                            ColorLighting = random.ColorArgb();
                        }
 
                        LinearGradient_Background = random.Bool();
                        if (LinearGradient_Background)
                        {
                            ColorBackground_1 = random.ColorArgb();
                            ColorBackground_2 = random.ColorArgb();
                        }
 
                        LinearGradient_Value = random.Bool();
                        if (LinearGradient_Value)
                        {
                            ColorBackground_Value_1 = random.ColorArgb();
                            ColorBackground_Value_2 = random.ColorArgb();
                        }
 
                        LinearGradientPen = random.Bool();
                        if (LinearGradientPen)
                        {
                            ColorPen_1 = random.ColorArgb();
                            ColorPen_2 = random.ColorArgb();
                        }
 
                        ColorScrollBar = random.ColorArgb();
                        ColorScrollBar_Transparency = random.Int(0, 255);
                        break;
                }
 
                Refresh();
            }
        }
 
        #endregion
 
        #region Constructor Region
 
        public CyberScrollBar()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
            DoubleBuffered = true;
 
            Tag = "Cyber";
            CyberScrollBarStyle = StateStyle.Default;
            CyberScrollBarStyle = StateStyle.Custom;
 
            OnSizeChanged(null);
        }
 
        #endregion
 
        #region Event Region
 
        protected override void OnPaint(PaintEventArgs e)
        {
            try
            {
                Settings_Load(e.Graphics);
                Draw_Background(e.Graphics);
            }
            catch (Exception Ex)
            {
                HelpEngine.Error($"[{Name}] Error: \n{Ex}");
            }
        }
 
        public virtual void OnScroll(ScrollEventType type = ScrollEventType.ThumbPosition)
        {
            ValueChanged?.Invoke(this, EventArgs.Empty);
        }
 
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                MouseScroll(e);
            }
        }
 
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                MouseScroll(e);
            }
        }
 
        protected override void OnSizeChanged(EventArgs e)
        {
            int tmp = (int)((BackgroundPen ? Background_WidthPen : 0) + (Lighting ? PenWidth / 4 : 0));
            size_cyberscrollbar = new Size(Width - (tmp * 2), Height - (tmp * 2));
            rectangle_region = new Rectangle(tmp, tmp, size_cyberscrollbar.Width, size_cyberscrollbar.Height);
        }
        private void MouseScroll(MouseEventArgs e)
        {
            int value = Value;
 
            switch (OrientationValue)
            {
                case Orientation.Vertical:
                    if (e.Y < 0)
                    {
                        value -= SmallStep;
                    }
                    else if (e.Y > rectangle_region.Height)
                    {
                        value += SmallStep;
                    }
                    else
                    {
                        value = Maximum * (e.Y - (ThumbSize / 2)) / (rectangle_region.Height - ThumbSize);
                    }
 
                    rectangle_value = new Rectangle(
                    rectangle_region.X,
                    rectangle_region.Y + (Value * (rectangle_region.Height - ThumbSize) / Maximum),
                    rectangle_region.Width,
                    ThumbSize);
                    break;
                case Orientation.Horizontal:
                    if (e.X < 0)
                    {
                        value -= SmallStep;
                    }
                    else if (e.X > rectangle_region.Width)
                    {
                        value += SmallStep;
                    }
                    else
                    {
                        value = Maximum * (e.X - (ThumbSize / 2)) / (rectangle_region.Width - ThumbSize);
                    }
 
                    rectangle_value = new Rectangle(
                    rectangle_region.X + (Value * (rectangle_region.Width - ThumbSize) / Maximum),
                    rectangle_region.Y,
                    ThumbSize,
                    rectangle_region.Height);
                    break;
            }
            Value = Math.Max(0, Math.Min(Maximum, value));
        }
 
        #endregion
 
        #region Event Handler Region
 
        [Category("Cyber")]
        [Description("Occurs whenever the Value property changes.")]
        public event EventHandler ValueChanged;
 
        #endregion
 
        #region Method Region
 
        private void Settings_Load(Graphics graphics)
        {
            BackColor = Color.Transparent;
 
            graphics.SmoothingMode = SmoothingMode;
            graphics.TextRenderingHint = TextRenderingHint;
        }
 
        private void Draw_Background(Graphics graphics_form)
        {
            float roundingValue;
            void BaseLoading()
            {
                //Rounding
                roundingValue = 0.1F;
                if (Rounding && RoundingInt > 0)
                {
                    roundingValue = Height / 100F * RoundingInt;
                }
 
                //RoundedRectangle
                graphicsPath = DrawEngine.RoundedRectangle(rectangle_region, roundingValue);
 
                //Region
                Region = new Region(DrawEngine.RoundedRectangle(new Rectangle(
                0, 0,
                Width, Height),
                roundingValue));
            }
            Bitmap Layer_1()
            {
                Bitmap bitmap = new(Width, Height);
                Graphics graphics = HelpEngine.GetGraphics(ref bitmap, SmoothingMode, TextRenderingHint);
 
                //Shadow
                if (Lighting)
                {
                    DrawEngine.DrawBlurred(graphics, ColorLighting, DrawEngine.RoundedRectangle(rectangle_region, roundingValue), Alpha, PenWidth);
                }
 
                //Background border
                if (Background_WidthPen != 0 && BackgroundPen == true)
                {
                    Pen pen;
                    if (LinearGradientPen)
                    {
                        pen = new Pen(new LinearGradientBrush(rectangle_region, ColorPen_1, ColorPen_2, 360), Background_WidthPen);
                    }
                    else
                    {
                        pen = new Pen(RGB ? DrawEngine.HSV_To_RGB(h, 1f, 1f) : ColorBackground_Pen, Background_WidthPen);
                    }
 
                    pen.LineJoin = LineJoin.Round;
                    pen.DashCap = DashCap.Round;
                    graphics.DrawPath(pen, graphicsPath);
                }
 
                return bitmap;
            }
            Bitmap Layer_2()
            {
                Bitmap bitmap = new(Width, Height);
                Graphics graphics = HelpEngine.GetGraphics(ref bitmap, SmoothingMode, TextRenderingHint);
 
                //Region_Clip
                graphics.Clip = new Region(DrawEngine.RoundedRectangle(new Rectangle(
                    rectangle_region.X - (int)(2 + Background_WidthPen),
                    rectangle_region.Y - (int)(2 + Background_WidthPen),
                    rectangle_region.Width + ((int)(2 + Background_WidthPen) * 2),
                    rectangle_region.Height + ((int)(2 + Background_WidthPen) * 2)), Rounding ? roundingValue : 0.1F));
 
                //Background
                if (Background == true)
                {
                    Brush brush = new LinearGradientBrush(rectangle_region, ColorBackground_1, ColorBackground_2, 360);
                    graphics.FillPath(LinearGradient_Background ? brush : new SolidBrush(ColorBackground), graphicsPath);
                }
 
                //Additionally
                Draw_Bar(graphics, roundingValue);
 
                return bitmap;
            }
 
            BaseLoading();
            graphics_form.DrawImage(Layer_1(), new PointF(0, 0));
            graphics_form.DrawImage(Layer_2(), new PointF(0, 0));
        }
 
        private void Draw_Bar(Graphics graphics, float roundingValue)
        {
            if (Maximum <= 0)
            {
                return;
            }
 
            rectangle_value = new Rectangle(2, 2, rectangle_region.Width, ThumbSize);
 
            switch (OrientationValue)
            {
                case Orientation.Vertical:
                    rectangle_value = new Rectangle(
                    rectangle_region.X,
                    rectangle_region.Y + (Value * (rectangle_region.Height - ThumbSize) / Maximum),
                    rectangle_region.Width,
                    ThumbSize);
                    break;
                case Orientation.Horizontal:
                    rectangle_value = new Rectangle(
                    rectangle_region.X + (Value * (rectangle_region.Width - ThumbSize) / Maximum),
                    rectangle_region.Y,
                    ThumbSize,
                    rectangle_region.Height);
                    break;
            }
 
            int tmp = 1;
            rectangle_value.X -= tmp;
            rectangle_value.Y -= tmp;
            rectangle_value.Width += tmp * 2;
            rectangle_value.Height += tmp * 2;
            roundingValue += tmp * 2;
 
            if (LinearGradient_Value)
            {
                graphics.FillPath(new LinearGradientBrush(rectangle_region,
                    Color.FromArgb(ColorScrollBar_Transparency, RGB ? DrawEngine.HSV_To_RGB(h, 1f, 1f) : ColorBackground_Value_1),
                    Color.FromArgb(ColorScrollBar_Transparency, RGB ? DrawEngine.HSV_To_RGB(h + 20, 1f, 1f) : ColorBackground_Value_2), 360),
                    DrawEngine.RoundedRectangle(rectangle_value, roundingValue));
            }
            else
            {
                graphics.FillPath(new SolidBrush(
                Color.FromArgb(ColorScrollBar_Transparency, RGB ? DrawEngine.HSV_To_RGB(h, 1f, 1f) : ColorScrollBar)),
                DrawEngine.RoundedRectangle(rectangle_value, roundingValue));
            }
        }
 
        #endregion
    }
 
    #endregion
}