fixed #6494: Allow closing OCR form with Esc key

This commit is contained in:
Jaex 2022-10-01 10:44:11 +03:00
parent ab9a80fa35
commit 442ba4f0c0
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;