using DatenDB;
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 UCFach : UserControl
{
public string FachName
{
get => labelFach.Text;
set => labelFach.Text = value;
}
public string KundeName
{
get => labelKunde.Text;
set => labelKunde.Text = value;
}
public string LieferTag
{
get => labelLiefertag.Text;
set => labelLiefertag.Text = value;
}
public string Aufgabe
{
get => labelAufgabe.Text;
set => labelAufgabe.Text = value;
}
public UCFach()
{
InitializeComponent();
}
private void UCFach_Load(object sender, EventArgs e)
{
foreach(Label lbl in this.tableLayoutPanelUCFach.Controls)
{
lbl.Font = Funktionen.Get_Font_Size(lbl.Font, lbl.Text, GetCellSizeInPixels(tableLayoutPanelUCFach, 4, 1).Height);
}
}
///
/// Umrechnen der Prozentgröße der Zeile in Pixelhöhe (int).
///
///
///
///
///
public static Size GetCellSizeInPixels(TableLayoutPanel tlp, int column, int row)
{
float colPercent = 0;
float rowPercent = tlp.RowStyles[0].Height;
int pixelWidth = (int)colPercent;
int pixelHeight = rowPercent == 0 ? 0 : (int)(tlp.Height * (rowPercent / 100f));
return new Size(pixelWidth, pixelHeight);
}
}
}