Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   display image on picture box control which got From Biometric device in c# (http://www.go4expert.com/forums/display-image-picture-box-control-t4039/)

ranjeetsingh_6 27Apr2007 11:32

display image on picture box control which got From Biometric device in c#
 
Hi
I am working on Biomatric Solution Project.I am using SecuGen BSP Device for This purpose.Device return Finger image data in string .I want to display this Finger image into Picture Box Control. For This I kept The output string in Byte array and then i write it in Memory Stream and at last
create a bitmap to display image(at this stage i got error "Parameter is Not Valid")

Problem:-Code Give error when i create a bitmap to display image.
red line show the error point.The error syntax is "Parameter is Not Valid".

My Code is:-
Code:

try
{
    //Create Device API Interface object
    SECUBSPCOMLib.APIInterface objSecuBSP = new SECUBSPCOMLib.APIInterface();
    long deviceID;
    objSecuBSP.EnumerateDevice();
    //Open Device
    objSecuBSP.OpenDevice(2);
    string szFIRTextData;
    objSecuBSP.Enroll(null);
    //Get Data of Image(Fingure Print) into a string

    szFIRTextData = objSecuBSP.FIRTextData;

    //Get string into Stream Format means into Byte array from string
    byte[] arrBytes = new byte[szFIRTextData.Length];
    int i = 0;
    foreach (char c in szFIRTextData.ToCharArray())
    {
        arrBytes[i] = (byte)c;
        i++;
    }
    // Open a stream for the image and write the bytes into it
    System.IO.MemoryStream memStream = new System.IO.MemoryStream(arrBytes, true);
    memStream.Write(arrBytes, 0, arrBytes.Length);
    // Create a bitmap from the stream for Display it on Picture Box Control
    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(memStream);
    pictureBox1.Image = bmp;
    memStream.Close();
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}



All times are GMT +5.5. The time now is 15:54.