using System.Windows.Forms; namespace SHARP_CLAS_UI.Custom_UI { public partial class uc_Cell_Recipe : UserControl { Panel _parent; int Row_num; int Column_Ea; public uc_Cell_Recipe(Panel _parent, int Row_num, int Column_Ea) { InitializeComponent(); this._parent = _parent; this.Row_num = Row_num; this.Column_Ea = Column_Ea; Set_Init_View(); } private void Set_Init_View() { int panel_num = 1; for(int i = 0; i< _parent.Controls.Count; i++) { uc_Cell_Recipe cell_reci = (uc_Cell_Recipe)_parent.Controls[i]; for (int j = 0; j < cell_reci.Controls.Count; j++) { if (cell_reci.Controls.ContainsKey($"Panel_{panel_num}")) { panel_num++; } else { break; } } } for(int i = 1; i <= Column_Ea; i++) { Label label_view = new Label(); label_view.Name = $"Panel_{panel_num}"; label_view.BackColor = System.Drawing.Color.Lime; label_view.AutoSize = false; label_view.BorderStyle = BorderStyle.FixedSingle; label_view.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; label_view.Location = new System.Drawing.Point(5 + ((i - 1) * 35), 3); label_view.Size = new System.Drawing.Size(30, 40); label_view.Text = $"{panel_num}"; this.Controls.Add(label_view); panel_num++; } } public void Set_View(int Row_num, int Column_Ea) { this.Row_num = Row_num; this.Column_Ea = Column_Ea; _parent.Controls.Clear(); Set_Init_View(); } } }