コード例 #1
0
        public NieuweBestellingen(ref Bestellingssysteem systeem)
        {
            InitializeComponent();

            this.systeem = systeem;

            //Maak dit form vaste grootte (niet resizable) en centreer deze op het beeldscherm
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.StartPosition = FormStartPosition.CenterScreen;

            this.Size = new Size(600, 800);

            //Zet het font op een Monospace font (elke letter heeft dezelfde breedte) om beter vorm te geven in de treeview en listview
            this.treeViewProducten.Font = new Font(FontFamily.GenericMonospace, 18, FontStyle.Bold);
            this.lstViewBestelling.Font = new Font(FontFamily.GenericMonospace, 12, FontStyle.Regular);

            this.numAantal.Font = new Font(this.numAantal.Font.FontFamily, 18, FontStyle.Regular);

            //Bepaald de maximale breedte van de text
            charWidth = (int)Math.Floor(this.treeViewProducten.Width / this.treeViewProducten.Font.Size);
            //Registreer dubbelklik event
            this.treeViewProducten.NodeMouseDoubleClick += treeViewProducten_NodeMouseDoubleClick;

            this.lblTafel.BackgroundImage = new Bitmap(Applicatie.Properties.Resources.tafel, this.lblTafel.Size);
            this.lblTafel.TextAlign = ContentAlignment.MiddleCenter;
            this.lblTafel.Font = new Font(this.lblTafel.Font.FontFamily, 18, FontStyle.Regular);
            this.lblTafel.Text = "";

            //Kolom breedte van bestellingoverzicht
            this.lstViewBestelling.Columns[0].Width = this.lstViewBestelling.Size.Width / 3;
            this.lstViewBestelling.Columns[2].Width = this.lstViewBestelling.Size.Width / 6;
            this.lstViewBestelling.Columns[1].Width = this.lstViewBestelling.Size.Width 
                                                        - this.lstViewBestelling.Columns[0].Width
                                                        - this.lstViewBestelling.Columns[2].Width
                                                        - this.lstViewBestelling.Margin.Left
                                                        - this.lstViewBestelling.Margin.Right
                                                        - SystemInformation.VerticalScrollBarWidth;
            this.lstViewBestelling.FullRowSelect = true;
            this.lstViewBestelling.MultiSelect = false;

            this.btnKlaar.Image = new Bitmap(Applicatie.Properties.Resources.arrow, systeem.IconSize);
            this.btnKlaar.ImageAlign = ContentAlignment.MiddleLeft;

            this.btnRemove.Text = "";
            this.btnRemove.BackgroundImage = new Bitmap(Applicatie.Properties.Resources.cross, this.btnRemove.Size);
            this.btnRemove.BackgroundImageLayout = ImageLayout.Center;

            this.btnCommentaar.Text = "";
            this.btnCommentaar.BackgroundImage = new Bitmap(Applicatie.Properties.Resources.edit, this.btnRemove.Size);
            this.btnCommentaar.BackgroundImageLayout = ImageLayout.Center;

            this.Show();

            //Overlay, hieroverheen moet nog een tafeloverzicht komen
            TafelOverzicht tafelSelect = new TafelOverzicht(this, ref systeem);
            tafelSelect.ShowDialog();
            this.systeem.NieuweBestelling(tafelSelect.TafelResult, systeem.Medewerker);

            //Zet de tafel label aan de hand van de status en nummer van de geselecteerde tafel
            this.lblTafel.Text = systeem.HuidigeBestelling.Tafel.Nummer.ToString();
            this.lblTafel.BackgroundImage = systeem.GetTafelImage(this.systeem.HuidigeBestelling.Tafel.Nummer, this.lblTafel.Size);

            producten = Database.GetProducten();
            FilterTreeProducten(Menukaart.Lunch);
        }