Beispiel #1
0
        private void btnGetSignature_Click(object sender, EventArgs e)
        {
            try
            {
                SigPlusNET1.SetTabletComTest(1);
                SigPlusNET1.SetTabletState(1);
                //open port, turn tablet on

                while ((!SigPlusNET1.TabletConnectQuery() || SigPlusNET1.GetTabletState() != 1))
                {
                    if (MessageBox.Show("Cannot locate signature pad. Please make sure it is connected.", "Cannot locate signature pad", System.Windows.Forms.MessageBoxButtons.RetryCancel, System.Windows.Forms.MessageBoxIcon.Exclamation) == DialogResult.Cancel)
                    {
                        //Continue, turn off test
                        SigPlusNET1.SetTabletComTest(0);
                        return;
                    }
                    else
                    {
                        //Max 08/31/2016 - We must reset the TabletCom and TabletState to zero which is the original state before retryning setting it to 1
                        SigPlusNET1.SetTabletComTest(0);
                        SigPlusNET1.SetTabletState(0);

                        SigPlusNET1.SetTabletComTest(1);
                        SigPlusNET1.SetTabletState(1);
                        //open port, turn tablet on
                        SigPlusNET1.ClearTablet();
                        //Clears the SigPlus object of ink
                    }
                }

                //Continue, turn off test
                SigPlusNET1.SetTabletComTest(0);
                SigPlusNET1.ClearTablet();
                //Clears the SigPlus object of ink

                btnGetSignature.Enabled = false;

                if (pictureBox1.Image != null)
                {
                    pictureBox1.Image.Dispose();
                    pictureBox1.Image = null;
                }

                btnAccept.Enabled = false;
                SigPlusNET1.BringToFront();
                this.Refresh();

                if (this.miSigPadWidth == 640)
                {
                    //******************************************************************'
                    // The following parameters are set in case the user's INI file is not correctly set up for an LCD 4X3 tablet
                    // Otherwise, if the INI is correctly set up, these parameters do not need to be set

                    SigPlusNET1.SetTabletXStart(300);
                    SigPlusNET1.SetTabletXStop(2370);
                    SigPlusNET1.SetTabletYStart(350);
                    SigPlusNET1.SetTabletYStop(1950);
                    SigPlusNET1.SetTabletLogicalXSize(2070);
                    SigPlusNET1.SetTabletLogicalYSize(1600);

                    SigPlusNET1.LCDSetWindow(0, 0, 1, 1);
                    //Prohibit inking on entire LCD
                    SigPlusNET1.SetSigWindow(1, 0, 0, 1, 1);
                    //Prohibit inking in SigPlus
                    SigPlusNET1.LCDRefresh(0, 0, 0, 640, 480);
                    //Refresh entire tablet


                    SigPlusNET1.SetLCDCaptureMode(2);


                    //Dim bmSignHere As New Bitmap(mbmsignhere)
                    //Dim myGR As Graphics = Graphics.FromImage(bmSignHere)
                    //Dim drawFont As Font = New System.Drawing.Font("Arial", 16.0F, System.Drawing.FontStyle.Bold)
                    //Dim drawBrush As New SolidBrush(Color.Black)
                    //Dim drawPoint As New PointF(0.0F, 0.0F)
                    //myGR.DrawString(msInfoLabel, drawFont, drawBrush, drawPoint)

                    SigPlusNET1.LCDSetPixelDepth(8);

                    SigPlusNET1.LCDSendGraphic(0, 2, 0, 0, mbmsignhere);
                    //this BMP is loaded into background

                    //SigPlusNET1.LCDRefresh(2, 0, 0, 240, 128) 'sets the BMP in the background
                    //to the foreground--note the initial argument 2

                    //Harish Ramakrishnan 05/15/2010
                    SigPlusNET1.LCDSetPixelDepth(0);
                    SigPlusNET1.LCDWriteString(0, 2, 0, 430, _sigFont, msInfoLabel);

                    SigPlusNET1.LCDSetPixelDepth(8);
                    Bitmap   objBitmap  = new Bitmap(640, 2);
                    Graphics objGraphic = Graphics.FromImage(objBitmap);
                    Pen      blackPen   = new Pen(Color.Black, 1);
                    objGraphic.DrawLine(blackPen, new Point(5, 1), new Point(630, 195));
                    SigPlusNET1.LCDSendGraphic(1, 2, 0, 428, objBitmap);
                    SigPlusNET1.LCDRefresh(2, 0, 428, 640, 2);
                    SigPlusNET1.LCDSetPixelDepth(0);

                    SigPlusNET1.LCDWriteString(0, 2, 20, 290, _sigFont, "CLEAR");
                    SigPlusNET1.LCDWriteString(0, 2, 400, 290, _sigFont, "OK");

                    SigPlusNET1.KeyPadAddHotSpot(0, 1, 0, 280, 150, 30);
                    SigPlusNET1.KeyPadAddHotSpot(1, 1, 350, 280, 100, 30);

                    //Dim label As Font
                    //label = New System.Drawing.Font("Arial", 16.0F, System.Drawing.FontStyle.Regular)
                    //SigPlusNET1.SetTabletState(1)
                    //SigPlusNET1.LCDWriteString(0, 2, 4, 0, label, msInfoLabel)
                    SigPlusNET1.LCDRefresh(2, 0, 313, 640, 115);
                    SigPlusNET1.LCDSetWindow(0, 313, 640, 115);
                    SigPlusNET1.SetSigWindow(1, 0, 313, 640, 115);
                    //SigPlusNET1.LCDSetWindow(0, 74, 240, 54) 'Permits only the section on LCD
                    //to display ink
                    //SigPlusNET1.SetSigWindow(1, 0, 68, 240, 60)
                    //specifies area in sigplus object to accept ink
                }
                else
                {
                    throw new Exception("Signature pad resolution is not supported");
                }

                //Timer1.Enabled = true;
            }
            catch (Exception ex)
            {
                Logger.LogError("Error reading the signature image from SigPlusNET", ex);
            }
        }
