View difference between Paste ID: zjTpNqYp and XbEmvYDv
SHOW: | | - or go back to the newest paste.
1
using Microsoft.VisualBasic;
2
using System;
3
using System.Collections;
4
using System.Collections.Generic;
5
using System.Data;
6
using System.Diagnostics;
7
using System.Windows.Forms;
8
using System.Drawing;
9
//Creator: Slurms Makenzi
10
//Thanks Aeon for theme class!
11
//Date: 7/7/2011
12
//Site: www.loungeforum.net
13
//Version: 1.0
14
//Thanks xZ3ROxPROJ3CTx/Janniek kuenen
15
//http://www.hackforums.net/showthread.php?tid=1472377
16
//
17
18
//\\\\\\\\\\\\\\\Use Credits Were Credits Are Needed///////////////////
19
20
//
21
22
#region "Imports"
23
using System.Drawing.Drawing2D;
24
using System.ComponentModel;
25
using System.Runtime.InteropServices;
26
#endregion
27
abstract class Theme : ContainerControl
28
{
29
30
    #region " Initialization "
31
32
    protected Graphics G;
33
    public Theme()
34
    {
35
        SetStyle((ControlStyles)139270, true);
36
    }
37
38
    private bool ParentIsForm;
39
    protected override void OnHandleCreated(EventArgs e)
40
    {
41
        Dock = DockStyle.Fill;
42
        ParentIsForm = Parent is Form;
43
        if (ParentIsForm)
44
        {
45
            if (!(_TransparencyKey == Color.Empty))
46
                ParentForm.TransparencyKey = _TransparencyKey;
47
            ParentForm.FormBorderStyle = FormBorderStyle.None;
48
        }
49
        base.OnHandleCreated(e);
50
    }
51
52
    public override string Text
53
    {
54
        get { return base.Text; }
55
        set
56
        {
57
            base.Text = value;
58
            Invalidate();
59
        }
60
    }
61
    #endregion
62
63
    #region " Sizing and Movement "
64
65
    private bool _Resizable = true;
66
    public bool Resizable
67
    {
68
        get { return _Resizable; }
69
        set { _Resizable = value; }
70
    }
71
72
    private int _MoveHeight = 24;
73
    public int MoveHeight
74
    {
75
        get { return _MoveHeight; }
76
        set
77
        {
78
            _MoveHeight = value;
79
            Header = new Rectangle(7, 7, Width - 14, _MoveHeight - 7);
80
        }
81
    }
82
83
    private IntPtr Flag;
84
    protected override void OnMouseDown(MouseEventArgs e)
85
    {
86
        if (!(e.Button == MouseButtons.Left))
87
            return;
88
        if (ParentIsForm)
89
            if (ParentForm.WindowState == FormWindowState.Maximized)
90
                return;
91
92
        if (Header.Contains(e.Location))
93
        {
94
            Flag = new IntPtr(2);
95
        }
96
        else if (Current.Position == 0 | !_Resizable)
97
        {
98
            return;
99
        }
100
        else
101
        {
102
            Flag = new IntPtr(Current.Position);
103
        }
104
105
        Capture = false;
106
        Message msg = Message.Create(Parent.Handle, 161, Flag, System.IntPtr.Zero);
107
        DefWndProc(ref msg);
108
109
        base.OnMouseDown(e);
110
    }
111
112
    private struct Pointer
113
    {
114
        public readonly Cursor Cursor;
115
        public readonly byte Position;
116
        public Pointer(Cursor c, byte p)
117
        {
118
            Cursor = c;
119
            Position = p;
120
        }
121
    }
122
123
    private bool F1;
124
    private bool F2;
125
    private bool F3;
126
    private bool F4;
127
    private Point PTC;
128
    private Pointer GetPointer()
129
    {
130
        PTC = PointToClient(MousePosition);
131
        F1 = PTC.X < 7;
132
        F2 = PTC.X > Width - 7;
133
        F3 = PTC.Y < 7;
134
        F4 = PTC.Y > Height - 7;
135
136
        if (F1 & F3)
137
            return new Pointer(Cursors.SizeNWSE, 13);
138
        if (F1 & F4)
139
            return new Pointer(Cursors.SizeNESW, 16);
140
        if (F2 & F3)
141
            return new Pointer(Cursors.SizeNESW, 14);
142
        if (F2 & F4)
143
            return new Pointer(Cursors.SizeNWSE, 17);
144
        if (F1)
145
            return new Pointer(Cursors.SizeWE, 10);
146
        if (F2)
147
            return new Pointer(Cursors.SizeWE, 11);
148
        if (F3)
149
            return new Pointer(Cursors.SizeNS, 12);
150
        if (F4)
151
            return new Pointer(Cursors.SizeNS, 15);
152
        return new Pointer(Cursors.Default, 0);
153
    }
154
155
    private Pointer Current;
156
    private Pointer Pending;
157
    private void SetCurrent()
158
    {
159
        Pending = GetPointer();
160
        if (Current.Position == Pending.Position)
161
            return;
162
        Current = GetPointer();
163
        Cursor = Current.Cursor;
164
    }
165
166
    protected override void OnMouseMove(MouseEventArgs e)
167
    {
168
        if (_Resizable)
169
            SetCurrent();
170
        base.OnMouseMove(e);
171
    }
172
173
    protected Rectangle Header;
174
    protected override void OnSizeChanged(EventArgs e)
175
    {
176
        if (Width == 0 || Height == 0)
177
            return;
178
        Header = new Rectangle(7, 7, Width - 14, _MoveHeight - 7);
179
        Invalidate();
180
        base.OnSizeChanged(e);
181
    }
182
183
    #endregion
184
185
    #region " Convienence "
186
187
    public abstract void PaintHook();
188
    protected override sealed void OnPaint(PaintEventArgs e)
189
    {
190
        if (Width == 0 || Height == 0)
191
            return;
192
        G = e.Graphics;
193
        PaintHook();
194
    }
195
196
    private Color _TransparencyKey;
197
    public Color TransparencyKey
198
    {
199
        get { return _TransparencyKey; }
200
        set
201
        {
202
            _TransparencyKey = value;
203
            Invalidate();
204
        }
205
    }
206
207
    private Image _Image;
208
    public Image Image
209
    {
210
        get { return _Image; }
211
        set
212
        {
213
            _Image = value;
214
            Invalidate();
215
        }
216
    }
217
    public int ImageWidth
218
    {
219
        get
220
        {
221
            if (_Image == null)
222
                return 0;
223
            return _Image.Width;
224
        }
225
    }
226
227
    private Size _Size;
228
    private Rectangle _Rectangle;
229
    private LinearGradientBrush _Gradient;
230
231
    private SolidBrush _Brush;
232
    protected void DrawCorners(Color c, Rectangle rect)
233
    {
234
        _Brush = new SolidBrush(c);
235
        G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1);
236
        G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1);
