forked from Alkazuz/AdvancedBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
About.cs
141 lines (120 loc) · 4.53 KB
/
About.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Drawing.Drawing2D;
namespace AdvancedBot
{
public partial class About : Form
{
CPoint[] stars = new CPoint[512];
Random rand = new Random();
Rectangle drawImgRect;
SolidBrush brushGray = new SolidBrush(Color.FromArgb(230, 230, 230));
Font arial10bold = new Font("Arial", 10, FontStyle.Bold);
int j = 0;
Bitmap logo;
string[] txtLns = new string[] { "AdvancedBot "+Program.AppVersion + " data: " + Program.GetBuildDate().ToString("dd/MM/yyyy"),
"Desenvolvido por: DarkSkeleton & Alkazuz"};
public About()
{
InitializeComponent();
int w = ClientSize.Width;
int h = ClientSize.Height;
for (int i = 0; i < stars.Length; i++)
stars[i] = new CPoint(rand.Next(w), rand.Next(h));
DoubleBuffered = true;
logo = new Bitmap(1, 1);// AdvancedBot.Properties.Resources.logo;
drawImgRect = new Rectangle((w / 2) - (logo.Width / 2), (h / 2) - (logo.Height / 2), 201, 72);
FormClosing += (s, e) => logo.Dispose();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.Clear(Color.Black);
int w = ClientSize.Width;
int h = ClientSize.Height;
int w2 = w / 2;
int h2 = h / 2;
for (int i = 0; i < stars.Length; i++)
{
CPoint pt = stars[i];
if (pt.X < 0 || pt.Y < 0 || pt.X > w || pt.Y > h)
{
do {
pt.X = rand.Next(w);
pt.Y = rand.Next(h);
} while ((int)pt.X == w2 && (int)pt.Y == h2);
} else {
float x1 = pt.X;
float y1 = pt.Y;
pt.X += (pt.X > w2 ? 1 : -1) * Math.Abs(w2 - pt.X) * 0.07f;
pt.Y += (pt.Y > h2 ? 1 : -1) * Math.Abs(h2 - pt.Y) * 0.07f;
using (LinearGradientBrush br = new LinearGradientBrush(new PointF(x1, y1), new PointF(pt.X, pt.Y), Color.Black, Color.White))
{
br.WrapMode = WrapMode.TileFlipX;
using (Pen pen = new Pen(br))
g.DrawLine(pen, x1, y1, pt.X, pt.Y);
}
}
}
for (int i = 0; i < w; i++)
{
using (SolidBrush br = new SolidBrush(HSL((w - i + j) / 360.0)))
{
g.FillRectangle(br, i, 0, 1, 1);
g.FillRectangle(br, i, h - 1, 1, 1);
}
}
for (int i = 0; i < txtLns.Length;i++)
{
string txt = txtLns[i];
int txtW = (int)g.MeasureString(txt, arial10bold).Width;
g.DrawString(txt, arial10bold, brushGray, new Point((w / 2) - (txtW / 2), (h-(16*txtLns.Length)) + (i * 15)));
}
g.DrawImage(logo, drawImgRect);
j = (j + 16) % 360;
}
private static Color HSL(double hue)
{
double div = (Math.Abs(hue % 1) * 6);
int ascending = (int)((div % 1) * 255);
int descending = 255 - ascending;
switch ((int)div)
{
case 0: return Color.FromArgb(255, 255, ascending, 0);
case 1: return Color.FromArgb(255, descending, 255, 0);
case 2: return Color.FromArgb(255, 0, 255, ascending);
case 3: return Color.FromArgb(255, 0, descending, 255);
case 4: return Color.FromArgb(255, ascending, 0, 255);
default: return Color.FromArgb(255, 255, 0, descending);
}
}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
}
private void timer1_Tick(object sender, EventArgs e)
{
Invalidate();
}
private class CPoint
{
public float X, Y;
public CPoint(float x, float y)
{
X = x;
Y = y;
}
}
private void About_Load(object sender, EventArgs e)
{
}
}
}