Zusätzliche Option eingefügt

- Fenstergröße kann beim Aufruf definiert werden.
This commit is contained in:
Eugen Höglinger 2021-01-12 16:07:13 +01:00
parent 6bcc11895c
commit 7b78220c48
5 changed files with 101 additions and 4 deletions

View File

@ -112,8 +112,11 @@
this.Controls.Add(this.labelVersion);
this.Controls.Add(this.labelProgramName);
this.Controls.Add(this.pictureBox);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox";
this.ShowIcon = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Load += new System.EventHandler(this.AboutBox_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);

View File

@ -130,6 +130,14 @@ namespace Eugen.ESystem.Windows.Forms
SetContent(programName, programVersion, programCopyright); //Fensterinhalt setzen
}
/// <summary>
/// Displays a Program Information Box
/// </summary>
/// <param name="programName">A valid Program name.</param>
/// <param name="programVersion">A valid version number.</param>
/// <param name="programCopyright">The copyrigth Information</param>
/// <param name="showDllInfoButton">true = Button is displayed; false = Button is not displayed.</param>
public AboutBox(string programName, string programVersion, string programCopyright, bool showDllInfoButton)
{
InitializeComponent();
@ -154,7 +162,7 @@ namespace Eugen.ESystem.Windows.Forms
/// <param name="programName">A valid Program name.</param>
/// <param name="programVersion">A valid version number.</param>
/// <param name="programCopyright">The copyrigth Information</param>
/// <param name="icon"> valid icon in the size 32x32 dots with path. Larger icons are cropped. E.g.: C\:MyFolder\MyIcon.ico</param>
/// <param name="icon">A valid icon in the size 32x32 dots with path. Larger icons are cropped. E.g.: C\:MyFolder\MyIcon.ico</param>
/// <param name="showDllInfoButton">true = Button is displayed; false = Button is not displayed.</param>
public AboutBox(string programName, string programVersion, string programCopyright, Icon icon, bool showDllInfoButton)
{
@ -176,6 +184,59 @@ namespace Eugen.ESystem.Windows.Forms
SetContent(programName, programVersion, programCopyright); //Fensterinhalt setzen
}
/// <summary>
/// Displays a Program Information Box
/// </summary>
/// <param name="programName">A valid Program name.</param>
/// <param name="programVersion">A valid version number.</param>
/// <param name="programCopyright">The copyrigth Information</param>
/// <param name="icon">A valid icon in the size 32x32 dots with path. Larger icons are cropped. E.g.: C\:MyFolder\MyIcon.ico</param>
/// <param name="showDllInfoButton">true = Button is displayed; false = Button is not displayed.</param>
/// <param name="width">Window with: Min. 500, Max. 800.</param>
/// <param name="hight">Window hight: Min. 400, Max. 600.</param>
public AboutBox(string programName, string programVersion, string programCopyright, Icon icon, bool showDllInfoButton, int width, int hight)
{
InitializeComponent();
//Fenstergröße einstellen
if (width < 500)
{
width = 500;
}
if (width > 800)
{
width = 800;
}
if (hight < 400)
{
hight = 400;
}
if (hight > 600)
{
hight = 600;
}
this.Size = new Size(width, hight);
this.MaximumSize = new Size(width, hight);
this.MinimumSize = new Size(width, hight);
pictureBox.Image = Bitmap.FromHicon(new Icon(icon, new Size(32, 32)).Handle);
if (showDllInfoButton)
{
buttonDllInfo.Enabled = true;
buttonDllInfo.Visible = true;
}
else
{
buttonDllInfo.Enabled = false;
buttonDllInfo.Visible = false;
}
SetContent(programName, programVersion, programCopyright); //Fensterinhalt setzen
}
private void AboutBox_Load(object sender, EventArgs e)
{
DllInfoSelected = false;

View File

@ -310,13 +310,16 @@
<data name="&gt;&gt;labelDisclaimer.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="textBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<data name="textBox.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 162</value>
</data>
<data name="textBox.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="textBox.ScrollBars" type="System.Windows.Forms.ScrollBars, System.Windows.Forms">
<value>Vertical</value>
</data>
@ -341,6 +344,9 @@
<data name="&gt;&gt;textBox.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="buttonExport.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<data name="buttonExport.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 341</value>
</data>
@ -365,6 +371,9 @@
<data name="&gt;&gt;buttonExport.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="buttonClose.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="buttonClose.Location" type="System.Drawing.Point, System.Drawing">
<value>407, 341</value>
</data>
@ -392,6 +401,9 @@
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="buttonDllInfo.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="buttonDllInfo.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
@ -432,7 +444,7 @@
<value>492, 369</value>
</data>
<data name="$this.MaximumSize" type="System.Drawing.Size, System.Drawing">
<value>500, 400</value>
<value>800, 600</value>
</data>
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>500, 400</value>

View File

@ -35,6 +35,7 @@
this.labelDLLInfo = new System.Windows.Forms.Label();
this.buttonAboutWithDllInfo = new System.Windows.Forms.Button();
this.button1buttonAboutWithCustomerIconAndDllInfo = new System.Windows.Forms.Button();
this.buttonSize = new System.Windows.Forms.Button();
this.groupBoxProgramInfo.SuspendLayout();
this.groupBoxDLLInfo.SuspendLayout();
this.SuspendLayout();
@ -109,11 +110,22 @@
this.button1buttonAboutWithCustomerIconAndDllInfo.UseVisualStyleBackColor = true;
this.button1buttonAboutWithCustomerIconAndDllInfo.Click += new System.EventHandler(this.button1buttonAboutWithCustomerIconAndDllInfo_Click);
//
// buttonSize
//
this.buttonSize.Location = new System.Drawing.Point(12, 249);
this.buttonSize.Name = "buttonSize";
this.buttonSize.Size = new System.Drawing.Size(776, 23);
this.buttonSize.TabIndex = 13;
this.buttonSize.Text = "Über mit Customer Icon, DLL-Informationen und Größe 800x600 anzeigen";
this.buttonSize.UseVisualStyleBackColor = true;
this.buttonSize.Click += new System.EventHandler(this.buttonSize_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.buttonSize);
this.Controls.Add(this.button1buttonAboutWithCustomerIconAndDllInfo);
this.Controls.Add(this.buttonAboutWithDllInfo);
this.Controls.Add(this.groupBoxProgramInfo);
@ -139,5 +151,6 @@
private System.Windows.Forms.Label labelDLLInfo;
private System.Windows.Forms.Button buttonAboutWithDllInfo;
private System.Windows.Forms.Button button1buttonAboutWithCustomerIconAndDllInfo;
private System.Windows.Forms.Button buttonSize;
}
}

View File

@ -146,9 +146,17 @@ namespace Eugen.ESystem.Windows.Forms
private void button1buttonAboutWithCustomerIconAndDllInfo_Click(object sender, EventArgs e)
{
// Zeigt das 'AboutBox' Fenster mit Customer Icon und DLL-Informationen an
Icon icon = new Icon(@"H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\AboutBox.git\Daten\Customer.ico");
Icon icon = new Icon(@"H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AboutBox.git\Daten\Customer.ico");
var aboutDll = new AboutBox(ProgramName, ProgramVersion, Copyright, icon, true);
aboutDll.ShowDialog();
}
private void buttonSize_Click(object sender, EventArgs e)
{
// Zeigt das 'AboutBox' Fenster mit Customer Icon, DLL-Informationen und der Größe 800x600 an
Icon icon = new Icon(@"H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AboutBox.git\Daten\Customer.ico");
var aboutDll = new AboutBox(ProgramName, ProgramVersion, Copyright, icon, true, 800, 600);
aboutDll.ShowDialog();
}
}
}