237
        G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1);
238
        G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1);
239
    }
240
241
    protected void DrawBorders(Pen p1, Pen p2, Rectangle rect)
242
    {
243
        G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
244
        G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3);
245
    }
246
247
    protected void DrawText(HorizontalAlignment a, Color c, int x)
248
    {
249
        DrawText(a, c, x, 0);
250
    }
251
    protected void DrawText(HorizontalAlignment a, Color c, int x, int y)
252
    {
253
        if (string.IsNullOrEmpty(Text))
254
            return;
255
        _Size = G.MeasureString(Text, Font).ToSize();
256
        _Brush = new SolidBrush(c);
257
258
        switch (a)
259
        {
260
            case HorizontalAlignment.Left:
261
                G.DrawString(Text, Font, _Brush, x, _MoveHeight / 2 - _Size.Height / 2 + y);
262
                break;
263
            case HorizontalAlignment.Right:
264
                G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight / 2 - _Size.Height / 2 + y);
265
                break;
266
            case HorizontalAlignment.Center:
267
                G.DrawString(Text, Font, _Brush, Width / 2 - _Size.Width / 2 + x, _MoveHeight / 2 - _Size.Height / 2 + y);
268
                break;
269
        }
270
    }
271
272
    protected void DrawIcon(HorizontalAlignment a, int x)
