c# - check if button_click event was called -


my button pict let choose image. here click_event button:

private void picture_click(object sender, eventargs e)         {             using (openfiledialog dlg = new openfiledialog())             {                 dlg.title = "open image";                 dlg.filter = "image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";              if (dlg.showdialog() == dialogresult.ok)             {                  pict.add(new bitmap(dlg.filename));             }         }     } 

and have several same panels button. if don't use pict button, should load standart image. how know in pannel picture_click called , in don't?(also want place small picturebox near buttons clicked). standart image![enter image description here][1]

use parent property of sender parameter of event handler, discover panel:

control mycontrol = ((button)sender).parent; 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -