OnEnroll

Call this event when the user fingerprint registration completes. ActionResult =true indicates that the registration is successful, and the fingerprint feature template can be captured by using pTemplate property; False represents a failure.

 

Ejemplo

C#

string sRegTemplate, sRegTemplate10;
int FPID = 0;
int fpcHandle;
        AxZKFPEngX axZKFPEngX1 = new AxZKFPEngX();
private void BeginEnroll()
        {
            axZKFPEngX1.CreateControl();
if (axZKFPEngX1.InitEngine() == 0)
            {
                axZKFPEngX1.FPEngineVersion = "9";//"10"
                fpcHandle = axZKFPEngX1.CreateFPCacheDBEx();
if (axZKFPEngX1.IsRegister)
                {
                    axZKFPEngX1.CancelEnroll();
                }
                axZKFPEngX1.EnrollCount = 3;
                axZKFPEngX1.OnImageReceived += new AxZKFPEngXControl.IZKFPEngXEvents_OnImageReceivedEventHandler(axZKFPEngX1_OnImageReceived);
                axZKFPEngX1.OnFeatureInfo += new AxZKFPEngXControl.IZKFPEngXEvents_OnFeatureInfoEventHandler(axZKFPEngX1_OnFeatureInfo);
                axZKFPEngX1.OnEnroll += new AxZKFPEngXControl.IZKFPEngXEvents_OnEnrollEventHandler(axZKFPEngX1_OnEnroll);
                axZKFPEngX1.BeginEnroll();
            }
else
            {
                axZKFPEngX1.EndEngine();
                MessageBox.Show("Initial Failed!", "Error");
            }
        }
private void axZKFPEngX1_OnEnroll(object sender, AxZKFPEngXControl.IZKFPEngXEvents_OnEnrollEvent e)
        {
if (!e.actionResult)
            {
                MessageBox.Show("Register Failed!", "error!");
            }
else
            {
                
byte[] _byteRegTemplate=(byte[]) axZKFPEngX1.GetTemplate();
                sRegTemplate = axZKFPEngX1.GetTemplateAsStringEx("9");
                sRegTemplate10 = axZKFPEngX1.GetTemplateAsStringEx("10");
if (sRegTemplate.Length > 0)
                {
if (sRegTemplate10.Length > 0)
                        axZKFPEngX1.AddRegTemplateStrToFPCacheDBEx(fpcHandle, FPID, sRegTemplate, sRegTemplate10);
else
                        MessageBox.Show("Register 10.0 failed, template length is zero", "error!");
object pTemplate;
                        pTemplate = axZKFPEngX1.DecodeTemplate1(sRegTemplate);
                    
// Note: 10.0Template can not be compressed  
                    axZKFPEngX1.SetTemplateLen(ref pTemplate, 602);
                    axZKFPEngX1.SaveTemplate("fingerprint.tpl", pTemplate);
                    FPID++;
                    MessageBox.Show("Register Succeed", "Information!");
                }
else
                {
                    MessageBox.Show("Register Failed, template length is zero", "error!");
                };
            }
        }
private void axZKFPEngX1_OnFeatureInfo(object sender, AxZKFPEngXControl.IZKFPEngXEvents_OnFeatureInfoEvent e)
        {
string sTemp = "";
if (axZKFPEngX1.IsRegister)
                sTemp = "Register status: still press finger " + axZKFPEngX1.EnrollIndex.ToString() + " times!";
            sTemp = sTemp + " Fingerprint quality";
int lastq = axZKFPEngX1.LastQuality;
if (e.aQuality == -1)
                sTemp = sTemp + " not good, Suspicious fingerprints, quality=" + lastq.ToString();
else if (e.aQuality != 0)
                sTemp = sTemp + " not good, quality=" + lastq.ToString();
else
                sTemp = sTemp + " good, quality=" + lastq.ToString();
             }
private void axZKFPEngX1_OnImageReceived(object sender, AxZKFPEngXControl.IZKFPEngXEvents_OnImageReceivedEvent e)
        {
object imageObject = new object();
            axZKFPEngX1.GetFingerImage(ref imageObject);
            PictureBox pictureBox1 = new PictureBox();
            pictureBox1.BackColor = System.Drawing.SystemColors.ButtonFace;
            pictureBox1.Location = new System.Drawing.Point(18, 20);
            pictureBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
            pictureBox1.Size = new System.Drawing.Size(411, 572);
            pictureBox1.TabIndex = 11;
            pictureBox1.TabStop = false;
            Graphics g = pictureBox1.CreateGraphics();
int dc = g.GetHdc().ToInt32();
            axZKFPEngX1.PrintImageAt(dc, 0, 0, axZKFPEngX1.ImageWidth, axZKFPEngX1.ImageHeight);
        }