Beispiel #2
0
        private void DigSignature_Load(object sender, EventArgs e)
        {
            counter = 1;
            Font f = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular);

            string[] s;
            s = strKeyData.Split('|');
            switch (strTransaction)
            {
            case "ServiceUtilisation":
                data = "Dear member " + s[0] + ", please read and confirm the service(s) utilised before sign";
                if (dtServiceUtilisationTable != null)
                {
                    maxScreen = dtServiceUtilisationTable.Rows.Count;
                }
                break;

            case "CreditUtilisation":
                data = "Dear member " + s[0] + ", please read and confirm the credit(s) utilised before sign";
                if (dtCreditPackageUsageTable != null)
                {
                    if (dtCreditPackageUsageTable.Rows.Count > 0)
                    {
                        maxScreen = dtCreditPackageUsageTable.Rows.Count;
                    }
                    else
                    {
                        if (drCrPktUsageTable != null)
                        {
                            if (drCrPktUsageTable.GetLength(0) > 0)
                            {
                                maxScreen = drCrPktUsageTable.GetLength(0);
                            }
                        }
                    }
                }
                else
                {
                    if (drCrPktUsageTable != null)
                    {
                        if (drCrPktUsageTable.GetLength(0) > 0)
                        {
                            maxScreen = drCrPktUsageTable.GetLength(0);
                        }
                    }
                }
                break;

            case "Redemption":
                data      = "Dear member " + s[2] + ", please read and confirm the redemption(s) details before sign";
                maxScreen = 1;
                break;
            }

            SigPlusNET1.SetTabletState(1);
            SigPlusNET1.SetImagePenWidth(8);
            SigPlusNET1.SetDisplayPenWidth(8);
            SigPlusNET1.LCDRefresh(0, 0, 0, 240, 64);
            SigPlusNET1.SetTranslateBitmapEnable(false);

            //Images sent to the background
            SigPlusNET1.LCDSendGraphic(1, 2, 0, 20, sign);
            SigPlusNET1.LCDSendGraphic(1, 2, 207, 4, ok);
            SigPlusNET1.LCDSendGraphic(1, 2, 15, 4, clear);

            //Get LCD size in pixels.
            lcdSize = SigPlusNET1.LCDGetLCDSize();
            lcdX    = (int)(lcdSize & 0xFFFF);
            lcdY    = (int)((lcdSize >> 16) & 0xFFFF);

            string[] words = data.Split(new char[] { ' ' });
            string   writeData = "", tempData = "";

            int xSize, ySize, i, yPos = 0;

            for (i = 0; i < words.Length; i++)
            {
                tempData += words[i];

                xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                if (xSize < lcdX)
                {
                    writeData = tempData;
                    tempData += " ";

                    xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                    if (xSize < lcdX)
                    {
                        writeData = tempData;
                    }
                }
                else
                {
                    ySize = SigPlusNET1.LCDStringHeight(f, tempData);

                    SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);

                    tempData  = "";
                    writeData = "";
                    yPos     += (short)ySize;
                    i--;
                }
            }

            if (writeData != "")
            {
                SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);
            }

            //Hotspot text
            SigPlusNET1.LCDWriteString(0, 2, 15, 45, f, "Continue");

            //Create the hot spots for the Continue button
            SigPlusNET1.KeyPadAddHotSpot(0, 1, 12, 40, 40, 15); //For Continue button

            SigPlusNET1.ClearTablet();

            SigPlusNET1.LCDSetWindow(0, 0, 1, 1);
            SigPlusNET1.SetSigWindow(1, 0, 0, 1, 1); //Sets the area where ink is permitted in the SigPlus object
            SigPlusNET1.SetLCDCaptureMode(2);        //Sets mode so ink will not disappear after a few seconds

            screen = 0;
        }