예제 #1
0
        // Display fingerprint image on screen
        public IPictureDisp PrintBiometricDisplay(bool isBiometric, GrFingerXLib.GRConstants contextId)
        {
            // handle to finger image
            IPictureDisp handle = null;
            // screen HDC
            IntPtr hdc = GetDC(System.IntPtr.Zero);

            if (isBiometric)
            {
                // get image with biometric info
                axGrFingerXCtrl.BiometricDisplay(ref FPTemplate.ImageData,
                                                 ref RawFPImg.Image, RawFPImg.Width, RawFPImg.Height, RawFPImg.Resolution, hdc.ToInt32(),
                                                 ref handle, (int)contextId);
            }
            else
            {
                // get raw image
                axGrFingerXCtrl.CapRawImageToHandle(ref RawFPImg.Image, RawFPImg.Width,
                                                    RawFPImg.Height, hdc.ToInt32(), ref handle);

                //Consolidate();
            }

            // draw image on picture box
            if (handle != null)
            {
                return(handle);
            }

            // release screen HDC
            ReleaseDC(System.IntPtr.Zero, hdc);

            return(null);
        }
    // Display fingerprint image on screen
    public void PrintBiometricDisplay(bool isBiometric, GrFingerXLib.GRConstants contextId)
    {
        // handle to finger image
        System.Drawing.Image handle = null;
        // screen HDC
        IntPtr hdc = GetDC(System.IntPtr.Zero);

        if (isBiometric)
        {
            // get image with biometric info
            _grfingerx.BiometricDisplay(ref _tpt._tpt,
                                        ref _raw.img, _raw.width, _raw.height, _raw.Res, hdc.ToInt32(),
                                        ref handle, (int)contextId);
        }
        else
        {
            // get raw image
            _grfingerx.CapRawImageToHandle(ref _raw.img, _raw.width,
                                           _raw.height, hdc.ToInt32(), ref handle);
        }

        // draw image on picture box
        if (handle != null)
        {
            _pbPic.Image = handle;
            _pbPic.Update();
        }

        // release screen HDC
        ReleaseDC(System.IntPtr.Zero, hdc);
    }
예제 #3
0
        // Write and describe an error.
        public string WriteError(GrFingerXLib.GRConstants errorCode)
        {
            switch ((int)errorCode)
            {
            case (int)GRConstants.GR_ERROR_INITIALIZE_FAIL:
                return("Fail to Initialize GrFingerX. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_NOT_INITIALIZED:
                return("The GrFingerX Library is not initialized. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_FAIL_LICENSE_READ:
                MessageBox.Show("License not found. See manual for troubleshooting.");
                return("License not found. See manual for troubleshooting. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_NO_VALID_LICENSE:
                MessageBox.Show("The license is not valid. See manual for troubleshooting.");
                return("The license is not valid. See manual for troubleshooting. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_NULL_ARGUMENT:
                return("The parameter have a null value. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_FAIL:
                return("Fail to create a GDI object. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_ALLOC:
                return("Fail to create a context. Cannot allocate memory. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_PARAMETERS:
                return("One or more parameters are out of bound. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_WRONG_USE:
                return("This function cannot be called at this time. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_EXTRACT:
                return("Template Extraction failed. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_SIZE_OFF_RANGE:
                return("Image is too larger or too short.  (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_RES_OFF_RANGE:
                return("Image have too low or too high resolution. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_CONTEXT_NOT_CREATED:
                return("The Context could not be created. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_INVALID_CONTEXT:
                return("The Context does not exist. (Error:" + errorCode + ")");

            // Capture error codes

            case (int)GRConstants.GR_ERROR_CONNECT_SENSOR:
                return("Error while connection to sensor. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_CAPTURING:
                return("Error while capturing from sensor. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_CANCEL_CAPTURING:
                return("Error while stop capturing from sensor. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_INVALID_ID_SENSOR:
                return("The idSensor is invalid. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_SENSOR_NOT_CAPTURING:
                return("The sensor is not capturing. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_INVALID_EXT:
                return("The File have a unknown extension. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_INVALID_FILENAME:
                return("The filename is invalid. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_INVALID_FILETYPE:
                return("The file type is invalid. (Error:" + errorCode + ")");

            case (int)GRConstants.GR_ERROR_SENSOR:
                return("The sensor raise an error. (Error:" + errorCode + ")");

            // Our error codes
            case ERR_INVALID_TEMPLATE:
                return("Invalid Template. (Error:" + errorCode + ")");

            case ERR_INVALID_ID:
                return("Invalid ID. (Error:" + errorCode + ")");

            case ERR_CANT_OPEN_BD:
                return("Unable to connect to DataBase. (Error:" + errorCode + ")");

            default:
                return("Error:" + errorCode);
            }
        }