천호석
2022-12-12 2eb59634fdfb48cbd8a1e7ee09c2ccd193ccafec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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();
        }
    }
}