Merge pull request #6530 from ShareX/ocr-form-esc

fixed #6494: Allow closing OCR form with Esc key
This commit is contained in:
Jaex 2022-10-01 10:47:50 +03:00 committed by GitHub
commit a57c03af9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -164,9 +164,11 @@ 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();

View file

@ -171,6 +171,14 @@ 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;