how to delete image from picture box when user press "del" key...I dont find any keypress or keydown events for PB.
private void topRight_pbx_MouseClick(object sender, MouseEventArgs e)
{
imgSelected=true;
//need to accept "delete"key from keyboard?
topRight_pbx.Image = null;
topRFile = "";
}
Change your imgSelected to something like:
private PictureBox picSelected = null;
On your picturebox click set this variable to the sender:
picSelected = (PictureBox)sender;
Then on the keydown of form or the control that has focus you run the image removal code (Example for form):
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
picSelected.Image = null;
}