using System;
using System.Linq;
using System.Drawing;
using System.Windows.Forms;
namespace AceUtilities
{
public class infoStrings
{
private string programN, devN, companyN, creationD, descText;
public string programName
{
get { return programN; }
set { programN = CheckLength(value); }
}
public string developerName
{
get { return devN; }
set { devN = CheckLength(value); }
}
public string companyName
{
get { return companyN; }
set { companyN = CheckLength(value); }
}
public string creationDate
{
get { return creationD; }
set { creationD = CheckLength(value); }
}
public string descriptionText
{
get { return descText; }
set { descText = CheckLength(value); }
}
private const int Maxlen = 75;
private string CheckLength(string value)
{
return value.Length > Maxlen ? string.Concat(value.Take(75).ToArray()) + "..." : value;
}
}
public class AceInfoBox : Form
{
public AceInfoBox(infoStrings InformationStrs, Icon icon = null, string FormTitle = "Application Information")
{
this.Text = FormTitle;
this.Size = new Size(475, 150);
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Icon = icon ?? SystemIcons.Information;
SetLabels(InformationStrs);
}
private void SetLabels(infoStrings StrInfo)
{
int disp = 15;
int dispY = 20;
for (int i = 0; i < 5; i++)
{
Label lbl = new Label();
switch (i)
{
case 0:
lbl.Text = string.Format("Program Name - {0}", StrInfo.programName);
break;
case 1:
lbl.Text = string.Format("Developer Name - {0}", StrInfo.developerName);
break;
case 2:
lbl.Text = string.Format("Company Name - {0}", StrInfo.companyName);
break;
case 3:
lbl.Text = string.Format("Creation Date - {0}", StrInfo.creationDate);
break;
case 4:
lbl.Text = string.Format("Description - {0}", StrInfo.descriptionText);
break;
}
lbl.Location = new Point(15, disp);
disp += dispY;
lbl.Size = new Size(this.Width, 15);
this.Controls.Add(lbl);
}
}
}
}