273
    {
274
        DrawIcon(a, x, 0);
275
    }
276
    protected void DrawIcon(HorizontalAlignment a, int x, int y)
277
    {
278
        if (_Image == null)
279
            return;
280
        switch (a)
281
        {
282
            case HorizontalAlignment.Left:
283
                G.DrawImage(_Image, x, _MoveHeight / 2 - _Image.Height / 2 + y);
284
                break;
285
            case HorizontalAlignment.Right:
286
                G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight / 2 - _Image.Height / 2 + y);
287
                break;
288
            case HorizontalAlignment.Center:
289
                G.DrawImage(_Image, Width / 2 - _Image.Width / 2, _MoveHeight / 2 - _Image.Height / 2);
290
                break;
291
        }
292
    }
293
294
    protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
295
    {
296
        _Rectangle = new Rectangle(x, y, width, height);
297
        _Gradient = new LinearGradientBrush(_Rectangle, c1, c2, angle);
298
        G.FillRectangle(_Gradient, _Rectangle);
299
    }
300
301
    #endregion
302
303
}
304
abstract class ThemeControl : Control
305
{
306
307
    #region " Initialization "
308
309
    protected Graphics G;
310
    protected Bitmap B;
311
    public ThemeControl()
312
    {
313
        SetStyle((ControlStyles)139270, true);
314
        B = new Bitmap(1, 1);
315
        G = Graphics.FromImage(B);
316
    }
317
318
    public void AllowTransparent()
319
    {
320
        SetStyle(ControlStyles.Opaque, false);
321
        SetStyle(ControlStyles.SupportsTransparentBackColor, true);
322
    }
323
324
    public override string Text
325
    {
326
        get { return base.Text; }
327
        set
328
        {
329
            base.Text = value;
330
            Invalidate();
331
        }
332
    }
333
    #endregion
334
335
    #region " Mouse Handling "
336
337
    protected enum State : byte
338
    {
339
        MouseNone = 0,
340
        MouseOver = 1,
341
        MouseDown = 2
342
    }
343
344
    protected State MouseState;
345
    protected override void OnMouseLeave(EventArgs e)
346
    {
347
        ChangeMouseState(State.MouseNone);
348
        base.OnMouseLeave(e);
349
    }
350
    protected override void OnMouseEnter(EventArgs e)
351
    {
352
        ChangeMouseState(State.MouseOver);
353
        base.OnMouseEnter(e);
354
    }
355
    protected override void OnMouseUp(MouseEventArgs e)
356
    {
357
        ChangeMouseState(State.MouseOver);
358
        base.OnMouseUp(e);
359
    }
360
    protected override void OnMouseDown(MouseEventArgs e)
361
    {
362
        if (e.Button == MouseButtons.Left)
363
            ChangeMouseState(State.MouseDown);
364
        base.OnMouseDown(e);
365
    }
366
367
    private void ChangeMouseState(State e)
368
    {
369
        MouseState = e;
370
        Invalidate();
371
    }
372
373
    #endregion
374
375
    #region " Convienence "
376
377
    public abstract void PaintHook();
378
    protected override sealed void OnPaint(PaintEventArgs e)
379
    {
380
        if (Width == 0 || Height == 0)
381
            return;
382
        PaintHook();
383
        e.Graphics.DrawImage(B, 0, 0);
384
    }
385
386
    protected override void OnSizeChanged(EventArgs e)
387
    {
388
        if (!(Width == 0) && !(Height == 0))
389
        {
390
            B = new Bitmap(Width, Height);
391
            G = Graphics.FromImage(B);
392
            Invalidate();
393
        }
394
        base.OnSizeChanged(e);
395
    }
396
397
    private bool _NoRounding;
398
    public bool NoRounding
399
    {
400
        get { return _NoRounding; }
401
        set
402
        {
403
            _NoRounding = value;
404
            Invalidate();
405
        }
406
    }
407
408
    private Image _Image;
409
    public Image Image
410
    {
411
        get { return _Image; }
412
        set
413
        {
414
            _Image = value;
415
            Invalidate();
416
        }
417
    }
418
    public int ImageWidth
419
    {
420
        get
421
        {
422
            if (_Image == null)
423
                return 0;
424
            return _Image.Width;
425
        }
426
    }
427
    public int ImageTop
428
    {
429
        get
430
        {
431
            if (_Image == null)
432
                return 0;
433
            return Height / 2 - _Image.Height / 2;
434
        }
435
    }
436
437
    private Size _Size;
438
    private Rectangle _Rectangle;
439
    private LinearGradientBrush _Gradient;
440
441
    private SolidBrush _Brush;
442
    protected void DrawCorners(Color c, Rectangle rect)
443
    {
444
        if (_NoRounding)
445
            return;
446
447
        B.SetPixel(rect.X, rect.Y, c);
448
        B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c);
449
        B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c);
