Reputation: 1600
I am Designing a windows form in which there is a picturebox which has back arrow image how to assign backspace key as direct shortcut to going back on previous form when current control is on form
Upvotes: 0
Views: 491
Reputation: 357
Set the form property KeyPreview = true;
.
Then use the KeyDown
-Event of the picturebox like this
private void picturebox1_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Back) this.Close();
}
Upvotes: 6