VB

Private sRegTemplate As String, sRegTemplate10 As String
Private FPID As Integer = 0
Private fpcHandle As Integer
Dim axZKFPEngX1 As New AxZKFPEngX()
Private Sub BeginEnroll()
        axZKFPEngX1.CreateControl()
If axZKFPEngX1.InitEngine() = 0 Then
            axZKFPEngX1.FPEngineVersion = "9" '"10"
If axZKFPEngX1.IsRegister Then
                axZKFPEngX1.CancelEnroll()
End If
            axZKFPEngX1.EnrollCount = 3
AddHandler axZKFPEngX1.OnImageReceived, AddressOf axZKFPEngX1_OnImageReceived
AddHandler axZKFPEngX1.OnFeatureInfo, AddressOf axZKFPEngX1_OnFeatureInfo
AddHandler axZKFPEngX1.OnEnroll, AddressOf axZKFPEngX1_OnEnroll
            axZKFPEngX1.BeginEnroll()
Else
            axZKFPEngX1.EndEngine()
            MessageBox.Show("Initial Failed!", "Error")
End If
End Sub
Private Sub axZKFPEngX1_OnEnroll(sender As Object, e As AxZKFPEngXControl.IZKFPEngXEvents_OnEnrollEvent)
If Not e.actionResult Then
            MessageBox.Show("Register Failed!", "error!")
Else
            sRegTemplate = axZKFPEngX1.GetTemplateAsStringEx("9")
If sRegTemplate.Length > 0 Then
If sRegTemplate10.Length > 0 Then
                    axZKFPEngX1.AddRegTemplateStrToFPCacheDBEx(fpcHandle, FPID, sRegTemplate, sRegTemplate10)
Else
                    MessageBox.Show("Register 10.0 failed, template length is zero", "error!")
End If
Dim pTemplate As Object
                pTemplate = axZKFPEngX1.DecodeTemplate1(sRegTemplate)
' Note: 10.0Template can not be compressed  
                axZKFPEngX1.SetTemplateLen(pTemplate, 602)
                axZKFPEngX1.SaveTemplate("fingerprint.tpl", pTemplate)
                FPID += 1
                MessageBox.Show("Register Succeed", "Information!")
Else
                MessageBox.Show("Register Failed, template length is zero", "error!")
End If
End If
End Sub
Private Sub axZKFPEngX1_OnFeatureInfo(sender As Object, e As AxZKFPEngXControl.IZKFPEngXEvents_OnFeatureInfoEvent)
Dim sTemp As String = ""
If axZKFPEngX1.IsRegister Then
            sTemp = "Register status: still press finger " + axZKFPEngX1.EnrollIndex.ToString() + " times!"
End If
        sTemp = sTemp & Convert.ToString(" Fingerprint quality")
Dim lastq As Integer = axZKFPEngX1.LastQuality
If e.aQuality = -1 Then
            sTemp = (sTemp & Convert.ToString(" not good, Suspicious fingerprints, quality=")) + lastq.ToString()
ElseIf e.aQuality <> 0 Then
            sTemp = (sTemp & Convert.ToString(" not good, quality=")) + lastq.ToString()
Else
            sTemp = (sTemp & Convert.ToString(" good, quality=")) + lastq.ToString()
End If
End Sub
Private Sub axZKFPEngX1_OnImageReceived(sender As Object, e As AxZKFPEngXControl.IZKFPEngXEvents_OnImageReceivedEvent)
Dim imageObject As Object = New Object
        axZKFPEngX1.GetFingerImage(imageObject)
Dim pictureBox1 As New PictureBox()
        pictureBox1.BackColor = System.Drawing.SystemColors.ButtonFace
        pictureBox1.Location = New System.Drawing.Point(18, 20)
        pictureBox1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
        pictureBox1.Size = New System.Drawing.Size(411, 572)
        pictureBox1.TabIndex = 11
        pictureBox1.TabStop = False
Dim g As Graphics = pictureBox1.CreateGraphics()
Dim dc As Integer = g.GetHdc().ToInt32()
        axZKFPEngX1.PrintImageAt(dc, 0, 0, axZKFPEngX1.ImageWidth, axZKFPEngX1.ImageHeight)
End Sub