public Splash(Bitmap resource, SplashData data) { Data = data; Resource = resource; ClientSize = new Size(Resource.Width, resource.Height); this.Click += Close; Controls.Add(new Label() { Text = "Plugin", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 20 }); Controls.Add(new Label() { Text = "Version", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 40 }); Controls.Add(new Label() { Text = "Developer", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 70 }); Controls.Add(new Label() { Text = "Website", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 90 }); Controls.Add(new Label() { Text = Data.Plugin, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 20 }); Controls.Add(new Label() { Text = Data.Version, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 40 }); Controls.Add(new Label() { Text = Data.Developer, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 70, }); var website = new Label() { Text = Data.Website, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 90, Cursor = Cursors.Hand }; Controls.Add(website); website.Click += website_Click; website.MouseEnter += (s, e) => { ((Label)s).ForeColor = Color.CornflowerBlue; }; website.MouseLeave += (s, e) => { ((Label)s).ForeColor = Color.White; }; foreach (var ctrl in Controls) { if (!(ctrl is Label)) { continue; } var label = (Label)ctrl; label.BackColor = Color.Transparent; label.Font = new Font("Arial", this.Font.Size); label.ForeColor = Color.White; if (label != website) { label.Click += Close; } } }
void about_Click(object sender, EventArgs e) { var info = Rodent.DeviceInfo; var data = new SplashData() { Developer = info.Developer, Plugin = info.Name, Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), Website = "www.analogwindow.com" }; var splash = new Splash(SplashBitmap, data); splash.Left = Width / 2 - splash.Width / 2; splash.Top = TopH + (Height - TopH) / 2 - splash.Height / 2; Controls.Add(splash); splash.BringToFront(); }
public Splash(Bitmap resource, SplashData data) { Data = data; Resource = resource; ClientSize = new Size(Resource.Width, resource.Height); this.Click += Close; Controls.Add(new Label() { Text = "Plugin", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 20 }); Controls.Add(new Label() { Text = "Version", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 40 }); Controls.Add(new Label() { Text = "Developer", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 70 }); Controls.Add(new Label() { Text = "Website", TextAlign = ContentAlignment.MiddleRight, AutoSize = false, Width = 110, Height = 25, Left = 0, Top = 90 }); Controls.Add(new Label() { Text = Data.Plugin, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 20 }); Controls.Add(new Label() { Text = Data.Version, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 40 }); Controls.Add(new Label() { Text = Data.Developer, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 70, }); var website = new Label() { Text = Data.Website, TextAlign = ContentAlignment.MiddleLeft, AutoSize = false, Width = 150, Height = 25, Left = 135, Top = 90, Cursor = Cursors.Hand }; Controls.Add(website); website.Click += website_Click; website.MouseEnter += (s, e) => { ((Label)s).ForeColor = Color.CornflowerBlue; }; website.MouseLeave += (s, e) => { ((Label)s).ForeColor = Color.White; }; foreach(var ctrl in Controls) { if (!(ctrl is Label)) continue; var label = (Label)ctrl; label.BackColor = Color.Transparent; label.Font = new Font("Arial", this.Font.Size); label.ForeColor = Color.White; if (label != website) label.Click += Close; } }