From 420325b4e5e7124412183e23a96e53a32eceb1dc Mon Sep 17 00:00:00 2001 From: JEFF Date: Sat, 18 Jan 2025 21:40:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A8=8B=E5=BC=8F0118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Camera_connect/Main.Designer.cs | 1 + Camera_connect/Main.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Camera_connect/Main.Designer.cs b/Camera_connect/Main.Designer.cs index bf57432..39f26bb 100644 --- a/Camera_connect/Main.Designer.cs +++ b/Camera_connect/Main.Designer.cs @@ -162,6 +162,7 @@ Controls.Add(Bt_connect); Name = "Main"; Text = "Form1"; + FormClosed += Form1_FormClosed; ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); ResumeLayout(false); PerformLayout(); diff --git a/Camera_connect/Main.cs b/Camera_connect/Main.cs index f619c0e..743b781 100644 --- a/Camera_connect/Main.cs +++ b/Camera_connect/Main.cs @@ -308,5 +308,12 @@ namespace Camera_connect } } + + private void Form1_FormClosed(object sender, FormClosedEventArgs e) + { + + Basler.DestroyCamera(); + pictureBox1.Image?.Dispose(); + } } }