From 28216f00380c56f316a988de2200a9a323af0fcd Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 22 Mar 2023 21:49:58 +0100 Subject: [PATCH] Allow closing app on Esc keypress. Also fix compilation due to nonexistant path. --- Form1.Designer.vb | 1 + Form1.vb | 4 ++++ My Project/Resources.Designer.vb | 10 ---------- My Project/Resources.resx | 3 --- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Form1.Designer.vb b/Form1.Designer.vb index 613d138..ea62e7b 100644 --- a/Form1.Designer.vb +++ b/Form1.Designer.vb @@ -68,6 +68,7 @@ Partial Class Form1 Me.Controls.Add(Me.Button1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.KeyPreview = True Me.MaximizeBox = False Me.Name = "Form1" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen diff --git a/Form1.vb b/Form1.vb index 06e40b2..3c2299e 100644 --- a/Form1.vb +++ b/Form1.vb @@ -5,4 +5,8 @@ My.Computer.Clipboard.SetText(TextBox1.Text) End If End Sub + + Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown + If e.KeyCode = Keys.Escape Then Me.Close() + End Sub End Class diff --git a/My Project/Resources.Designer.vb b/My Project/Resources.Designer.vb index 1629666..fc98a2f 100644 --- a/My Project/Resources.Designer.vb +++ b/My Project/Resources.Designer.vb @@ -59,15 +59,5 @@ Namespace My.Resources resourceCulture = value End Set End Property - - ''' - ''' Wyszukuje zlokalizowany zasób typu System.Drawing.Icon podobny do zasobu (Ikona). - ''' - Friend ReadOnly Property envvar() As System.Drawing.Icon - Get - Dim obj As Object = ResourceManager.GetObject("envvar", resourceCulture) - Return CType(obj,System.Drawing.Icon) - End Get - End Property End Module End Namespace diff --git a/My Project/Resources.resx b/My Project/Resources.resx index 1c73201..04e2214 100644 --- a/My Project/Resources.resx +++ b/My Project/Resources.resx @@ -118,7 +118,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\..\..\..\..\..\srv03rtm\shell\cpls\system\envvar.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - \ No newline at end of file