private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            // Handle messages...

            if (msg == this.disMsg && HwClass.HWPacketsGet(1, ref this.pkt) > (ushort)0)
            {
                if (this.pkt.nButton > 0)
                {
                    if (this.pkt.nButton != this.hw_device_ok_button && this.pkt.nButton == this.hw_device_cancel_button)
                    {
                        this.PictureBox_Sign.Refresh();
                    }
                }
                else
                {
                    //System.Drawing.Graphics graphics = this.PictureBox_Sign.CreateGraphics();
                    //System.Drawing.Graphics graphics = Graphics.FromImage(this.PictureBox_Sign.Image); ;
                    //graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;


                    int nPress             = this.pkt.nPress;
                    int num                = nPress <= 0 ? 0 : 1;
                    System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(20, 83, 148), (float)nPress / 400f);
                    this.ptEnd.X = this.pkt.nXPos * this.PictureBox_Sign.Width / this.devInfo.nXExt;
                    this.ptEnd.Y = this.pkt.nYPos * this.PictureBox_Sign.Height / this.devInfo.nYExt;
                    if (this.cachedKey == 0 && num == 1)
                    {
                        this.ptStart = this.ptEnd;
                    }
                    else if (this.cachedKey == 1 && num == 1)
                    {
                        g.DrawLine(pen, this.ptStart, this.ptEnd);
                    }
                    else if (this.cachedKey == 1 && num == 0)
                    {
                        g.DrawLine(pen, this.ptStart, this.ptEnd);
                    }


                    this.cachedKey = num;
                    this.ptStart   = this.ptEnd;

                    this.PictureBox_Sign.Image = b;
                }
            }

            return(IntPtr.Zero);
        }
        private void Button_InputSign_Click(object sender, RoutedEventArgs e)
        {
            HwClass.HWInit(ref this.devInfo, ref this.disMsg, this._windowHandle);

            int num = (int)HwClass.HWClearSig();

            this.PictureBox_Sign.Refresh();
            if (this.PictureBox_Sign.Image != null)
            {
                this.PictureBox_Sign.Image.Dispose();
                this.PictureBox_Sign.Image = null;
            }

            b = new Bitmap(PictureBox_Sign.Width, PictureBox_Sign.Height);
            g = Graphics.FromImage(b);
        }