diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.Designer.cs index a122d1d..eb97e21 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.Designer.cs @@ -28,30 +28,11 @@ /// private void InitializeComponent() { - this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); - this.metroButton_Close = new MetroFramework.Controls.MetroButton(); this.flowLayoutPanel_Lots = new System.Windows.Forms.FlowLayoutPanel(); + this.label_Page = new System.Windows.Forms.Label(); + this.button_Close = new System.Windows.Forms.Button(); this.SuspendLayout(); // - // metroLabel1 - // - this.metroLabel1.AutoSize = true; - this.metroLabel1.Location = new System.Drawing.Point(93, 12); - this.metroLabel1.Name = "metroLabel1"; - this.metroLabel1.Size = new System.Drawing.Size(24, 19); - this.metroLabel1.TabIndex = 0; - this.metroLabel1.Text = "1/1"; - // - // metroButton_Close - // - this.metroButton_Close.Location = new System.Drawing.Point(12, 12); - this.metroButton_Close.Name = "metroButton_Close"; - this.metroButton_Close.Size = new System.Drawing.Size(75, 23); - this.metroButton_Close.TabIndex = 1; - this.metroButton_Close.Text = "닫기"; - this.metroButton_Close.UseSelectable = true; - this.metroButton_Close.Click += new System.EventHandler(this.metroButton_Close_Click); - // // flowLayoutPanel_Lots // this.flowLayoutPanel_Lots.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -61,18 +42,44 @@ this.flowLayoutPanel_Lots.Location = new System.Drawing.Point(9, 54); this.flowLayoutPanel_Lots.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel_Lots.Name = "flowLayoutPanel_Lots"; + this.flowLayoutPanel_Lots.Padding = new System.Windows.Forms.Padding(5); this.flowLayoutPanel_Lots.Size = new System.Drawing.Size(782, 437); this.flowLayoutPanel_Lots.TabIndex = 2; // + // label_Page + // + this.label_Page.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label_Page.AutoSize = true; + this.label_Page.BackColor = System.Drawing.Color.White; + this.label_Page.Font = new System.Drawing.Font("맑은 고딕", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.label_Page.Location = new System.Drawing.Point(733, 9); + this.label_Page.Name = "label_Page"; + this.label_Page.Size = new System.Drawing.Size(58, 37); + this.label_Page.TabIndex = 3; + this.label_Page.Text = "1/1"; + this.label_Page.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // button_Close + // + this.button_Close.Location = new System.Drawing.Point(9, 9); + this.button_Close.Name = "button_Close"; + this.button_Close.Size = new System.Drawing.Size(110, 37); + this.button_Close.TabIndex = 4; + this.button_Close.Text = "닫기"; + this.button_Close.UseVisualStyleBackColor = true; + this.button_Close.Click += new System.EventHandler(this.button_Close_Click); + // // LotsScreen // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ActiveCaptionText; this.ClientSize = new System.Drawing.Size(800, 500); + this.Controls.Add(this.button_Close); + this.Controls.Add(this.label_Page); this.Controls.Add(this.flowLayoutPanel_Lots); - this.Controls.Add(this.metroButton_Close); - this.Controls.Add(this.metroLabel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "LotsScreen"; this.Text = "LotsScreen"; @@ -82,9 +89,8 @@ } #endregion - - private MetroFramework.Controls.MetroLabel metroLabel1; - private MetroFramework.Controls.MetroButton metroButton_Close; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel_Lots; + private System.Windows.Forms.Label label_Page; + private System.Windows.Forms.Button button_Close; } } \ No newline at end of file diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.cs index cfb7f5a..cb23570 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; @@ -6,8 +7,13 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm { public partial class LotsScreen : Form { - public LotsScreen() + List _resultSetUserLists; + int pageMax = 0; + int nowPage = 0; + int totalPage = 1; + public LotsScreen(List resultSetUserListInformation) { + _resultSetUserLists = resultSetUserListInformation; InitializeComponent(); this.StartPosition = FormStartPosition.Manual; var fullScrenn_bounds = Rectangle.Empty; @@ -18,18 +24,115 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm } this.ClientSize = new Size(fullScrenn_bounds.Width, fullScrenn_bounds.Height); this.Location = new Point(fullScrenn_bounds.Left, fullScrenn_bounds.Top); - this.TopMost = true; + //this.TopMost = true; + + int baseMargin = 5; // 내부 각테두리의 여백 사이즈 + int controlWidth = 340 + 5; // Lot 컨트롤러 가로사이즈 + 여백 + int controlHeight = 90 + 5; // Lot 컨트롤러 세로사이즈 + 여백 + int tempSize = 0; // 임시 연상용 사이즈 + int widthCount = 0; // 가로 최종 갯수 + while(true) + { + widthCount++; + tempSize = baseMargin + (controlWidth * (widthCount)); + if(tempSize > this.flowLayoutPanel_Lots.Size.Width) + { + widthCount--; + break; + } + + } + int heightCount=0; // 세로 최종 갯수 + while(true) + { + heightCount++; + tempSize = baseMargin + (controlHeight * (heightCount)); + if (tempSize > this.flowLayoutPanel_Lots.Size.Height) + { + heightCount--; + break; + } + + } + pageMax = widthCount * heightCount; // 한페이지에 표시가능한 총 갯수 + if(pageMax < _resultSetUserLists.Count) + { - CustomUserControl.Lot a = new CustomUserControl.Lot("특대형-999", "2023-A1234"); - CustomUserControl.Lot b = new CustomUserControl.Lot("특대형-998", "2023-A1232"); - CustomUserControl.Lot c = new CustomUserControl.Lot("특대형-996", "2023-A1231"); - flowLayoutPanel_Lots.Controls.Add(a); flowLayoutPanel_Lots.Controls.Add(b); flowLayoutPanel_Lots.Controls.Add(c); + totalPage = _resultSetUserLists.Count / pageMax; + if(_resultSetUserLists.Count % pageMax != 0) + { + totalPage++; + } + + Timer timer = new Timer(); + timer.Interval = 5000; //5초 + timer.Tick += Timer_Tick; + timer.Start(); + + + } + ViewChange(); + + + } - private void metroButton_Close_Click(object sender, EventArgs e) + private void Timer_Tick(object sender, EventArgs e) { - this.Close(); + + ViewChange(); + + } + private void ViewChange() + { + nowPage++; + if (nowPage > totalPage) + { + nowPage = 1; + } + label_Page.Text = $"{nowPage}/{totalPage}"; + if (totalPage ==1) + { + for (int i = 0; i < _resultSetUserLists.Count; i++) + + { + List lots = new List(); + CustomUserControl.Lot lot = new CustomUserControl.Lot(_resultSetUserLists[i].Area, _resultSetUserLists[i].ApplicantNo); + lots.Add(lot); + flowLayoutPanel_Lots.Controls.Add(lots[i]); + } + } + else + { + + + + this.flowLayoutPanel_Lots.Controls.Clear(); + int totalCount = _resultSetUserLists.Count; + int limit = nowPage * (pageMax); + + if (limit > _resultSetUserLists.Count) + { + limit = _resultSetUserLists.Count; + } + int start = (nowPage - 1) * pageMax; + + for (int i = start; i < limit; i++) + { + + CustomUserControl.Lot lot = new CustomUserControl.Lot(_resultSetUserLists[i].Area, _resultSetUserLists[i].ApplicantNo); + + flowLayoutPanel_Lots.Controls.Add(lot); + } + + } + + + } + private void button_Close_Click(object sender, EventArgs e) + { + Close(); } } } diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs index 365948b..196cf85 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs @@ -139,7 +139,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl } List result = Database.SetUserListForApplicant(leftAreaInformation, promotion.EndDate); //TODO: 당첨 화면 출력 필요함 - LotsScreen lotsScreen = new LotsScreen(); + LotsScreen lotsScreen = new LotsScreen(result); lotsScreen.ShowDialog(); InsertResult insertResult = new InsertResult(result); diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/Lot.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/Lot.Designer.cs index a50c2e1..b57586d 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/Lot.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/Lot.Designer.cs @@ -30,13 +30,14 @@ { this.metroPanel1 = new MetroFramework.Controls.MetroPanel(); this.label_No = new System.Windows.Forms.Label(); - this.label_Area = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); + this.label_Area = new System.Windows.Forms.Label(); this.metroPanel1.SuspendLayout(); this.SuspendLayout(); // // metroPanel1 // + this.metroPanel1.BackColor = System.Drawing.Color.White; this.metroPanel1.Controls.Add(this.label_No); this.metroPanel1.Controls.Add(this.label2); this.metroPanel1.Controls.Add(this.label_Area); @@ -62,16 +63,6 @@ this.label_No.TabIndex = 5; this.label_No.Text = "2023-L9999"; // - // label_Area - // - this.label_Area.AutoSize = true; - this.label_Area.Font = new System.Drawing.Font("맑은 고딕", 30F, System.Drawing.FontStyle.Bold); - this.label_Area.Location = new System.Drawing.Point(3, 0); - this.label_Area.Name = "label_Area"; - this.label_Area.Size = new System.Drawing.Size(229, 54); - this.label_Area.TabIndex = 2; - this.label_Area.Text = "특대형-999"; - // // label2 // this.label2.AutoSize = true; @@ -82,12 +73,24 @@ this.label2.TabIndex = 3; this.label2.Text = "접수번호 :"; // + // label_Area + // + this.label_Area.AutoSize = true; + this.label_Area.Font = new System.Drawing.Font("맑은 고딕", 30F, System.Drawing.FontStyle.Bold); + this.label_Area.Location = new System.Drawing.Point(3, 0); + this.label_Area.Name = "label_Area"; + this.label_Area.Size = new System.Drawing.Size(229, 54); + this.label_Area.TabIndex = 2; + this.label_Area.Text = "특대형-999"; + // // Lot // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Transparent; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(204)))), ((int)(((byte)(222))))); + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.Controls.Add(this.metroPanel1); + this.Margin = new System.Windows.Forms.Padding(5); this.Name = "Lot"; this.Size = new System.Drawing.Size(340, 90); this.metroPanel1.ResumeLayout(false); diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs index 5416206..8f264a5 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs @@ -1,5 +1,6 @@ using HSUCO_Cargo_Garage_Operation_Program.CustomForm; using System; +using System.Collections.Generic; using System.Windows.Forms; namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl @@ -64,7 +65,15 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl private void metroButton_Test_Click(object sender, EventArgs e) { - LotsScreen lotsScreen = new LotsScreen(); + List test = new List(); + for (int i = 0; i < 120; i++) + { + ResultSetUserListInformation r = new ResultSetUserListInformation(); + r.Area = $"대형-{i}"; + r.ApplicantNo = $"2023-T{i}"; + test.Add(r); + } + LotsScreen lotsScreen = new LotsScreen(test); lotsScreen.Show(); } }