topmostfriend/TopMostFriend/AboutWindow.cs

107 lines
4.6 KiB
C#
Raw Permalink Normal View History

2022-08-25 23:53:17 +00:00
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace TopMostFriend {
public sealed class AboutWindow : Form {
private const int BUTTON_SPACING = 6;
private const int GENERAL_PADDING = 12;
private const int BUTTON_HEIGHT = 23;
private const int BUTTON_WIDTH = 70;
public static void Display() {
using (AboutWindow about = new AboutWindow())
about.ShowDialog();
}
public AboutWindow() {
2022-08-25 23:54:01 +00:00
Text = @"About Top Most Friend";
2022-08-25 23:53:17 +00:00
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
BackgroundImage = Properties.Resources.about;
StartPosition = FormStartPosition.CenterScreen;
FormBorderStyle = FormBorderStyle.None;
AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = Properties.Resources.about.Size;
MaximizeBox = MinimizeBox = false;
MaximumSize = MinimumSize = Size;
int tabIndex = 0;
Button closeButton = new Button {
Text = @"Close",
Size = new Size(BUTTON_WIDTH, BUTTON_HEIGHT),
TabIndex = ++tabIndex,
};
closeButton.Location = new Point(ClientSize.Width - closeButton.Size.Width - GENERAL_PADDING, ClientSize.Height - closeButton.Size.Height - GENERAL_PADDING);
closeButton.Click += (s, e) => Close();
Controls.Add(closeButton);
Button websiteButton = new Button {
Text = @"Website",
Size = new Size(BUTTON_WIDTH, BUTTON_HEIGHT),
TabIndex = ++tabIndex,
};
websiteButton.Location = new Point(closeButton.Left - websiteButton.Width - BUTTON_SPACING, closeButton.Top);
websiteButton.Click += (s, e) => Process.Start(@"https://flash.moe/topmostfriend");
Controls.Add(websiteButton);
2022-08-25 23:59:00 +00:00
Button donateButton = new Button {
Text = @"Donate",
Size = new Size(BUTTON_WIDTH, BUTTON_HEIGHT),
TabIndex = ++tabIndex,
};
donateButton.Location = new Point(websiteButton.Left - donateButton.Width - BUTTON_SPACING, closeButton.Top);
donateButton.Click += (s, e) => Process.Start(@"https://flash.moe/donate");
Controls.Add(donateButton);
2022-08-25 23:53:17 +00:00
Button creditButton = new Button {
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
Text = string.Empty,
Size = new Size(300, 15),
TabIndex = ++tabIndex,
Cursor = Cursors.Hand,
FlatStyle = FlatStyle.Flat,
BackColor = Color.Transparent,
};
creditButton.FlatAppearance.BorderSize = 0;
creditButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
creditButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
creditButton.Location = new Point(ClientSize.Width - creditButton.Size.Width - GENERAL_PADDING, 46);
creditButton.Click += (s, e) => Process.Start(@"https://flash.moe");
Button creditButtonfff = new Button {
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
Text = string.Empty,
Size = new Size(300, 15),
TabIndex = ++tabIndex,
Cursor = Cursors.Hand,
FlatStyle = FlatStyle.Flat,
BackColor = Color.Transparent,
};
creditButtonfff.FlatAppearance.BorderSize = 0;
creditButtonfff.FlatAppearance.MouseOverBackColor = Color.Transparent;
creditButtonfff.FlatAppearance.MouseDownBackColor = Color.Transparent;
creditButtonfff.Location = new Point(ClientSize.Width - creditButtonfff.Size.Width - GENERAL_PADDING, 64);
creditButtonfff.Click += (s, e) => Process.Start(@"http://www.famfamfam.com/lab/icons/silk/");
Controls.Add(creditButtonfff);
Controls.Add(new Label {
2022-08-25 23:54:01 +00:00
Text = @"v" + Application.ProductVersion.Substring(0, Application.ProductVersion.Length - 2), // cut off the last dingus
2022-08-25 23:53:17 +00:00
TextAlign = ContentAlignment.MiddleLeft,
AutoSize = true,
Location = new Point(127, 97),
BackColor = Color.Transparent,
ForeColor = Color.White,
});
}
protected override void OnMouseDown(MouseEventArgs e) {
base.OnMouseDown(e);
2022-08-25 23:54:01 +00:00
Win32.ReleaseCapture();
Win32.SendMessage(Handle, Win32.WM_NCLBUTTONDOWN, Win32.HT_CAPTION, 0);
2022-08-25 23:53:17 +00:00
}
}
}