c# - DigitalPersona SDK: Transfer EnrollmentForm image to another form -
trying do...
i working on project incorporates digitalpersona sdk captureform , enrollmentform. project includes main form, sake of question call form1. form includes picturebox, called picturebox1, , button, called button1. when click on button1, following code executed.
private void button1_click(object sender, eventargs e) { enrollmentform enroll = new enrollmentform(); enroll.showdialog(); }
in enrollmentform, have controls setup provided in digitalpersona sdk. captures fingerprint fine in picturebox, called picture. do, make when close enrollmentform, captured image in picturebox transferred picturebox on form1.
what have tried...
i have tried many examples have found here on stackoverflow , google. first create formclosing event , try pass image enrollmentform form1. did making picturebox1 on form1 public in form1.designer.cs , putting following code enrollmentform.
private void enrollmentform_formclosing(object sender, formclosingeventargs e) { form1 frm = new form1(); frm.picturebox1.image = picture.image; }
this compiled without problems, once image captured , form closed, image never transferred form1. doing further research, found article suggested following method when opening second form modally.
in form1, modified button1_click following.
private void button1_click(object sender, eventargs e) { enrollmentform enroll = new enrollmentform(); enroll.showdialog(); picturebox1.image = enroll.selectedimage; }
then in enrollmentform, following code added.
public image selectedimage { { return picture.image; } }
again, compiled. fingerprint captured, when enrollmentform closed, image never transferred picturebox1 on form1.
i not sure doing wrong here. eventually, form1 contain more 1 picturebox, , utilize enrollmentform populate each picturebox. appreciate assistance.
update future readers: thought i'd add ended working. turns out enrollmentform sdk gets picture captureform. ended having button open captureform instead, , tried image transfer main form , works properly.
step 1: create image type public variable enimage enrollmentform , in enrollment form closing event set enimage=yourpictureboxcontrolname.image ;
step 2: in main form create image type variable called mainimage , in button click event add code
enrollmentform enroll = new enrollmentform(); enroll.showdialog(); mainimage = enroll.enimage; picturebox1.image=mainimage;
i tested code , it's working.
Comments
Post a Comment