450
        B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c);
451
    }
452
453
    protected void DrawBorders(Pen p1, Pen p2, Rectangle rect)
454
    {
455
        G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
456
        G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3);
457
    }
458
459
    protected void DrawText(HorizontalAlignment a, Color c, int x)
460
    {
461
        DrawText(a, c, x, 0);
462
    }
463
    protected void DrawText(HorizontalAlignment a, Color c, int x, int y)
464
    {
465
        if (string.IsNullOrEmpty(Text))
466
            return;
467
        _Size = G.MeasureString(Text, Font).ToSize();
468
        _Brush = new SolidBrush(c);
469
470
        switch (a)
471
        {
472
            case HorizontalAlignment.Left:
473
                G.DrawString(Text, Font, _Brush, x, Height / 2 - _Size.Height / 2 + y);
474
                break;
475
            case HorizontalAlignment.Right:
476
                G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height / 2 - _Size.Height / 2 + y);
477
                break;
478
            case HorizontalAlignment.Center:
479
                G.DrawString(Text, Font, _Brush, Width / 2 - _Size.Width / 2 + x, Height / 2 - _Size.Height / 2 + y);
480
                break;
481
        }
482
    }
483
484
    protected void DrawIcon(HorizontalAlignment a, int x)
485
    {
486
        DrawIcon(a, x, 0);
487
    }
488
    protected void DrawIcon(HorizontalAlignment a, int x, int y)
489
    {
490
        if (_Image == null)
491
            return;
492
        switch (a)
493
        {
494
            case HorizontalAlignment.Left:
495
                G.DrawImage(_Image, x, Height / 2 - _Image.Height / 2 + y);
496
                break;
497
            case HorizontalAlignment.Right:
498
                G.DrawImage(_Image, Width - _Image.Width - x, Height / 2 - _Image.Height / 2 + y);
499
                break;
500
            case HorizontalAlignment.Center:
501
                G.DrawImage(_Image, Width / 2 - _Image.Width / 2, Height / 2 - _Image.Height / 2);
502
                break;
503
        }
504
    }
505
506
    protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
507
    {
508
        _Rectangle = new Rectangle(x, y, width, height);
509
        _Gradient = new LinearGradientBrush(_Rectangle, c1, c2, angle);
510
        G.FillRectangle(_Gradient, _Rectangle);
511
    }
512
    #endregion
