From c93c4043e3c2b2684db586515ca8147a9a171579 Mon Sep 17 00:00:00 2001 From: Crudelis Date: Thu, 26 Oct 2023 22:33:35 +0900 Subject: [PATCH] =?UTF-8?q?Monitor=20=EC=84=A0=ED=83=9D=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomForm/FindMonitor.Designer.cs | 65 ++++++++++ .../CustomForm/FindMonitor.cs | 21 +++ .../CustomForm/FindMonitor.resx | 120 ++++++++++++++++++ .../CustomForm/LotsScreen.cs | 2 +- .../SettingControl.Designer.cs | 40 ++++++ .../CustomUserControl/SettingControl.cs | 51 +++++++- .../DataModel.cs | 1 + ...SUCO_Cargo_Garage_Operation_Program.csproj | 9 ++ 8 files changed, 302 insertions(+), 7 deletions(-) create mode 100644 HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.Designer.cs create mode 100644 HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.cs create mode 100644 HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.resx diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.Designer.cs new file mode 100644 index 0000000..9765fa6 --- /dev/null +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.Designer.cs @@ -0,0 +1,65 @@ +namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm +{ + partial class FindMonitor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label_No = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label_No + // + this.label_No.AutoSize = true; + this.label_No.Dock = System.Windows.Forms.DockStyle.Fill; + this.label_No.Font = new System.Drawing.Font("맑은 고딕", 50.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.label_No.Location = new System.Drawing.Point(0, 0); + this.label_No.Name = "label_No"; + this.label_No.Size = new System.Drawing.Size(228, 89); + this.label_No.TabIndex = 0; + this.label_No.Text = "label1"; + this.label_No.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // FindMonitor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.LightCoral; + this.ClientSize = new System.Drawing.Size(224, 91); + this.Controls.Add(this.label_No); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "FindMonitor"; + this.Text = "FindMonitor"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label_No; + } +} \ No newline at end of file diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.cs new file mode 100644 index 0000000..35335ce --- /dev/null +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm +{ + public partial class FindMonitor : Form + { + public FindMonitor(string monitorNumber) + { + InitializeComponent(); + label_No.Text = monitorNumber; + } + } +} diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.resx b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/FindMonitor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ 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 3772c78..fe4b105 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/LotsScreen.cs @@ -18,7 +18,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm InitializeComponent(); this.StartPosition = FormStartPosition.Manual; - var bounds = Screen.AllScreens[Screen.AllScreens.Length - 1].Bounds; + var bounds = Screen.AllScreens[Global.GlobalSettings.Monitor].Bounds; this.ClientSize = new Size(bounds.Width, bounds.Height); this.Location = new Point(bounds.Left, bounds.Top); diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs index 244129e..150997d 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs @@ -48,8 +48,12 @@ this.metroLabel21 = new MetroFramework.Controls.MetroLabel(); this.metroButton_init = new MetroFramework.Controls.MetroButton(); this.metroButton_Test = new MetroFramework.Controls.MetroButton(); + this.button_FindMonitor = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.comboBox_Monitor = new System.Windows.Forms.ComboBox(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // metroButton_Save @@ -358,11 +362,43 @@ this.metroButton_Test.UseSelectable = true; this.metroButton_Test.Click += new System.EventHandler(this.metroButton_Test_Click); // + // button_FindMonitor + // + this.button_FindMonitor.Location = new System.Drawing.Point(207, 27); + this.button_FindMonitor.Name = "button_FindMonitor"; + this.button_FindMonitor.Size = new System.Drawing.Size(89, 32); + this.button_FindMonitor.TabIndex = 24; + this.button_FindMonitor.Text = "번호 출력"; + this.button_FindMonitor.UseVisualStyleBackColor = true; + this.button_FindMonitor.Click += new System.EventHandler(this.button_FindMonitor_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.comboBox_Monitor); + this.groupBox1.Controls.Add(this.button_FindMonitor); + this.groupBox1.Location = new System.Drawing.Point(20, 326); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(302, 74); + this.groupBox1.TabIndex = 25; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "당첨창 출력 모니터 선택"; + // + // comboBox_Monitor + // + this.comboBox_Monitor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_Monitor.Font = new System.Drawing.Font("맑은 고딕", 12F); + this.comboBox_Monitor.FormattingEnabled = true; + this.comboBox_Monitor.Location = new System.Drawing.Point(30, 30); + this.comboBox_Monitor.Name = "comboBox_Monitor"; + this.comboBox_Monitor.Size = new System.Drawing.Size(158, 29); + this.comboBox_Monitor.TabIndex = 25; + // // SettingControl // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.groupBox1); this.Controls.Add(this.metroButton_Test); this.Controls.Add(this.metroButton_init); this.Controls.Add(this.groupBox3); @@ -377,6 +413,7 @@ this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); + this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -403,5 +440,8 @@ private MetroFramework.Controls.MetroLabel metroLabel21; private MetroFramework.Controls.MetroButton metroButton_init; private MetroFramework.Controls.MetroButton metroButton_Test; + private System.Windows.Forms.Button button_FindMonitor; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ComboBox comboBox_Monitor; } } diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs index 0b8d179..443e969 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs @@ -8,7 +8,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl { public partial class SettingControl : UserControl { - public SettingControl() { InitializeComponent(); @@ -23,7 +22,19 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl metroTextBox_CargoLargeCertificateFee.Text = Global.GlobalSettings.CargoLargeCertificateFee.ToString(); metroTextBox_CargoOversizedCertificateFee.Text = Global.GlobalSettings.CargoOversizedCertificateFee.ToString(); - + int monitor = Screen.AllScreens.Length; + for (int i = 0; i < monitor; i++) + { + comboBox_Monitor.Items.Add(i + 1); + } + if (monitor < Global.GlobalSettings.Monitor) + { + comboBox_Monitor.SelectedIndex = 0; + } + else + { + comboBox_Monitor.SelectedIndex = Global.GlobalSettings.Monitor; + } } private void metroButton_Save_Click(object sender, EventArgs e) @@ -46,8 +57,9 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl settings.CargoLargeCertificateFee = value; int.TryParse(metroTextBox_CargoOversizedCertificateFee.Text, out value); settings.CargoOversizedCertificateFee = value; + settings.Monitor = comboBox_Monitor.SelectedIndex; Database.SaveSettings(settings); - + if (reStart) { MetroMessageBox.Show(this, "중요 설정이 변경되었습니다. 프로그램을 재시작합니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -58,7 +70,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl MetroMessageBox.Show(this, "설정이 완료되었습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } Global.GlobalSettings = settings; - } private void metroButton_init_Click(object sender, EventArgs e) @@ -77,11 +88,39 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl test.Add(r); } - LotsScreen lotsScreen = new LotsScreen(test); lotsScreen.Show(); } + private FindMonitor[] findMonitors; + private Timer timer = new Timer(); + + private void button_FindMonitor_Click(object sender, EventArgs e) + { + Screen[] scr = Screen.AllScreens; + findMonitors = new FindMonitor[scr.Length]; + + timer.Interval = 5000; + timer.Tick += Timer_Tick; + timer.Start(); + for (int i = 0; i < findMonitors.Length; i++) + { + findMonitors[i] = new FindMonitor((i + 1).ToString()); + findMonitors[i].Location = new System.Drawing.Point(scr[i].WorkingArea.Top, scr[i].WorkingArea.X); + findMonitors[i].Show(); + } + } + + private void Timer_Tick(object sender, EventArgs e) + { + for (int i = 0; i < findMonitors.Length; i++) + { + findMonitors[i].Close(); + findMonitors[i].Dispose(); + } + timer.Stop(); + } + } -} +} \ No newline at end of file diff --git a/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs b/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs index 5f6da76..019611c 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs @@ -195,6 +195,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program public int CargoOversizedFee { get; set; } public int CargoLargeCertificateFee { get; set; } public int CargoOversizedCertificateFee { get; set; } + public int Monitor { get; set; } } public struct AreaSetting { diff --git a/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj b/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj index 907e051..8f871b7 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj +++ b/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj @@ -86,6 +86,12 @@ + + Form + + + FindMonitor.cs + Form @@ -191,6 +197,9 @@ + + FindMonitor.cs + InsertResult.cs