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.IO; namespace GamerServices { public partial class FormAbout : Form { public float TextHeight; public String[] TextLines; public FormAbout() { InitializeComponent(); this.TextHeight = Stage.Height + 6; this.TextLines = File.ReadAllText("Media/Credits.txt").Split('\n'); } private void buttonClose_Click(object sender, EventArgs e) { this.Close(); } private void FormAbout_Load(object sender, EventArgs e) { this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); } private void Stage_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.Clear(this.BackColor); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; for (int i = 0; i < this.TextLines.Length; i++) { Font font = this.fontLabel.Font; if (this.TextLines[i].StartsWith("[B]")) font = new Font(font, FontStyle.Bold); if (this.TextLines[i].StartsWith("[H1]")) font = new Font(font.FontFamily, 20, FontStyle.Bold); if (this.TextLines[i].StartsWith("[H2]")) font = new Font(font.FontFamily, 16, FontStyle.Bold); g.DrawString(this.TextLines[i].Replace("[B]", "").Replace("[H1]", "").Replace("[H2]", ""), font, Brushes.Black, new PointF(Stage.Width / 2f, (this.fontLabel.Font.Size + 2) * i + this.TextHeight), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); } } private void timerUpdate_Tick(object sender, EventArgs e) { this.TextHeight -= 0.5f; if (this.TextHeight < -((this.fontLabel.Font.Size + 2) * this.TextLines.Length)) this.TextHeight = Stage.Height + 6; Stage.Invalidate(); } } }