86 lines
2.5 KiB
C#
86 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Deckungsbeitrag
|
|
{
|
|
public partial class FormHelp : Form
|
|
{
|
|
string[] Keys;
|
|
string[] KeyBesch;
|
|
int abstandSeite = 100;
|
|
int abstand = 20;
|
|
int abstandZwischen = 5;
|
|
|
|
public FormHelp()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Übergeben von string[] KeyWord und string[] Beschreibung
|
|
/// </summary>
|
|
/// <param name="keys"></param>
|
|
/// <param name="keytext"></param>
|
|
public FormHelp(string[] keys, string[] keytext) : this()
|
|
{
|
|
this.Keys = keys;
|
|
this.KeyBesch = keytext;
|
|
}
|
|
|
|
private void FormHelp_Load(object sender, EventArgs e)
|
|
{
|
|
Size longestkey = new Size(0, 0);
|
|
Point location = new Point(0, 0);
|
|
|
|
// KeyWords verarbeiten und als Label einblenden
|
|
for (int i = 0; i < Keys.Length; i++)
|
|
{
|
|
Label lbl = new Label();
|
|
lbl.Name = $"lblKey{i + 1}";
|
|
lbl.Text = Keys[i];
|
|
lbl.Tag = Keys[i];
|
|
lbl.Font = new Font(lbl.Font.FontFamily, 12, FontStyle.Bold);
|
|
lbl.Size = TextRenderer.MeasureText(lbl.Text, lbl.Font);
|
|
if (i == 0) lbl.Location = new Point(abstandSeite, abstand);
|
|
else lbl.Location = new Point(abstandSeite, abstand + (lbl.Height + abstandZwischen) * i);
|
|
|
|
if(lbl.Width > longestkey.Width) longestkey.Width = lbl.Width;
|
|
this.Controls.Add(lbl);
|
|
}
|
|
|
|
// KeyBeschreibung verarbeiten und als label einblenden.
|
|
for (int i = 0; i < KeyBesch.Length; i++)
|
|
{
|
|
Label lbl = new Label();
|
|
lbl.Name = $"lblBesch{i + 1}";
|
|
lbl.Text = KeyBesch[i];
|
|
lbl.Tag = KeyBesch[i];
|
|
lbl.Font = new Font(lbl.Font.FontFamily, 12);
|
|
lbl.Size = TextRenderer.MeasureText(lbl.Text, lbl.Font);
|
|
if (i == 0) lbl.Location = new Point(abstandSeite + longestkey.Width + 10, abstand);
|
|
else lbl.Location = new Point((abstandSeite + longestkey.Width + 10), abstand + (lbl.Height + abstandZwischen) * i);
|
|
|
|
if(lbl.Right > location.X) location.X = lbl.Right;
|
|
if(lbl.Bottom > location.Y) location.Y = lbl.Bottom;
|
|
this.Controls.Add(lbl);
|
|
}
|
|
|
|
// Größe des Fensters bestimmen.
|
|
this.Width = location.X + abstandSeite;
|
|
this.Height = location.Y + buttonOK.Height + 50;
|
|
}
|
|
|
|
private void buttonOK_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|