From 9b008ac399c94091bd98b822d54b8daf2c35245c Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 4 Jun 2023 00:20:57 +0300 Subject: [PATCH] fixed #4363 #6860: Support closing windows with "Escape" key --- ShareX.HelpersLib/Extensions/Extensions.cs | 13 + .../Forms/ClipboardViewerForm.cs | 1 + ShareX.HelpersLib/Forms/ColorPickerForm.cs | 1 + .../Forms/DNSChangerForm.Designer.cs | 3 +- ShareX.HelpersLib/Forms/DNSChangerForm.cs | 1 + ShareX.HelpersLib/Forms/DNSChangerForm.resx | 2 +- ShareX.HelpersLib/Forms/HashCheckForm.cs | 1 + ShareX.HelpersLib/Forms/ImageViewer.cs | 18 +- ShareX.HelpersLib/Forms/InputBox.cs | 1 + .../Forms/MonitorTestForm.Designer.cs | 7 +- ShareX.HelpersLib/Forms/MonitorTestForm.cs | 11 +- ShareX.HelpersLib/Forms/MonitorTestForm.resx | 379 ++++++++++++++++-- ShareX.HelpersLib/Forms/OutputBox.Designer.cs | 1 - ShareX.HelpersLib/Forms/OutputBox.cs | 9 +- .../Forms/ScreenTearingTestForm.cs | 14 +- .../Forms/HistoryForm.Designer.cs | 1 - ShareX.HistoryLib/Forms/HistoryForm.cs | 2 + ShareX.HistoryLib/Forms/HistoryForm.resx | 303 +++----------- .../Forms/ImageHistoryForm.Designer.cs | 57 ++- ShareX.HistoryLib/Forms/ImageHistoryForm.cs | 2 + .../Forms/DirectoryIndexerForm.cs | 1 + ShareX.MediaLib/Forms/ImageBeautifierForm.cs | 1 + ShareX.MediaLib/Forms/ImageCombinerForm.cs | 1 + ShareX.MediaLib/Forms/ImageSplitterForm.cs | 1 + ShareX.MediaLib/Forms/ImageThumbnailerForm.cs | 1 + ShareX.MediaLib/Forms/VideoConverterForm.cs | 1 + ShareX.MediaLib/Forms/VideoThumbnailerForm.cs | 1 + .../Forms/TextUploadForm.Designer.cs | 1 - ShareX.UploadersLib/Forms/TextUploadForm.cs | 1 + ShareX/Forms/InspectWindowForm.cs | 1 + ShareX/Forms/QRCodeForm.cs | 1 + .../BorderlessWindow/BorderlessWindowForm.cs | 1 + ShareX/Tools/OCR/OCRForm.Designer.cs | 2 - ShareX/Tools/OCR/OCRForm.cs | 9 +- ShareX/Tools/PinToScreen/PinToScreenForm.cs | 4 +- 35 files changed, 490 insertions(+), 364 deletions(-) diff --git a/ShareX.HelpersLib/Extensions/Extensions.cs b/ShareX.HelpersLib/Extensions/Extensions.cs index ddfbaeb37..879744d97 100644 --- a/ShareX.HelpersLib/Extensions/Extensions.cs +++ b/ShareX.HelpersLib/Extensions/Extensions.cs @@ -923,5 +923,18 @@ public static void ChangeFontStyle(this Control control, FontStyle fontStyle) { control.Font = new Font(control.Font, fontStyle); } + + public static void CloseOnEscape(this Form form) + { + form.KeyPreview = true; + + form.KeyUp += (sender, e) => + { + if (e.KeyCode == Keys.Escape) + { + form.Close(); + } + }; + } } } \ No newline at end of file diff --git a/ShareX.HelpersLib/Forms/ClipboardViewerForm.cs b/ShareX.HelpersLib/Forms/ClipboardViewerForm.cs index d2c13720e..62d209b31 100644 --- a/ShareX.HelpersLib/Forms/ClipboardViewerForm.cs +++ b/ShareX.HelpersLib/Forms/ClipboardViewerForm.cs @@ -38,6 +38,7 @@ public ClipboardViewerForm() { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); } private void ClipboardViewerForm_Load(object sender, EventArgs e) diff --git a/ShareX.HelpersLib/Forms/ColorPickerForm.cs b/ShareX.HelpersLib/Forms/ColorPickerForm.cs index 9a4ad1cfc..2a29d99c6 100644 --- a/ShareX.HelpersLib/Forms/ColorPickerForm.cs +++ b/ShareX.HelpersLib/Forms/ColorPickerForm.cs @@ -47,6 +47,7 @@ public ColorPickerForm(Color currentColor, bool isScreenColorPickerMode = false, { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); clipboardStatusHider = new ControlHider(btnClipboardStatus, 2000); IsScreenColorPickerMode = isScreenColorPickerMode; diff --git a/ShareX.HelpersLib/Forms/DNSChangerForm.Designer.cs b/ShareX.HelpersLib/Forms/DNSChangerForm.Designer.cs index 0b782c958..af83b57f4 100644 --- a/ShareX.HelpersLib/Forms/DNSChangerForm.Designer.cs +++ b/ShareX.HelpersLib/Forms/DNSChangerForm.Designer.cs @@ -88,6 +88,7 @@ private void InitializeComponent() // // btnCancel // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; resources.ApplyResources(this.btnCancel, "btnCancel"); this.btnCancel.Name = "btnCancel"; this.btnCancel.UseVisualStyleBackColor = true; @@ -131,10 +132,8 @@ private void InitializeComponent() // this.AcceptButton = this.btnSave; resources.ApplyResources(this, "$this"); - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.SystemColors.Window; - this.CancelButton = this.btnCancel; this.Controls.Add(this.btnPingSecondary); this.Controls.Add(this.btnPingPrimary); this.Controls.Add(this.cbAutomatic); diff --git a/ShareX.HelpersLib/Forms/DNSChangerForm.cs b/ShareX.HelpersLib/Forms/DNSChangerForm.cs index 7680ffeab..8dfa01d3e 100644 --- a/ShareX.HelpersLib/Forms/DNSChangerForm.cs +++ b/ShareX.HelpersLib/Forms/DNSChangerForm.cs @@ -36,6 +36,7 @@ public DNSChangerForm() { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); AddDNS(Resources.DNSChangerForm_DNSChangerForm_Manual); AddDNS("Google Public DNS", "8.8.8.8", "8.8.4.4"); // https://developers.google.com/speed/public-dns/ diff --git a/ShareX.HelpersLib/Forms/DNSChangerForm.resx b/ShareX.HelpersLib/Forms/DNSChangerForm.resx index c149696aa..96ab5232f 100644 --- a/ShareX.HelpersLib/Forms/DNSChangerForm.resx +++ b/ShareX.HelpersLib/Forms/DNSChangerForm.resx @@ -438,7 +438,7 @@ True - 6, 13 + 96, 96 404, 170 diff --git a/ShareX.HelpersLib/Forms/HashCheckForm.cs b/ShareX.HelpersLib/Forms/HashCheckForm.cs index a107a9015..d50cf682e 100644 --- a/ShareX.HelpersLib/Forms/HashCheckForm.cs +++ b/ShareX.HelpersLib/Forms/HashCheckForm.cs @@ -41,6 +41,7 @@ public HashCheckForm() { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); UpdateCompareControls(); cbHashType.Items.AddRange(Helpers.GetEnumDescriptions()); diff --git a/ShareX.HelpersLib/Forms/ImageViewer.cs b/ShareX.HelpersLib/Forms/ImageViewer.cs index d6edb298d..e85ea2714 100644 --- a/ShareX.HelpersLib/Forms/ImageViewer.cs +++ b/ShareX.HelpersLib/Forms/ImageViewer.cs @@ -279,11 +279,6 @@ private void pbPreview_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { - case Keys.Escape: - case Keys.Enter: - case Keys.Space: - Close(); - break; case Keys.Left: NavigateImage(-1); break; @@ -293,6 +288,18 @@ private void pbPreview_KeyDown(object sender, KeyEventArgs e) } } + private void pbPreview_KeyUp(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Escape: + case Keys.Enter: + case Keys.Space: + Close(); + break; + } + } + private void pbPreview_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { switch (e.KeyCode) @@ -379,6 +386,7 @@ private void InitializeComponent() pbPreview.MouseMove += pbPreview_MouseMove; pbPreview.MouseWheel += pbPreview_MouseWheel; pbPreview.KeyDown += pbPreview_KeyDown; + pbPreview.KeyUp += pbPreview_KeyUp; pbPreview.PreviewKeyDown += pbPreview_PreviewKeyDown; lblStatus.MouseEnter += lblStatus_MouseEnter; diff --git a/ShareX.HelpersLib/Forms/InputBox.cs b/ShareX.HelpersLib/Forms/InputBox.cs index 418793b6b..a02a49810 100644 --- a/ShareX.HelpersLib/Forms/InputBox.cs +++ b/ShareX.HelpersLib/Forms/InputBox.cs @@ -37,6 +37,7 @@ private InputBox(string title, string inputText = null, string okText = null, st { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); InputText = inputText; diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs b/ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs index eb59daa3d..f8ef0ff52 100644 --- a/ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs +++ b/ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs @@ -107,6 +107,7 @@ private void InitializeComponent() // btnGradientColor2 // this.btnGradientColor2.Color = System.Drawing.Color.Empty; + this.btnGradientColor2.ColorPickerOptions = null; resources.ApplyResources(this.btnGradientColor2, "btnGradientColor2"); this.btnGradientColor2.Name = "btnGradientColor2"; this.btnGradientColor2.UseVisualStyleBackColor = true; @@ -115,6 +116,7 @@ private void InitializeComponent() // btnGradientColor1 // this.btnGradientColor1.Color = System.Drawing.Color.Empty; + this.btnGradientColor1.ColorPickerOptions = null; resources.ApplyResources(this.btnGradientColor1, "btnGradientColor1"); this.btnGradientColor1.Name = "btnGradientColor1"; this.btnGradientColor1.UseVisualStyleBackColor = true; @@ -278,18 +280,15 @@ private void InitializeComponent() // MonitorTestForm // resources.ApplyResources(this, "$this"); - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.pSettings); this.Cursor = System.Windows.Forms.Cursors.Default; this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.KeyPreview = true; this.Name = "MonitorTestForm"; this.TopMost = true; - this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyUp); - this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MainForm_MouseDown); + this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MonitorTestForm_MouseDown); this.pSettings.ResumeLayout(false); this.pSettings.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.tbShapeSize)).EndInit(); diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.cs b/ShareX.HelpersLib/Forms/MonitorTestForm.cs index fea2e07ac..24b28e4c6 100644 --- a/ShareX.HelpersLib/Forms/MonitorTestForm.cs +++ b/ShareX.HelpersLib/Forms/MonitorTestForm.cs @@ -36,6 +36,7 @@ public MonitorTestForm() { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); Rectangle screenBounds = CaptureHelpers.GetScreenBounds(); Location = screenBounds.Location; @@ -187,15 +188,7 @@ private void DrawSelectedShape() #region Form events - private void MainForm_KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Escape) - { - Close(); - } - } - - private void MainForm_MouseDown(object sender, MouseEventArgs e) + private void MonitorTestForm_MouseDown(object sender, MouseEventArgs e) { bool visible = !pSettings.Visible; if (visible) pSettings.Location = e.Location; diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.resx b/ShareX.HelpersLib/Forms/MonitorTestForm.resx index 933e29164..f885daf96 100644 --- a/ShareX.HelpersLib/Forms/MonitorTestForm.resx +++ b/ShareX.HelpersLib/Forms/MonitorTestForm.resx @@ -117,18 +117,351 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + btnScreenTearingTest + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 0 + + + btnGradientColor2 + + + ShareX.HelpersLib.ColorButton, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null + + + pSettings + + + 1 + + + btnGradientColor1 + + + ShareX.HelpersLib.ColorButton, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null + + + pSettings + + + 2 + + + lblTip + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 3 + + + cbGradient + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 4 + + + rbGradient + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 5 + + + btnClose + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 6 + + + lblShapeSize + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 7 + + + lblShapeSizeValue + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 8 + + + tbShapeSize + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 9 + + + btnColorDialog + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 10 + + + cbShapes + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 11 + + + rbShapes + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 12 + + + lblBlue + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 13 + + + lblBlueValue + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 14 + + + tbBlue + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 15 + + + lblGreen + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 16 + + + lblGreenValue + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 17 + + + tbGreen + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 18 + + + lblRed + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 19 + + + lblRedValue + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 20 + + + tbRed + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 21 + + + rbRedGreenBlue + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 22 + + + lblBlackWhiteValue + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 23 + + + tbBlackWhite + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 24 + + + rbBlackWhite + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pSettings + + + 25 + + + + 88, 88 + + + 352, 448 + + + + 0 + + + pSettings + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + NoControl - 16, 368 320, 24 - 25 @@ -169,7 +502,7 @@ btnGradientColor2 - ShareX.HelpersLib.ColorButton, ShareX.HelpersLib, Version=12.4.0.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.ColorButton, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null pSettings @@ -199,7 +532,7 @@ btnGradientColor1 - ShareX.HelpersLib.ColorButton, ShareX.HelpersLib, Version=12.4.0.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.ColorButton, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null pSettings @@ -361,14 +694,13 @@ 315, 332 - 15, 16 + 14, 16 23 1 - @Invariant lblShapeSizeValue @@ -539,14 +871,13 @@ 315, 188 - 15, 16 + 14, 16 14 0 - @Invariant lblBlueValue @@ -630,14 +961,13 @@ 315, 156 - 15, 16 + 14, 16 11 0 - @Invariant lblGreenValue @@ -721,14 +1051,13 @@ 315, 124 - 15, 16 + 14, 16 8 0 - @Invariant lblRedValue @@ -812,14 +1141,13 @@ 315, 52 - 15, 16 + 14, 16 3 0 - @Invariant lblBlackWhiteValue @@ -890,32 +1218,11 @@ 25 - - 88, 88 - - - 352, 448 - - - 0 - - - pSettings - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - True - 6, 13 + 96, 96 700, 700 diff --git a/ShareX.HelpersLib/Forms/OutputBox.Designer.cs b/ShareX.HelpersLib/Forms/OutputBox.Designer.cs index 15c808e38..4b7123d33 100644 --- a/ShareX.HelpersLib/Forms/OutputBox.Designer.cs +++ b/ShareX.HelpersLib/Forms/OutputBox.Designer.cs @@ -42,7 +42,6 @@ private void InitializeComponent() this.rtbText.Size = new System.Drawing.Size(968, 745); this.rtbText.TabIndex = 1; this.rtbText.Text = ""; - this.rtbText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.rtbText_KeyUp); // // OutputBox // diff --git a/ShareX.HelpersLib/Forms/OutputBox.cs b/ShareX.HelpersLib/Forms/OutputBox.cs index dcfb2771b..d32877c15 100644 --- a/ShareX.HelpersLib/Forms/OutputBox.cs +++ b/ShareX.HelpersLib/Forms/OutputBox.cs @@ -37,6 +37,7 @@ private OutputBox(string text, string title, bool scrollToEnd = false) InitializeComponent(); rtbText.AddContextMenu(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); Text = "ShareX - " + title; rtbText.Text = text; @@ -66,13 +67,5 @@ private void OutputBox_Shown(object sender, EventArgs e) NativeMethods.SendMessage(rtbText.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_TOP, 0); } } - - private void rtbText_KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Escape) - { - Close(); - } - } } } \ No newline at end of file diff --git a/ShareX.HelpersLib/Forms/ScreenTearingTestForm.cs b/ShareX.HelpersLib/Forms/ScreenTearingTestForm.cs index 8c322158e..d2bb9272d 100644 --- a/ShareX.HelpersLib/Forms/ScreenTearingTestForm.cs +++ b/ShareX.HelpersLib/Forms/ScreenTearingTestForm.cs @@ -60,6 +60,8 @@ public ScreenTearingTestForm() ResumeLayout(false); + this.CloseOnEscape(); + animationTime = Stopwatch.StartNew(); } @@ -70,18 +72,6 @@ protected override void OnShown(EventArgs e) base.OnShown(e); } - protected override void OnKeyUp(KeyEventArgs e) - { - if (e.KeyCode == Keys.Escape) - { - Close(); - } - else - { - base.OnKeyUp(e); - } - } - protected override void OnMouseUp(MouseEventArgs e) { if (Mode == ScreenTearingTestMode.VerticalLines) diff --git a/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs b/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs index 31c4d44f0..53491b830 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs @@ -386,7 +386,6 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.SystemColors.Window; this.Controls.Add(this.scMain); - this.KeyPreview = true; this.Name = "HistoryForm"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HistoryForm_FormClosing); this.Shown += new System.EventHandler(this.HistoryForm_Shown); diff --git a/ShareX.HistoryLib/Forms/HistoryForm.cs b/ShareX.HistoryLib/Forms/HistoryForm.cs index be1e4f9cd..d6c7075e8 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.cs @@ -91,6 +91,8 @@ public HistoryForm(string historyPath, HistorySettings settings, Action ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); + if (Settings.RememberWindowState) { Settings.WindowState.ApplyFormState(this); diff --git a/ShareX.HistoryLib/Forms/HistoryForm.resx b/ShareX.HistoryLib/Forms/HistoryForm.resx index ad4ebe844..6d5fcc292 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.resx +++ b/ShareX.HistoryLib/Forms/HistoryForm.resx @@ -131,7 +131,6 @@ - @Invariant @@ -173,7 +172,7 @@ lvHistory - ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=14.0.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null tscHistory.ContentPanel @@ -238,51 +237,6 @@ None - - 3, 0 - - - 477, 25 - - - 0 - - - tsHistory - - - System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tscHistory.TopToolStripPanel - - - 0 - - - tscHistory.TopToolStripPanel - - - System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tscHistory - - - 3 - - - tscHistory - - - System.Windows.Forms.ToolStripContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - scMain.Panel1 - - - 0 - 45, 22 @@ -346,211 +300,49 @@ Settings... - - btnAdvancedSearchClose + + 3, 0 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 477, 25 - - gbAdvancedSearch - - + 0 - - btnAdvancedSearchReset + + tsHistory - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - gbAdvancedSearch + + tscHistory.TopToolStripPanel - - 1 + + 0 - - lblURLFilter + + tscHistory.TopToolStripPanel - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - gbAdvancedSearch + + tscHistory - - 2 - - - txtURLFilter - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - + 3 - - lblFilenameFilter + + tscHistory - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ToolStripContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - gbAdvancedSearch + + scMain.Panel1 - - 4 - - - cbHostFilterSelection - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 5 - - - cbTypeFilterSelection - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 6 - - - cbHostFilter - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 7 - - - cbTypeFilter - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 8 - - - dtpFilterFrom - - - System.Windows.Forms.DateTimePicker, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 9 - - - lblFilterFrom - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 10 - - - lblFilterTo - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 11 - - - cbDateFilter - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 12 - - - dtpFilterTo - - - System.Windows.Forms.DateTimePicker, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 13 - - - txtFilenameFilter - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbAdvancedSearch - - - 14 - - - 0, 0 - - - 409, 213 - - - 4 - - - Advanced search - - - False - - - gbAdvancedSearch - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - scHistoryItemInfo.Panel1 - - + 0 @@ -937,6 +729,33 @@ 14 + + 0, 0 + + + 409, 213 + + + 4 + + + Advanced search + + + False + + + gbAdvancedSearch + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + scHistoryItemInfo.Panel1 + + + 0 + Fill @@ -977,7 +796,7 @@ 0, 0 - 627, 424 + 627, 421 3 @@ -986,7 +805,7 @@ pbThumbnail - ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=14.0.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null scHistoryItemInfo.Panel1 @@ -1016,7 +835,7 @@ 0, 0 - 627, 230 + 627, 233 0 @@ -1049,7 +868,7 @@ 627, 661 - 424 + 421 7 @@ -1061,7 +880,7 @@ scHistoryItemInfo - ShareX.HelpersLib.SplitContainerCustomSplitter, ShareX.HelpersLib, Version=14.0.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.SplitContainerCustomSplitter, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null scMain.Panel2 @@ -1100,7 +919,7 @@ scMain - ShareX.HelpersLib.SplitContainerCustomSplitter, ShareX.HelpersLib, Version=14.0.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.SplitContainerCustomSplitter, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null $this diff --git a/ShareX.HistoryLib/Forms/ImageHistoryForm.Designer.cs b/ShareX.HistoryLib/Forms/ImageHistoryForm.Designer.cs index b084fb5ef..cf89763b5 100644 --- a/ShareX.HistoryLib/Forms/ImageHistoryForm.Designer.cs +++ b/ShareX.HistoryLib/Forms/ImageHistoryForm.Designer.cs @@ -28,10 +28,10 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader ımageListViewColumnHeader1 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.Name, "Name", 100, 0, true); - Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader ımageListViewColumnHeader2 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.FileSize, "Size", 100, 1, true); - Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader ımageListViewColumnHeader3 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.Dimensions, "Dimensions", 100, 2, true); - Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader ımageListViewColumnHeader4 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.FilePath, "Path", 100, 3, true); + Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader imageListViewColumnHeader1 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.Name, "Name", 100, 0, true); + Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader imageListViewColumnHeader2 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.FileSize, "Size", 100, 1, true); + Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader imageListViewColumnHeader3 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.Dimensions, "Dimensions", 100, 2, true); + Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader imageListViewColumnHeader4 = new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader(Manina.Windows.Forms.ColumnType.FilePath, "Path", 100, 3, true); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageHistoryForm)); this.tscMain = new System.Windows.Forms.ToolStripContainer(); this.ilvImages = new Manina.Windows.Forms.ImageListView(); @@ -68,31 +68,31 @@ private void InitializeComponent() this.ilvImages.AllowItemReorder = false; this.ilvImages.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ilvImages.CacheLimit = "100MB"; - ımageListViewColumnHeader1.Comparer = null; - ımageListViewColumnHeader1.DisplayIndex = 0; - ımageListViewColumnHeader1.Grouper = null; - ımageListViewColumnHeader1.Key = ""; - ımageListViewColumnHeader1.Type = Manina.Windows.Forms.ColumnType.Name; - ımageListViewColumnHeader2.Comparer = null; - ımageListViewColumnHeader2.DisplayIndex = 1; - ımageListViewColumnHeader2.Grouper = null; - ımageListViewColumnHeader2.Key = ""; - ımageListViewColumnHeader2.Type = Manina.Windows.Forms.ColumnType.FileSize; - ımageListViewColumnHeader3.Comparer = null; - ımageListViewColumnHeader3.DisplayIndex = 2; - ımageListViewColumnHeader3.Grouper = null; - ımageListViewColumnHeader3.Key = ""; - ımageListViewColumnHeader3.Type = Manina.Windows.Forms.ColumnType.Dimensions; - ımageListViewColumnHeader4.Comparer = null; - ımageListViewColumnHeader4.DisplayIndex = 3; - ımageListViewColumnHeader4.Grouper = null; - ımageListViewColumnHeader4.Key = ""; - ımageListViewColumnHeader4.Type = Manina.Windows.Forms.ColumnType.FilePath; + imageListViewColumnHeader1.Comparer = null; + imageListViewColumnHeader1.DisplayIndex = 0; + imageListViewColumnHeader1.Grouper = null; + imageListViewColumnHeader1.Key = ""; + imageListViewColumnHeader1.Type = Manina.Windows.Forms.ColumnType.Name; + imageListViewColumnHeader2.Comparer = null; + imageListViewColumnHeader2.DisplayIndex = 1; + imageListViewColumnHeader2.Grouper = null; + imageListViewColumnHeader2.Key = ""; + imageListViewColumnHeader2.Type = Manina.Windows.Forms.ColumnType.FileSize; + imageListViewColumnHeader3.Comparer = null; + imageListViewColumnHeader3.DisplayIndex = 2; + imageListViewColumnHeader3.Grouper = null; + imageListViewColumnHeader3.Key = ""; + imageListViewColumnHeader3.Type = Manina.Windows.Forms.ColumnType.Dimensions; + imageListViewColumnHeader4.Comparer = null; + imageListViewColumnHeader4.DisplayIndex = 3; + imageListViewColumnHeader4.Grouper = null; + imageListViewColumnHeader4.Key = ""; + imageListViewColumnHeader4.Type = Manina.Windows.Forms.ColumnType.FilePath; this.ilvImages.Columns.AddRange(new Manina.Windows.Forms.ImageListView.ImageListViewColumnHeader[] { - ımageListViewColumnHeader1, - ımageListViewColumnHeader2, - ımageListViewColumnHeader3, - ımageListViewColumnHeader4}); + imageListViewColumnHeader1, + imageListViewColumnHeader2, + imageListViewColumnHeader3, + imageListViewColumnHeader4}); resources.ApplyResources(this.ilvImages, "ilvImages"); this.ilvImages.Name = "ilvImages"; this.ilvImages.PersistentCacheDirectory = ""; @@ -154,7 +154,6 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.SystemColors.Window; this.Controls.Add(this.tscMain); - this.KeyPreview = true; this.Name = "ImageHistoryForm"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ImageHistoryForm_FormClosing); this.Shown += new System.EventHandler(this.ImageHistoryForm_Shown); diff --git a/ShareX.HistoryLib/Forms/ImageHistoryForm.cs b/ShareX.HistoryLib/Forms/ImageHistoryForm.cs index 18b51296c..bd2497a37 100644 --- a/ShareX.HistoryLib/Forms/ImageHistoryForm.cs +++ b/ShareX.HistoryLib/Forms/ImageHistoryForm.cs @@ -76,6 +76,8 @@ public ImageHistoryForm(string historyPath, ImageHistorySettings settings, Actio ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); + if (Settings.RememberWindowState) { Settings.WindowState.ApplyFormState(this); diff --git a/ShareX.IndexerLib/Forms/DirectoryIndexerForm.cs b/ShareX.IndexerLib/Forms/DirectoryIndexerForm.cs index 02b6113ad..437692b00 100644 --- a/ShareX.IndexerLib/Forms/DirectoryIndexerForm.cs +++ b/ShareX.IndexerLib/Forms/DirectoryIndexerForm.cs @@ -44,6 +44,7 @@ public DirectoryIndexerForm(IndexerSettings settings) { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); Settings = settings; pgSettings.SelectedObject = Settings; diff --git a/ShareX.MediaLib/Forms/ImageBeautifierForm.cs b/ShareX.MediaLib/Forms/ImageBeautifierForm.cs index 85c13f136..774118ee2 100644 --- a/ShareX.MediaLib/Forms/ImageBeautifierForm.cs +++ b/ShareX.MediaLib/Forms/ImageBeautifierForm.cs @@ -56,6 +56,7 @@ private ImageBeautifierForm(ImageBeautifierOptions options = null) InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); title = Text; LoadOptions(); diff --git a/ShareX.MediaLib/Forms/ImageCombinerForm.cs b/ShareX.MediaLib/Forms/ImageCombinerForm.cs index b545c9b27..ff2130154 100644 --- a/ShareX.MediaLib/Forms/ImageCombinerForm.cs +++ b/ShareX.MediaLib/Forms/ImageCombinerForm.cs @@ -45,6 +45,7 @@ public ImageCombinerForm(ImageCombinerOptions options) InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); if (Options.Orientation == Orientation.Horizontal) { diff --git a/ShareX.MediaLib/Forms/ImageSplitterForm.cs b/ShareX.MediaLib/Forms/ImageSplitterForm.cs index 7d5c469ac..cd33b0a31 100644 --- a/ShareX.MediaLib/Forms/ImageSplitterForm.cs +++ b/ShareX.MediaLib/Forms/ImageSplitterForm.cs @@ -43,6 +43,7 @@ public ImageSplitterForm() { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); UpdateButtonStates(); } diff --git a/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs b/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs index 929e431e5..ce8178dc1 100644 --- a/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs +++ b/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs @@ -38,6 +38,7 @@ public ImageThumbnailerForm() { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); } private void UpdateEnabled() diff --git a/ShareX.MediaLib/Forms/VideoConverterForm.cs b/ShareX.MediaLib/Forms/VideoConverterForm.cs index ed3aa3095..65356189e 100644 --- a/ShareX.MediaLib/Forms/VideoConverterForm.cs +++ b/ShareX.MediaLib/Forms/VideoConverterForm.cs @@ -47,6 +47,7 @@ public VideoConverterForm(string ffmpegFilePath, VideoConverterOptions options) InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); UpdateOptions(); diff --git a/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs b/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs index e53c60897..5e83488cb 100644 --- a/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs +++ b/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs @@ -47,6 +47,7 @@ public VideoThumbnailerForm(string ffmpegPath, VideoThumbnailOptions options) InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); txtMediaPath.Text = Options.LastVideoPath ?? ""; pgOptions.SelectedObject = Options; diff --git a/ShareX.UploadersLib/Forms/TextUploadForm.Designer.cs b/ShareX.UploadersLib/Forms/TextUploadForm.Designer.cs index 9e5001eb7..374a9f652 100644 --- a/ShareX.UploadersLib/Forms/TextUploadForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/TextUploadForm.Designer.cs @@ -58,7 +58,6 @@ private void InitializeComponent() // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.CancelButton = this.btnCancel; this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnUpload); this.Controls.Add(this.txtContent); diff --git a/ShareX.UploadersLib/Forms/TextUploadForm.cs b/ShareX.UploadersLib/Forms/TextUploadForm.cs index 3aa056112..96d339e22 100644 --- a/ShareX.UploadersLib/Forms/TextUploadForm.cs +++ b/ShareX.UploadersLib/Forms/TextUploadForm.cs @@ -37,6 +37,7 @@ public TextUploadForm(string content = null) { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); if (string.IsNullOrEmpty(content) && ClipboardHelpers.ContainsText()) { diff --git a/ShareX/Forms/InspectWindowForm.cs b/ShareX/Forms/InspectWindowForm.cs index 76e1677b4..337d3c6b6 100644 --- a/ShareX/Forms/InspectWindowForm.cs +++ b/ShareX/Forms/InspectWindowForm.cs @@ -41,6 +41,7 @@ public InspectWindowForm() InitializeComponent(); rtbInfo.AddContextMenu(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); SelectHandle(true); } diff --git a/ShareX/Forms/QRCodeForm.cs b/ShareX/Forms/QRCodeForm.cs index a6e961904..b9e85ff47 100644 --- a/ShareX/Forms/QRCodeForm.cs +++ b/ShareX/Forms/QRCodeForm.cs @@ -62,6 +62,7 @@ public QRCodeForm(string text = null) InitializeComponent(); rtbDecodeResult.AddContextMenu(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); if (!string.IsNullOrEmpty(text)) { diff --git a/ShareX/Tools/BorderlessWindow/BorderlessWindowForm.cs b/ShareX/Tools/BorderlessWindow/BorderlessWindowForm.cs index 59b53e7fb..1a2156ebe 100644 --- a/ShareX/Tools/BorderlessWindow/BorderlessWindowForm.cs +++ b/ShareX/Tools/BorderlessWindow/BorderlessWindowForm.cs @@ -41,6 +41,7 @@ public BorderlessWindowForm(BorderlessWindowSettings settings) { InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); Settings = settings; } diff --git a/ShareX/Tools/OCR/OCRForm.Designer.cs b/ShareX/Tools/OCR/OCRForm.Designer.cs index cb4de85c1..7b0d46677 100644 --- a/ShareX/Tools/OCR/OCRForm.Designer.cs +++ b/ShareX/Tools/OCR/OCRForm.Designer.cs @@ -164,11 +164,9 @@ private void InitializeComponent() this.Controls.Add(this.lblResult); this.Controls.Add(this.cbLanguages); this.Controls.Add(this.lblLanguage); - this.KeyPreview = true; this.Name = "OCRForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Shown += new System.EventHandler(this.OCRForm_Shown); - this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OCRForm_KeyUp); ((System.ComponentModel.ISupportInitialize)(this.nudScaleFactor)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ShareX/Tools/OCR/OCRForm.cs b/ShareX/Tools/OCR/OCRForm.cs index 14e7e2b9f..f6ccaa0fc 100644 --- a/ShareX/Tools/OCR/OCRForm.cs +++ b/ShareX/Tools/OCR/OCRForm.cs @@ -49,6 +49,7 @@ public OCRForm(Bitmap bmp, OCROptions options) InitializeComponent(); ShareXResources.ApplyTheme(this); + this.CloseOnEscape(); OCRLanguage[] languages = OCRHelper.AvailableLanguages.OrderBy(x => x.DisplayName).ToArray(); @@ -171,14 +172,6 @@ private async void OCRForm_Shown(object sender, EventArgs e) await OCR(bmpSource); } - private void OCRForm_KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Escape) - { - Close(); - } - } - private async void btnSelectRegion_Click(object sender, EventArgs e) { FormWindowState previousState = WindowState; diff --git a/ShareX/Tools/PinToScreen/PinToScreenForm.cs b/ShareX/Tools/PinToScreen/PinToScreenForm.cs index d37abb799..c3760c2b6 100644 --- a/ShareX/Tools/PinToScreen/PinToScreenForm.cs +++ b/ShareX/Tools/PinToScreen/PinToScreenForm.cs @@ -148,6 +148,7 @@ private PinToScreenForm(PinToScreenOptions options) ShareXResources.ApplyTheme(this); TopMost = Options.TopMost; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); + this.CloseOnEscape(); tsMain.Cursor = Cursors.Arrow; openHandCursor = Helpers.CreateCursor(Resources.openhand); @@ -484,9 +485,6 @@ private void PinToScreenForm_KeyUp(object sender, KeyEventArgs e) { switch (e.KeyData) { - case Keys.Escape: - Close(); - break; case Keys.Control | Keys.C: ClipboardHelpers.CopyImage(Image); break;