private void NumPortion_ValueChanged(object sender, EventArgs e) { if (firstLoad) { LoadIngredients(); DisplayElements.DisplayAll(labelsIngRec, panel1, 13, 35, 0, 25); DisplayElements.DisplayAll(labelsIngFrid, panel1, 175, 35, 0, 25); } firstLoad = true; }
private bool NoFood; //if there is no food in fridge to make meal it ll be true public Recipe(int idRecipe, double portion = 0) { this.portionDiet = portion; InitializeComponent(); LoadDBToTB(idRecipe); LoadRecipe(idRecipe); lblRecipe.MaximumSize = new Size(310, 0); LoadIngredients(); DisplayElements.DisplayAll(labelsIngRec, panel1, 13, 35, 0, 25); DisplayElements.DisplayAll(labelsIngFrid, panel1, 175, 35, 0, 25); this.panel1.Size = new System.Drawing.Size(226, (25 * labelsIngRec.Count + 40)); this.ClientSize = new System.Drawing.Size(566, Math.Max(lblRecipe.Bottom, panel1.Bottom) + 4); this.MaximumSize = new System.Drawing.Size(582, Math.Max(lblRecipe.Bottom, panel1.Bottom) + 43); if (portionDiet != 0) { numPortion.Value = (decimal)portionDiet; } }