diff --git a/WindowsFormsApp2/UserControl1.Designer.cs b/WindowsFormsApp2/UserControl1.Designer.cs index 224ba09..ec11e33 100644 --- a/WindowsFormsApp2/UserControl1.Designer.cs +++ b/WindowsFormsApp2/UserControl1.Designer.cs @@ -279,7 +279,7 @@ // label7 // this.label7.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label7.ForeColor = System.Drawing.Color.White; + this.label7.ForeColor = System.Drawing.Color.Lime; this.label7.Location = new System.Drawing.Point(6, 536); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(101, 25); @@ -288,14 +288,14 @@ this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label7.DoubleClick += new System.EventHandler(this.label7_DoubleClick); // - // button_apply + // button1 // this.button1.BackgroundImage = global::WindowsFormsApp2.Properties.Resources.start; this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.Location = new System.Drawing.Point(4, 80); this.button1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.button1.Name = "button_apply"; + this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(104, 91); this.button1.TabIndex = 0; this.button1.UseVisualStyleBackColor = true; diff --git a/WindowsFormsApp2/UserControl1.cs b/WindowsFormsApp2/UserControl1.cs index 1a722b8..6a8223d 100644 --- a/WindowsFormsApp2/UserControl1.cs +++ b/WindowsFormsApp2/UserControl1.cs @@ -33,6 +33,8 @@ namespace WindowsFormsApp2 UdpClient fileu = null; public static int[] status = new int[5]; DialogSetup setup = new DialogSetup(); + + public static bool Stop = true;//停止 protected virtual void OnClosing(System.ComponentModel.CancelEventArgs e) { m_Done = true; @@ -421,38 +423,47 @@ namespace WindowsFormsApp2 if(alarm_code == 0) { label7.Text = "无报警"; + label7.ForeColor = Color.Lime; + } + if (alarm_code == 5) + { + label7.Text = "1#相机断开"; + label7.ForeColor= Color.Red; + } + if (alarm_code == 6) + { + label7.Text = "2#相机断开"; + label7.ForeColor = Color.Red; } if (alarm_code == 7) { - label7.Text = "重连1#相机"; + label7.Text = "3#相机断开"; + label7.ForeColor = Color.Red; } if (alarm_code == 8) { - label7.Text = "重连2#相机"; + label7.Text = "4#相机断开"; + label7.ForeColor = Color.Red; } if (alarm_code == 9) { - label7.Text = "重连3#相机"; + label7.Text = "5#相机断开"; + label7.ForeColor = Color.Red; } if (alarm_code == 10) { - label7.Text = "重连4#相机"; + label7.Text = "6#相机断开"; + label7.ForeColor = Color.Red; } if (alarm_code == 11) { - label7.Text = "重连5#相机"; + label7.Text = "7#相机断开"; + label7.ForeColor = Color.Red; } if (alarm_code == 12) { - label7.Text = "重连6#相机"; - } - if (alarm_code == 13) - { - label7.Text = "重连7#相机"; - } - if (alarm_code == 14) - { - label7.Text = "重连8#相机"; + label7.Text = "8#相机断开"; + label7.ForeColor = Color.Red; } } } @@ -537,12 +548,17 @@ namespace WindowsFormsApp2 private void button1_Click(object sender, EventArgs e) { + Stop = true; SendMsg("START"); + } private void button2_Click(object sender, EventArgs e) { + Stop = false; SendMsg("END"); + + } private void button3_Click(object sender, EventArgs e) diff --git a/WindowsFormsApp2/UserControl1.resx b/WindowsFormsApp2/UserControl1.resx index b8a3423..ba4f3b7 100644 --- a/WindowsFormsApp2/UserControl1.resx +++ b/WindowsFormsApp2/UserControl1.resx @@ -171,7 +171,7 @@ RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK - j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAAOvwAADr8BOAVTJAAAI+pJREFUeF7Vegd4FOX+ + j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAAOvQAADr0BR/uQrQAAI+pJREFUeF7Vegd4FOX+ 9Y/QsSCiSJUiRRREBZQuSBFFpAqCgEAoivQiHSH0HkoSIPQAgQRCEiABQgkkIYWQTnpI74X0urvnf97d RLHcexXv9zzfXZ7DOzM7s5lz3l+deSUqGf8YT9IgD0MLZc12Lzl1MVEiozTyOLRcQisRFq6Rhw+fyi4z F/np7MNh088Fne0609qry4gDzpNXXlzgnlD4cmyxTqIL8VsUQWJLdHLhbq7Y3sqUuAIey4HEPP3v4U8J diff --git a/WindowsFormsApp2/displayResult.Designer.cs b/WindowsFormsApp2/displayResult.Designer.cs index e8d668b..1f79627 100644 --- a/WindowsFormsApp2/displayResult.Designer.cs +++ b/WindowsFormsApp2/displayResult.Designer.cs @@ -28,17 +28,27 @@ /// private void InitializeComponent() { + this.singleCam5 = new WindowsFormsApp2.singleCam(); this.singleCam8 = new WindowsFormsApp2.singleCam(); this.singleCam7 = new WindowsFormsApp2.singleCam(); this.singleCam6 = new WindowsFormsApp2.singleCam(); - this.singleCam5 = new WindowsFormsApp2.singleCam(); - this.singleCam3 = new WindowsFormsApp2.singleCam(); this.singleCam4 = new WindowsFormsApp2.singleCam(); + this.singleCam3 = new WindowsFormsApp2.singleCam(); this.singleCam2 = new WindowsFormsApp2.singleCam(); this.singleCam1 = new WindowsFormsApp2.singleCam(); this.userControl11 = new WindowsFormsApp2.UserControl1(); this.SuspendLayout(); // + // singleCam5 + // + this.singleCam5.BackColor = System.Drawing.Color.Black; + this.singleCam5.Location = new System.Drawing.Point(720, 67); + this.singleCam5.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.singleCam5.Name = "singleCam5"; + this.singleCam5.Size = new System.Drawing.Size(600, 200); + this.singleCam5.TabIndex = 5; + //this.singleCam5.DoubleClick += new System.EventHandler(this.singleCam5_DoubleClick); + // // singleCam8 // this.singleCam8.BackColor = System.Drawing.Color.Black; @@ -66,15 +76,14 @@ this.singleCam6.Size = new System.Drawing.Size(600, 200); this.singleCam6.TabIndex = 6; // - // singleCam5 + // singleCam4 // - this.singleCam5.BackColor = System.Drawing.Color.Black; - this.singleCam5.Location = new System.Drawing.Point(720, 67); - this.singleCam5.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.singleCam5.Name = "singleCam5"; - this.singleCam5.Size = new System.Drawing.Size(600, 200); - this.singleCam5.TabIndex = 5; - this.singleCam5.DoubleClick += new System.EventHandler(this.singleCam5_DoubleClick); + this.singleCam4.BackColor = System.Drawing.Color.Black; + this.singleCam4.Location = new System.Drawing.Point(112, 685); + this.singleCam4.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.singleCam4.Name = "singleCam4"; + this.singleCam4.Size = new System.Drawing.Size(600, 200); + this.singleCam4.TabIndex = 4; // // singleCam3 // @@ -84,15 +93,7 @@ this.singleCam3.Name = "singleCam3"; this.singleCam3.Size = new System.Drawing.Size(600, 200); this.singleCam3.TabIndex = 3; - // - // singleCam4 - // - this.singleCam4.BackColor = System.Drawing.Color.Black; - this.singleCam4.Location = new System.Drawing.Point(112, 685); - this.singleCam4.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.singleCam4.Name = "singleCam4"; - this.singleCam4.Size = new System.Drawing.Size(600, 200); - this.singleCam4.TabIndex = 4; + //this.singleCam3.Load += new System.EventHandler(this.singleCam3_Load); // // singleCam2 // @@ -111,7 +112,7 @@ this.singleCam1.Name = "singleCam1"; this.singleCam1.Size = new System.Drawing.Size(600, 200); this.singleCam1.TabIndex = 1; - this.singleCam1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.singleCam1_MouseDoubleClick); + //this.singleCam1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.singleCam1_MouseDoubleClick); // // userControl11 // @@ -121,7 +122,7 @@ this.userControl11.Name = "userControl11"; this.userControl11.Size = new System.Drawing.Size(1330, 900); this.userControl11.TabIndex = 0; - this.userControl11.Load += new System.EventHandler(this.userControl11_Load); + // this.userControl11.Load += new System.EventHandler(this.userControl11_Load); // // displayResult // @@ -143,7 +144,7 @@ this.MinimumSize = new System.Drawing.Size(1330, 900); this.Name = "displayResult"; this.Size = new System.Drawing.Size(1330, 900); - this.Load += new System.EventHandler(this.displayResult_Load); + // this.Load += new System.EventHandler(this.displayResult_Load); this.ResumeLayout(false); } diff --git a/WindowsFormsApp2/displayResult.cs b/WindowsFormsApp2/displayResult.cs index 5a115ba..8cd541e 100644 --- a/WindowsFormsApp2/displayResult.cs +++ b/WindowsFormsApp2/displayResult.cs @@ -1,10 +1,12 @@ -using System.Windows.Forms; +using System.Drawing; +using System.Reflection.Emit; +using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class displayResult : UserControl { - + public displayResult() { InitializeComponent(); @@ -25,12 +27,14 @@ namespace WindowsFormsApp2 { dial.bindCam(id); dial.Show(); + } } public void init() - { + { + singleCam1.setCamId(0); singleCam2.setCamId(1); singleCam3.setCamId(2); @@ -54,38 +58,6 @@ namespace WindowsFormsApp2 userControl11.closeSocket(); } - private void displayResult_Load(object sender, System.EventArgs e) - { - - } - - private void userControl11_Load(object sender, System.EventArgs e) - { - - } - - private void singleCam5_DoubleClick(object sender, System.EventArgs e) - { - - } - - private void singleCam1_MouseDoubleClick(object sender, MouseEventArgs e) - { - //////双击图片时进入全屏或者还原 - - //if (singleCam1.pictureBox1.Size == singleCam1.pictureBox1.MaximumSize) - //{ - // singleCam1.pictureBox1.Size = singleCam1.pictureBox1.MinimumSize; - // this.singleCam1.pictureBox1.Dock = DockStyle.None; - // this.singleCam1.pictureBox1.Refresh(); - - //} - //else - //{ - // singleCam1.pictureBox1.Size = singleCam1.pictureBox1.MaximumSize; - // this.singleCam1.pictureBox1.Dock = DockStyle.None; - // this.singleCam1.pictureBox1.Refresh(); - //} - } + } } diff --git a/WindowsFormsApp2/singleCam.Designer.cs b/WindowsFormsApp2/singleCam.Designer.cs index 535a06b..af4013d 100644 --- a/WindowsFormsApp2/singleCam.Designer.cs +++ b/WindowsFormsApp2/singleCam.Designer.cs @@ -66,7 +66,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1576, 50); this.panel1.TabIndex = 0; - this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); + //this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // // groupBox1 // @@ -89,7 +89,7 @@ this.groupBox1.TabIndex = 9; this.groupBox1.TabStop = false; this.groupBox1.Text = "1#分析结果"; - this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter); + //this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter); // // textBox7 // @@ -103,7 +103,7 @@ this.textBox7.ReadOnly = true; this.textBox7.Size = new System.Drawing.Size(69, 21); this.textBox7.TabIndex = 18; - this.textBox7.TextChanged += new System.EventHandler(this.textBox7_TextChanged); + //this.textBox7.TextChanged += new System.EventHandler(this.textBox7_TextChanged); // // label7 // @@ -119,6 +119,7 @@ // // label8 // + this.label8.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; this.label8.BackColor = System.Drawing.Color.Lime; this.label8.Font = new System.Drawing.Font("宋体", 15F); this.label8.Location = new System.Drawing.Point(525, 20); @@ -127,7 +128,8 @@ this.label8.Size = new System.Drawing.Size(60, 24); this.label8.TabIndex = 15; this.label8.Text = " OK "; - this.label8.Click += new System.EventHandler(this.label8_Click); + this.label8.Visible = false; + // this.label8.Click += new System.EventHandler(this.label8_Click); // // textBox6 // @@ -141,7 +143,7 @@ this.textBox6.ReadOnly = true; this.textBox6.Size = new System.Drawing.Size(69, 21); this.textBox6.TabIndex = 12; - this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged); + //this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged); // // label6 // @@ -154,7 +156,7 @@ this.label6.Size = new System.Drawing.Size(93, 17); this.label6.TabIndex = 11; this.label6.Text = "胶点个数:"; - this.label6.Click += new System.EventHandler(this.label6_Click); + // this.label6.Click += new System.EventHandler(this.label6_Click); // // textBox5 // @@ -162,13 +164,13 @@ this.textBox5.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox5.Font = new System.Drawing.Font("宋体", 11F); this.textBox5.ForeColor = System.Drawing.Color.White; - this.textBox5.Location = new System.Drawing.Point(91, 19); + this.textBox5.Location = new System.Drawing.Point(91, 22); this.textBox5.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2); this.textBox5.Name = "textBox5"; this.textBox5.ReadOnly = true; this.textBox5.Size = new System.Drawing.Size(69, 21); this.textBox5.TabIndex = 10; - this.textBox5.TextChanged += new System.EventHandler(this.textBox5_TextChanged); + //this.textBox5.TextChanged += new System.EventHandler(this.textBox5_TextChanged); // // label5 // @@ -181,7 +183,7 @@ this.label5.Size = new System.Drawing.Size(85, 17); this.label5.TabIndex = 9; this.label5.Text = "采集速度:"; - this.label5.Click += new System.EventHandler(this.label5_Click); + // this.label5.Click += new System.EventHandler(this.label5_Click); // // panel2 // @@ -193,7 +195,7 @@ this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(1576, 897); this.panel2.TabIndex = 2; - this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); + //this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); // // pictureBox1 // @@ -208,7 +210,7 @@ this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 1; this.pictureBox1.TabStop = false; - this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); + //this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); this.pictureBox1.DoubleClick += new System.EventHandler(this.pictureBox1_DoubleClick); // // panel3 @@ -230,7 +232,7 @@ this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(200, 897); this.panel3.TabIndex = 0; - this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint); + //this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint); // // textBox4 // @@ -244,7 +246,7 @@ this.textBox4.Size = new System.Drawing.Size(60, 21); this.textBox4.TabIndex = 7; this.textBox4.Text = "0"; - this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged); + //this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged); // // textBox3 // @@ -258,7 +260,7 @@ this.textBox3.Size = new System.Drawing.Size(60, 21); this.textBox3.TabIndex = 6; this.textBox3.Text = "0"; - this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged); + //this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged); // // textBox2 // @@ -272,7 +274,7 @@ this.textBox2.Size = new System.Drawing.Size(60, 21); this.textBox2.TabIndex = 5; this.textBox2.Text = "0"; - this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); + //this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); // // textBox1 // @@ -286,7 +288,7 @@ this.textBox1.Size = new System.Drawing.Size(60, 21); this.textBox1.TabIndex = 4; this.textBox1.Text = "0"; - this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // // label4 // @@ -298,7 +300,7 @@ this.label4.Size = new System.Drawing.Size(86, 19); this.label4.TabIndex = 3; this.label4.Text = "1#剔除数"; - this.label4.Click += new System.EventHandler(this.label4_Click); + //this.label4.Click += new System.EventHandler(this.label4_Click); // // label3 // @@ -310,7 +312,7 @@ this.label3.Size = new System.Drawing.Size(68, 19); this.label3.TabIndex = 2; this.label3.Text = "1#NG数"; - this.label3.Click += new System.EventHandler(this.label3_Click); + //this.label3.Click += new System.EventHandler(this.label3_Click); // // label2 // @@ -322,7 +324,7 @@ this.label2.Size = new System.Drawing.Size(68, 19); this.label2.TabIndex = 1; this.label2.Text = "1#OK数"; - this.label2.Click += new System.EventHandler(this.label2_Click); + //this.label2.Click += new System.EventHandler(this.label2_Click); // // label1 // @@ -334,7 +336,7 @@ this.label1.Size = new System.Drawing.Size(86, 19); this.label1.TabIndex = 0; this.label1.Text = "1#检测数"; - this.label1.Click += new System.EventHandler(this.label1_Click); + //this.label1.Click += new System.EventHandler(this.label1_Click); // // singleCam // @@ -361,7 +363,6 @@ private System.Windows.Forms.Panel panel1; private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label8; private System.Windows.Forms.TextBox textBox6; private System.Windows.Forms.Label label6; private System.Windows.Forms.Panel panel2; @@ -379,5 +380,6 @@ private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox textBox7; public System.Windows.Forms.PictureBox pictureBox1; + public System.Windows.Forms.Label label8; } } diff --git a/WindowsFormsApp2/singleCam.cs b/WindowsFormsApp2/singleCam.cs index 5543988..4c03403 100644 --- a/WindowsFormsApp2/singleCam.cs +++ b/WindowsFormsApp2/singleCam.cs @@ -12,7 +12,7 @@ namespace WindowsFormsApp2 { public partial class singleCam : UserControl { - + // UserControl1 u1 = new UserControl1();// static singleCam() { @@ -195,124 +195,28 @@ namespace WindowsFormsApp2 if (label8.InvokeRequired) { label8.Invoke(new Action(updateLabel), ok); return; } else { - if (ok) + if (UserControl1.Stop) { - label8.Text = "OK"; - label8.BackColor = Color.Lime; + label8.Visible = true; + if (ok) + { + label8.Text = "OK"; + label8.BackColor = Color.Lime; + } + else + { + label8.Text = "NG"; + label8.BackColor = Color.Red; + } } else { - label8.Text = "NG"; - label8.BackColor = Color.Red; + label8.Visible = false; + } + } } - - private void pictureBox1_Click(object sender, EventArgs e) - { - - } - - private void panel3_Paint(object sender, PaintEventArgs e) - { - - } - - private void label4_Click(object sender, EventArgs e) - { - - } - - private void textBox3_TextChanged(object sender, EventArgs e) - { - - } - - private void groupBox1_Enter(object sender, EventArgs e) - { - - } - - private void panel1_Paint(object sender, PaintEventArgs e) - { - - } - - private void label8_Click(object sender, EventArgs e) - { - - } - - private void textBox7_TextChanged(object sender, EventArgs e) - { - - } - - private void label7_Click(object sender, EventArgs e) - { - - } - - private void textBox6_TextChanged(object sender, EventArgs e) - { - - } - - private void label6_Click(object sender, EventArgs e) - { - - } - - private void textBox5_TextChanged(object sender, EventArgs e) - { - - } - - private void label5_Click(object sender, EventArgs e) - { - - } - - private void panel2_Paint(object sender, PaintEventArgs e) - { - - } - - private void label1_Click(object sender, EventArgs e) - { - - } - - private void label2_Click(object sender, EventArgs e) - { - - } - - private void label3_Click(object sender, EventArgs e) - { - - } - - private void textBox1_TextChanged(object sender, EventArgs e) - { - - } - - private void textBox2_TextChanged(object sender, EventArgs e) - { - - } - - private void textBox4_TextChanged(object sender, EventArgs e) - { - - } - - private void textBox7_TextChanged_1(object sender, EventArgs e) - { - - } - public Action callback = null; private int thisId = -1;