513
514
}
515
abstract class ThemeContainerControl : ContainerControl
516
{
517
518
    #region " Initialization "
519
520
    protected Graphics G;
521
    protected Bitmap B;
522
    public ThemeContainerControl()
523
    {
524
        SetStyle((ControlStyles)139270, true);
525
        B = new Bitmap(1, 1);
526
        G = Graphics.FromImage(B);
527
    }
528
529
    public void AllowTransparent()
530
    {
531
        SetStyle(ControlStyles.Opaque, false);
532
        SetStyle(ControlStyles.SupportsTransparentBackColor, true);
533
    }
534
535
    #endregion
536
537
    #region " Convienence "
538
539
    public abstract void PaintHook();
540
    protected override sealed void OnPaint(PaintEventArgs e)
541
    {
542
        if (Width == 0 || Height == 0)
543
            return;
544
        PaintHook();
545
        e.Graphics.DrawImage(B, 0, 0);
546
    }
547
548
    protected override void OnSizeChanged(EventArgs e)
549
    {
550
        if (!(Width == 0) && !(Height == 0))
551
        {
552
            B = new Bitmap(Width, Height);
553
            G = Graphics.FromImage(B);
554
            Invalidate();
555
        }
556
        base.OnSizeChanged(e);
557
    }
558
559
    private bool _NoRounding;
560
    public bool NoRounding
561
    {
562
        get { return _NoRounding; }
563
        set
564
        {
565
            _NoRounding = value;
566
            Invalidate();
567
        }
568
    }
569
570
    private Rectangle _Rectangle;
571
572
    private LinearGradientBrush _Gradient;
573
    protected void DrawCorners(Color c, Rectangle rect)
574
    {
575
        if (_NoRounding)
576
            return;
577
        B.SetPixel(rect.X, rect.Y, c);
578
        B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c);
579
        B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c);
580
        B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c);
581
    }
582
583
    protected void DrawBorders(Pen p1, Pen p2, Rectangle rect)
584
    {
585
        G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
586
        G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3);
587
    }
588
589
    protected void DrawGradient(Color c1, Color c2, int x, int y, int width, int height, float angle)
590
    {
591
        _Rectangle = new Rectangle(x, y, width, height);
592
        _Gradient = new LinearGradientBrush(_Rectangle, c1, c2, angle);
593
        G.FillRectangle(_Gradient, _Rectangle);
594
    }
595
    #endregion
