92 lines
4.1 KiB
C#
92 lines
4.1 KiB
C#
using DatenDB;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Configuration;
|
|
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 FormFahrerAuftrag : Form
|
|
{
|
|
public Benutzer fahrer;
|
|
public List<Benutzer> fahrerlist;
|
|
public FormFahrerAuftrag()
|
|
{
|
|
InitializeComponent();
|
|
|
|
fahrerlist = Benutzer.GetFahrerList();
|
|
|
|
this.labelFahrer1.Text = fahrerlist[0].Vorname + " " + fahrerlist[0].Nachname;
|
|
this.labelFahrer2.Text = fahrerlist[1].Vorname + " " + fahrerlist[1].Nachname;
|
|
this.labelFahrer3.Text = fahrerlist[2].Vorname + " " + fahrerlist[2].Nachname;
|
|
this.labelFahrer4.Text = fahrerlist[3].Vorname + " " + fahrerlist[3].Nachname;
|
|
|
|
|
|
panele_aufteilen();
|
|
}
|
|
private void get_fahrerauftrag_Count()
|
|
{
|
|
foreach(Control ctr in this.panelFahrer1.Controls)
|
|
{
|
|
|
|
}
|
|
this.labelAnzFahrer1.Text = this.panelFahrer1.Controls.Count.ToString();
|
|
this.labelAnzFahrer2.Text = this.panelFahrer2.Controls.Count.ToString();
|
|
this.labelAnzFahrer3.Text = this.panelFahrer3.Controls.Count.ToString();
|
|
this.labelAnzFahrer4.Text = this.panelFahrer4.Controls.Count.ToString();
|
|
this.labelAnzAlleFahrer.Text = this.panelAlleFahrer.Controls.Count.ToString();
|
|
}
|
|
private void panele_aufteilen()
|
|
{
|
|
this.panelAlleFahrer.Location = new Point(10, 45);
|
|
this.panelAlleFahrer.Size = new Size(this.Width - 35, 200);
|
|
|
|
int panele = -1;
|
|
foreach(Control ctr in this.Controls) if (ctr.GetType() == typeof(FlowLayoutPanel)) panele++;
|
|
Size panelsize = new Size((this.Width - 50) / panele, this.Height - 150 - panelAlleFahrer.Height);
|
|
int panellocationY = panelAlleFahrer.Location.Y + panelAlleFahrer.Height + 50;
|
|
|
|
this.panelFahrer1.Location = new Point(10, panellocationY);
|
|
this.panelFahrer2.Location = new Point(panelFahrer1.Location.X + panelsize.Width + 5, panellocationY);
|
|
this.panelFahrer3.Location = new Point(panelFahrer2.Location.X + panelsize.Width + 5, panellocationY);
|
|
this.panelFahrer4.Location = new Point(panelFahrer3.Location.X + panelsize.Width + 5, panellocationY);
|
|
|
|
foreach(Control ctr in this.Controls)
|
|
{
|
|
if(ctr.GetType() == typeof(FlowLayoutPanel))
|
|
{
|
|
FlowLayoutPanel panel = (FlowLayoutPanel)ctr;
|
|
if (panel.Name != "panelAlleFahrer") panel.Size = new Size(panelsize.Width, panelsize.Height);
|
|
}
|
|
if(ctr.GetType() == typeof(Label))
|
|
{
|
|
Label label = (Label)ctr;
|
|
if (label.Name == "labelFahrer1") label.Location = new Point(panelFahrer1.Location.X, panelFahrer1.Location.Y - label.Height);
|
|
if (label.Name == "labelFahrer2") label.Location = new Point(panelFahrer2.Location.X, panelFahrer2.Location.Y - label.Height);
|
|
if (label.Name == "labelFahrer3") label.Location = new Point(panelFahrer3.Location.X, panelFahrer3.Location.Y - label.Height);
|
|
if (label.Name == "labelFahrer4") label.Location = new Point(panelFahrer4.Location.X, panelFahrer4.Location.Y - label.Height);
|
|
if (label.Name == "labelAlleFahrer") label.Location = new Point(panelAlleFahrer.Location.X, panelAlleFahrer.Location.Y - label.Height);
|
|
|
|
if (label.Name == "labelAnzFahrer1") label.Location = new Point(panelFahrer1.Location.X + panelsize.Width - label.Width, panelFahrer1.Location.Y - label.Height);
|
|
if (label.Name == "labelAnzFahrer2") label.Location = new Point(panelFahrer2.Location.X + panelsize.Width - label.Width, panelFahrer2.Location.Y - label.Height);
|
|
if (label.Name == "labelAnzFahrer3") label.Location = new Point(panelFahrer3.Location.X + panelsize.Width - label.Width, panelFahrer3.Location.Y - label.Height);
|
|
if (label.Name == "labelAnzFahrer4") label.Location = new Point(panelFahrer4.Location.X + panelsize.Width - label.Width, panelFahrer4.Location.Y - label.Height);
|
|
if (label.Name == "labelAnzAlleFahrer") label.Location = new Point(panelAlleFahrer.Location.X + panelAlleFahrer.Size.Width - label.Width, panelAlleFahrer.Location.Y - label.Height);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
private void FormFahrerAuftrag_ClientSizeChanged(object sender, EventArgs e)
|
|
{
|
|
panele_aufteilen();
|
|
}
|
|
}
|
|
}
|