AboutForm() { InitializeComponent(); Icon = AssemblyRoutines.GetAppIcon(); this.StartPosition = FormStartPosition.CenterParent; this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = AssemblyProduct; this.labelVersion.Text = "Version: " + AssemblyRoutines.GetAppVersion(); //String.Format("Version {0}", AssemblyVersion); this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = AssemblyCompany; this.textBoxDescription.Text = AssemblyDescription;// + "\r\n\r\nThis app is not intended and must not be used for any malicious activity!"; }
public MessageForm(string caption, Icon icon, string message, string[] buttons, int default_button, Form owner, bool button_auto_size = false) { InitializeComponent(); CreateHandle(); this.Icon = AssemblyRoutines.GetAppIcon(); this.MaximizeBox = true; Owner = owner; if (icon != null) { int w = icon.Width - image_box.Width; image_box.Image = (Image)icon.ToBitmap(); if (w > 0) { this.Width += w; this.message.Width -= w; this.message.Left = this.message.Left + w; } } this.Text = caption; this.message.Text = message; if (buttons != null) { for (int i = buttons.Length - 1; i >= 0; i--) { Button b = new Button(); b.Tag = i; b.Text = buttons[i]; b.AutoSize = true; b.Click += b_Click; flowLayoutPanel1.Controls.Add(b); if (i == default_button) { b.Select(); } } if (!button_auto_size) { Size max_size = new Size(0, 0); foreach (Button b in flowLayoutPanel1.Controls) { if (b.Width > max_size.Width) { max_size.Width = b.Width; } if (b.Height > max_size.Height) { max_size.Height = b.Height; } } foreach (Button b in flowLayoutPanel1.Controls) { b.AutoSize = false; b.Size = max_size; } } } //Size s = this.message.GetPreferredSize(new Size(Screen.PrimaryScreen.WorkingArea.Width * 3 / 4, Screen.PrimaryScreen.WorkingArea.Height * 3 / 4)); //this.Width = this.Width + s.Width - this.message.Width; //this.Height = this.Height + s.Height - this.message.Height; }