none
如何保存客户在手写屏上的签名 RRS feed

  • 问题

  •  

    我要开发一个程序,最后要求客户在wince的手写屏上签字。我想把客户的签名保存下了,不是签名的内容,而是签名的字体保存为一个图片。我的手写识别是系统自带,这个要如何控制??????
    2008年3月24日 4:30

答案

  • 建议用CF完成,下面是我现写的一个程序,效果还不错,还可以保存为位图

    Code Snippet

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;

    namespace HandImage
    {
        public partial class frmTest : Form
        {
            List<Points> HandTrack=new List<Points>();
            public Graphics pb_Graphics;
            Bitmap pb_BMP = new Bitmap(239,235);

            int index = 0;    //第几笔
            public frmTest()
            {
                InitializeComponent();
            }

            private void pnlBar_MouseMove(object sender, MouseEventArgs e)
            {
                HandTrack[index].PT.Add(new Point(e.X, e.Y));
                pnlBar.Refresh();
            }

            private void pnlBar_Paint(object sender, PaintEventArgs e)
            {
                pb_Graphics = Graphics.FromImage((System.Drawing.Image)pb_BMP);
                pb_Graphics.Clear(pnlBar.BackColor);
                foreach(Points item in  HandTrack)
                {
                    pb_Graphics.DrawLines(new Pen(Color.Black), item.PT.ToArray()); 
                }
                e.Graphics.DrawImage(pb_BMP, 0, 0);
                pb_Graphics.Dispose();
            }

            class Points
            {
                public List<Point> PT=new List<Point>();
            }

            private void btnClear_Click(object sender, EventArgs e)
            {
                index = 0;
                HandTrack = new List<Points>();
                pnlBar.Refresh(); 
            }

            private void pnlBar_MouseUp(object sender, MouseEventArgs e)
            {
                index++;
            }

            private void pnlBar_MouseDown(object sender, MouseEventArgs e)
            {
                HandTrack.Add(new Points());
                HandTrack[index].PT.Add(new Point(e.X, e.Y));
                pnlBar.Refresh(); 
            }

            private void btnSave_Click(object sender, EventArgs e)
            {
                dlgSaveFile.Filter = "位图(*.bmp)|*.bmp";
                if (dlgSaveFile.ShowDialog() == DialogResult.OK)
                {
                    string strFile = dlgSaveFile.FileName;
                    pb_BMP.Save(strFile, System.Drawing.Imaging.ImageFormat.Bmp);
                }
            }
        }
    }

     

     

    2008年3月31日 1:49
    版主

全部回复

  • 如果是保存签名字迹的话,其实跟手写识别没有任何关系。最好自己开发,跟Windows画图板差不多。
    如果用Win32的话,就是GDI编程,您可以参考GDI开发相关的资料。
    如果用.net CF,用GDI Plus会更简单一些。

    2008年3月29日 11:23
    版主
  • 建议用CF完成,下面是我现写的一个程序,效果还不错,还可以保存为位图

    Code Snippet

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;

    namespace HandImage
    {
        public partial class frmTest : Form
        {
            List<Points> HandTrack=new List<Points>();
            public Graphics pb_Graphics;
            Bitmap pb_BMP = new Bitmap(239,235);

            int index = 0;    //第几笔
            public frmTest()
            {
                InitializeComponent();
            }

            private void pnlBar_MouseMove(object sender, MouseEventArgs e)
            {
                HandTrack[index].PT.Add(new Point(e.X, e.Y));
                pnlBar.Refresh();
            }

            private void pnlBar_Paint(object sender, PaintEventArgs e)
            {
                pb_Graphics = Graphics.FromImage((System.Drawing.Image)pb_BMP);
                pb_Graphics.Clear(pnlBar.BackColor);
                foreach(Points item in  HandTrack)
                {
                    pb_Graphics.DrawLines(new Pen(Color.Black), item.PT.ToArray()); 
                }
                e.Graphics.DrawImage(pb_BMP, 0, 0);
                pb_Graphics.Dispose();
            }

            class Points
            {
                public List<Point> PT=new List<Point>();
            }

            private void btnClear_Click(object sender, EventArgs e)
            {
                index = 0;
                HandTrack = new List<Points>();
                pnlBar.Refresh(); 
            }

            private void pnlBar_MouseUp(object sender, MouseEventArgs e)
            {
                index++;
            }

            private void pnlBar_MouseDown(object sender, MouseEventArgs e)
            {
                HandTrack.Add(new Points());
                HandTrack[index].PT.Add(new Point(e.X, e.Y));
                pnlBar.Refresh(); 
            }

            private void btnSave_Click(object sender, EventArgs e)
            {
                dlgSaveFile.Filter = "位图(*.bmp)|*.bmp";
                if (dlgSaveFile.ShowDialog() == DialogResult.OK)
                {
                    string strFile = dlgSaveFile.FileName;
                    pb_BMP.Save(strFile, System.Drawing.Imaging.ImageFormat.Bmp);
                }
            }
        }
    }

     

     

    2008年3月31日 1:49
    版主
  • 建议用CF完成,下面是我现写的一个程序,效果还不错,还可以保存为位图

    Code Snippet

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;

    namespace HandImage
    {
        public partial class frmTest : Form
        {
            List<Points> HandTrack=new List<Points>();
            public Graphics pb_Graphics;
            Bitmap pb_BMP = new Bitmap(239,235);

            int index = 0;    //第几笔
            public frmTest()
            {
                InitializeComponent();
            }

            private void pnlBar_MouseMove(object sender, MouseEventArgs e)
            {
                HandTrack[index].PT.Add(new Point(e.X, e.Y));
                pnlBar.Refresh();
            }

            private void pnlBar_Paint(object sender, PaintEventArgs e)
            {
                pb_Graphics = Graphics.FromImage((System.Drawing.Image)pb_BMP);
                pb_Graphics.Clear(pnlBar.BackColor);
                foreach(Points item in  HandTrack)
                {
                    pb_Graphics.DrawLines(new Pen(Color.Black), item.PT.ToArray()); 
                }
                e.Graphics.DrawImage(pb_BMP, 0, 0);
                pb_Graphics.Dispose();
            }

            class Points
            {
                public List<Point> PT=new List<Point>();
            }

            private void btnClear_Click(object sender, EventArgs e)
            {
                index = 0;
                HandTrack = new List<Points>();
                pnlBar.Refresh(); 
            }

            private void pnlBar_MouseUp(object sender, MouseEventArgs e)
            {
                index++;
            }

            private void pnlBar_MouseDown(object sender, MouseEventArgs e)
            {
                HandTrack.Add(new Points());
                HandTrack[index].PT.Add(new Point(e.X, e.Y));
                pnlBar.Refresh(); 
            }

            private void btnSave_Click(object sender, EventArgs e)
            {
                dlgSaveFile.Filter = "位图(*.bmp)|*.bmp";
                if (dlgSaveFile.ShowDialog() == DialogResult.OK)
                {
                    string strFile = dlgSaveFile.FileName;
                    pb_BMP.Save(strFile, System.Drawing.Imaging.ImageFormat.Bmp);
                }
            }
        }
    }

     

     

     

     


    pnlBar 是什么东西?
    2010年3月16日 13:21