From a508338501faa9a3ed58ca39aeff6d026c254bf5 Mon Sep 17 00:00:00 2001 From: JEFF Date: Wed, 22 Jan 2025 13:40:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AA=BF=E6=95=B4IDS?= =?UTF-8?q?=E6=9B=9D=E5=85=89=E6=99=82=E9=96=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Camera_connect/Main.Designer.cs | 62 +++++++++++++++++++++++++++++++-- Camera_connect/Main.cs | 8 +++-- 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/Camera_connect/Main.Designer.cs b/Camera_connect/Main.Designer.cs index 39f26bb..003707c 100644 --- a/Camera_connect/Main.Designer.cs +++ b/Camera_connect/Main.Designer.cs @@ -39,6 +39,11 @@ label2 = new Label(); label3 = new Label(); Bt_disconnect = new Button(); + IDS_ExposureTime = new TextBox(); + label1 = new Label(); + Basler_ExposureTime = new TextBox(); + label4 = new Label(); + label5 = new Label(); ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); SuspendLayout(); // @@ -111,7 +116,7 @@ // // camera_serialnumber // - camera_serialnumber.Location = new Point(1279, 75); + camera_serialnumber.Location = new Point(1283, 127); camera_serialnumber.Name = "camera_serialnumber"; camera_serialnumber.Size = new Size(182, 30); camera_serialnumber.TabIndex = 7; @@ -119,7 +124,7 @@ // label2 // label2.AutoSize = true; - label2.Location = new Point(1279, 29); + label2.Location = new Point(1283, 81); label2.Name = "label2"; label2.Size = new Size(75, 23); label2.TabIndex = 10; @@ -128,7 +133,7 @@ // label3 // label3.AutoSize = true; - label3.Location = new Point(1172, 78); + label3.Location = new Point(1176, 130); label3.Name = "label3"; label3.Size = new Size(82, 23); label3.TabIndex = 11; @@ -144,11 +149,57 @@ Bt_disconnect.UseVisualStyleBackColor = true; Bt_disconnect.Click += Bt_disconnect_Click; // + // IDS_ExposureTime + // + IDS_ExposureTime.Location = new Point(1283, 189); + IDS_ExposureTime.Name = "IDS_ExposureTime"; + IDS_ExposureTime.Size = new Size(150, 30); + IDS_ExposureTime.TabIndex = 13; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(1176, 192); + label1.Name = "label1"; + label1.Size = new Size(82, 23); + label1.TabIndex = 14; + label1.Text = "曝光時間"; + // + // Basler_ExposureTime + // + Basler_ExposureTime.Location = new Point(940, 189); + Basler_ExposureTime.Name = "Basler_ExposureTime"; + Basler_ExposureTime.Size = new Size(150, 30); + Basler_ExposureTime.TabIndex = 15; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(835, 192); + label4.Name = "label4"; + label4.Size = new Size(82, 23); + label4.TabIndex = 16; + label4.Text = "曝光時間"; + // + // label5 + // + label5.AutoSize = true; + label5.Location = new Point(951, 81); + label5.Name = "label5"; + label5.Size = new Size(97, 23); + label5.TabIndex = 17; + label5.Text = "Basler參數"; + // // Main // AutoScaleDimensions = new SizeF(11F, 23F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1746, 1294); + Controls.Add(label5); + Controls.Add(label4); + Controls.Add(Basler_ExposureTime); + Controls.Add(label1); + Controls.Add(IDS_ExposureTime); Controls.Add(Bt_disconnect); Controls.Add(label3); Controls.Add(label2); @@ -181,5 +232,10 @@ private Label label2; private Label label3; private Button Bt_disconnect; + public TextBox IDS_ExposureTime; + private Label label1; + public TextBox Basler_ExposureTime; + private Label label4; + private Label label5; } } diff --git a/Camera_connect/Main.cs b/Camera_connect/Main.cs index 743b781..17298cc 100644 --- a/Camera_connect/Main.cs +++ b/Camera_connect/Main.cs @@ -71,7 +71,8 @@ namespace Camera_connect if (connectionResult) { // 設置曝光時間 - IDS_camera.SetExposureTime(10000); + if (string.IsNullOrWhiteSpace(IDS_ExposureTime.Text)) IDS_camera.SetExposureTime(10000); + else IDS_camera.SetExposureTime(Convert.ToDouble(IDS_ExposureTime.Text)); Label_status.Text = "IDS連線成功"; Bt_OneShot.Enabled = true; Bt_KeepShot.Enabled = true; @@ -145,6 +146,8 @@ namespace Camera_connect { if (IDS_camera != null) { + if (string.IsNullOrWhiteSpace(IDS_ExposureTime.Text)) IDS_camera.SetExposureTime(10000); + else IDS_camera.SetExposureTime(Convert.ToDouble(IDS_ExposureTime.Text)); Bitmap image = IDS_camera.GetPicture(); if (image != null) { @@ -238,7 +241,8 @@ namespace Camera_connect { return; } - + if (string.IsNullOrWhiteSpace(IDS_ExposureTime.Text)) IDS_camera.SetExposureTime(10000); + else IDS_camera.SetExposureTime(Convert.ToDouble(IDS_ExposureTime.Text)); isKeepShotting = true; cts = new CancellationTokenSource(); CancellationToken token = cts.Token;