596
597
}
598
public class Draw
599
{
600
    public static void Gradient(Graphics g, Color c1, Color c2, int x, int y, int width, int height)
601
    {
602
        Rectangle R = new Rectangle(x, y, width, height);
603
        using (LinearGradientBrush T = new LinearGradientBrush(R, c1, c2, LinearGradientMode.Vertical))
604
        {
605
            g.FillRectangle(T, R);
606
        }
607
    }
608
    public static void Gradient(Graphics g, Color c1, Color c2, Rectangle r)
609
    {
610
        using (LinearGradientBrush T = new LinearGradientBrush(r, c1, c2, LinearGradientMode.Vertical))
611
        {
612
            g.FillRectangle(T, r);
613
        }
614
    }
615
    public static void Blend(Graphics g, Color c1, Color c2, Color c3, float c, int d, int x, int y, int width, int height)
616
    {
617
        ColorBlend v = new ColorBlend(3);
618
        v.Colors = new Color[] {
619
			c1,
620
			c2,
621
			c3
622
		};
623
        v.Positions = new float[] {
624
			0,
625
			c,
626
			1
627
		};
628
        Rectangle R = new Rectangle(x, y, width, height);
629
        using (LinearGradientBrush T = new LinearGradientBrush(R, c1, c1, (LinearGradientMode)d))
630
        {
631
            T.InterpolationColors = v;
632
            g.FillRectangle(T, R);
633
        }
634
    }
635
    public static GraphicsPath RoundedRectangle(int x, int y, int width, int height, int cornerwidth, int PenWidth)
636
    {
637
        GraphicsPath p = new GraphicsPath();
638
        p.StartFigure();
639
        p.AddArc(new Rectangle(x, y, cornerwidth, cornerwidth), 180, 90);
640
        p.AddLine(cornerwidth, y, width - cornerwidth - PenWidth, y);
641
642
        p.AddArc(new Rectangle(width - cornerwidth - PenWidth, y, cornerwidth, cornerwidth), -90, 90);
643
        p.AddLine(width - PenWidth, cornerwidth, width - PenWidth, height - cornerwidth - PenWidth);
644
645
        p.AddArc(new Rectangle(width - cornerwidth - PenWidth, height - cornerwidth - PenWidth, cornerwidth, cornerwidth), 0, 90);
646
        p.AddLine(width - cornerwidth - PenWidth, height - PenWidth, cornerwidth, height - PenWidth);
647
648
        p.AddArc(new Rectangle(x, height - cornerwidth - PenWidth, cornerwidth, cornerwidth), 90, 90);
649
        p.CloseFigure();
650
651
        return p;
652
    }
653
654
655
    public static void BackGround(int width, int height, Graphics G)
656
    {
657
        Color P1 = Color.FromArgb(29, 25, 22);
658
        Color P2 = Color.FromArgb(35, 31, 28);
659
660
        for (int y = 0; y <= height; y += 4)
661
        {
662
            for (int x = 0; x <= width; x += 4)
663
            {
664
                G.FillRectangle(new SolidBrush(P1), new Rectangle(x, y, 1, 1));
665
                G.FillRectangle(new SolidBrush(P2), new Rectangle(x, y + 1, 1, 1));
666
                try
667
                {
668
                    G.FillRectangle(new SolidBrush(P1), new Rectangle(x + 2, y + 2, 1, 1));
669
                    G.FillRectangle(new SolidBrush(P2), new Rectangle(x + 2, y + 3, 1, 1));
670
                }
671
                catch
672
                {
673
                }
674
            }
675
        }
676
    }
677
}
678
class PurityxTheme : Theme
679
{
680
681
    public PurityxTheme()
682
    {
683
        Resizable = false;
684
        BackColor = Color.FromKnownColor(KnownColor.Control);
685
        MoveHeight = 25;
686
        TransparencyKey = Color.Fuchsia;
687
    }
688
689
    public override void PaintHook()
690
    {
691
        G.Clear(BackColor);
692
        // Clear the form first
693
694
        //DrawGradient(Color.FromArgb(64, 64, 64), Color.FromArgb(32, 32, 32), 0, 0, Width, Height, 90S)   ' Form Gradient
695
        G.Clear(Color.FromArgb(60, 60, 60));
696
        DrawGradient(Color.FromArgb(45, 40, 45), Color.FromArgb(32, 32, 32), 0, 0, Width, 25, 90);
697
        // Form Top Bar
698
699
        G.DrawLine(Pens.Black, 0, 25, Width, 25);
700
        // Top Line
701
        //G.DrawLine(Pens.Black, 0, Height - 25, Width, Height - 25)   ' Bottom Line
702
703
        DrawCorners(Color.Fuchsia, ClientRectangle);
704
        // Then draw some clean corners
705
        DrawBorders(Pens.Black, Pens.DimGray, ClientRectangle);
706
        // Then we draw our form borders
707
708
        DrawText(HorizontalAlignment.Left, Color.Red, 7, 1);
709
        // Finally, we draw our text
710
    }
711
}
712
// Theme Code
713
class PurityxButton : ThemeControl
714
{
715
716
    public override void PaintHook()
717
    {
718
        switch (MouseState)
719
        {
720
            case State.MouseNone:
721
                G.Clear(Color.Red);
722
                DrawGradient(Color.FromArgb(62, 62, 62), Color.FromArgb(38, 38, 38), 0, 0, Width, Height, 90);
723
                break;
724
            case State.MouseOver:
725
                G.Clear(Color.Red);
726
                DrawGradient(Color.FromArgb(62, 62, 62), Color.FromArgb(38, 38, 38), 0, 0, Width, Height, 90);
727
                break;
728
            case State.MouseDown:
729
                G.Clear(Color.DarkRed);
730
                DrawGradient(Color.FromArgb(38, 38, 38), Color.FromArgb(62, 62, 62), 0, 0, Width, Height, 90);
731
                break;
732
        }
733
734
        DrawBorders(Pens.Black, Pens.DimGray, ClientRectangle);
735
        // Form Border
736
        DrawCorners(Color.Black, ClientRectangle);
737
        // Clean Corners
738
        DrawText(HorizontalAlignment.Center, Color.Red, 0);
739
    }
740
}
741
// Button Code
742
public class PurityxLabel : Label
743
{
744
    public PurityxLabel()
745
    {
746
        Font = new Font("Arial", 8);
747
        ForeColor = Color.Red;
748
        BackColor = Color.Transparent;
749
    }
750
}
751
// Label Code
752
public class PurityxSeperator : Control
753
{
754
755
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
756
    {
757
        using (Bitmap b = new Bitmap(Width, Height))
758
        {
759
            using (Graphics g = Graphics.FromImage(b))
760
            {
761
                g.Clear(BackColor);
762
763
                Color P1 = Color.FromArgb(255, 255, 255);
764
                Color P2 = Color.FromArgb(255, 255, 255);
765
                g.FillRectangle(new SolidBrush(Color.FromArgb(60, 60, 60)), new Rectangle(0, 0, Width, Height));
766
767
768
                Rectangle GRec = new Rectangle(0, Height / 2, Width / 5, 2);
769
                using (LinearGradientBrush GBrush = new LinearGradientBrush(GRec, Color.Transparent, P2, LinearGradientMode.Horizontal))
770
                {
771
                    g.FillRectangle(GBrush, GRec);
772
                }
773
                g.DrawLine(new Pen(P2, 2), new Point(GRec.Width, GRec.Y + 1), new Point(Width - GRec.Width + 1, GRec.Y + 1));
774
775
                GRec = new Rectangle(Width - (Width / 5), Height / 2, Width / 5, 2);
776
                using (LinearGradientBrush GBrush = new LinearGradientBrush(GRec, P2, Color.Transparent, LinearGradientMode.Horizontal))
777
                {
778
                    g.FillRectangle(GBrush, GRec);
779
                }
780
                e.Graphics.DrawImage(b, 0, 0);
781
            }
782
        }
783
        base.OnPaint(e);
784
    }
785
}
786
// Seperator Code
787
class PurityxGroupbox : Panel
788
{
789
    Color Bg = Color.FromArgb(62, 62, 62);
790
    Color PC2 = Color.FromArgb(204, 204, 204);
791
    Color FC = Color.FromArgb(204, 204, 204);
792
    Pen p;
793
    SolidBrush sb;
794
    public PurityxGroupbox()
795
    {
796
        BackColor = Bg;
797
    }
798
    string _t = "";
799
    public string Header
800
    {
801
        get { return _t; }
802
        set
803
        {
804
            _t = value;
805
            Invalidate();
806
        }
807
    }
808
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
809
    {
810
        using (Bitmap b = new Bitmap(Width, Height))
811
        {
812
            using (Graphics g = Graphics.FromImage(b))
813
            {
814
                p = new Pen(PC2);
815
                sb = new SolidBrush(Bg);
816
                SizeF M = g.MeasureString(_t, Font);
817
                GraphicsPath Outline = Draw.RoundedRectangle(0, (int)M.Height / 2, Width - 1, Height - 1, 10, 1);
818
                g.Clear(BackColor);
819
                g.FillRectangle(sb, new Rectangle(0, (int)M.Height / 2, Width - 1, Height - 1));
820
                g.DrawPath(p, Outline);
821
                g.FillRectangle(sb, new Rectangle(10, (int)(M.Height / 2) - 2, (int)M.Width + 10, (int)M.Height));
822
                sb = new SolidBrush(FC);
823
                g.DrawString(base.Text, base.Font, Brushes.White, 7, 1);
824
                e.Graphics.DrawImage(b, 0, 0);
825
            }
826
        }
827
        base.OnPaint(e);
828
    }
829
}
830
// GroupBox Code