-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormAboutMe.cs
80 lines (65 loc) · 2.8 KB
/
FormAboutMe.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
using System;
using System.Drawing;
using System.Windows.Forms;
namespace MechanicSimiulation3
{
public partial class FormAboutMe : Form
{
//Bitmap icon =new Bitmap(10,10);
Icon icon;
public FormAboutMe()
{
InitializeComponent();
try
{
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream stream =
assembly.GetManifestResourceStream("Mechanic_Simulations3.Planet3D.ico");
icon = new Icon(stream);
}
catch
{
}
this.Paint += new PaintEventHandler(FormAboutMe_Paint);
}
void FormAboutMe_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
int x = 20; int y = label1.Location.Y;
if(icon != null) g.DrawIcon(icon, x, y);
/* Font font = new System.Drawing.Font("Edwardian Script ITC", 30F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
Point pt = new Point(22, 40);
string st = "Designed by H.Dashti.";
g.DrawString(st, font, Brushes.Blue, pt);
SizeF size = g.MeasureString(st, font);
pt = new Point(pt.X +50, pt.Y + (int)size.Height+8);
font = new System.Drawing.Font("Times New Roman", icon.Height, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
st = "(Not yet Physicist)";
g.DrawString(st , font, Brushes.DarkBlue, pt);
if (icon != null)
{
size = g.MeasureString(st, font);
g.DrawIcon(icon, pt.X + (int)size.Width - 4, pt.Y + icon.Height / 3);
//g.DrawString(")", font, Brushes.DarkBlue, pt.X + size.Width + icon.Width-4, pt.Y);
}*/
//else
//{
// g.DrawString(")", font, Brushes.DarkBlue, pt.X + size.Width, pt.Y);
//}
}
const int dWidth = 25;
const int dHeigth = 10;
private void FormAboutMe_FormClosing(object sender, FormClosingEventArgs e)
{
int width = ClientSize.Width - dWidth;
int heigth = ClientSize.Height - dHeigth;
while (width > dWidth && heigth > dHeigth)
{
System.Threading.Thread.Sleep(10);
ClientSize = new Size(width, heigth);
width -= dWidth;
heigth -= dHeigth;
}
}
}
}