保存:
byte[] signature;
using(MemoryStream ms = newMemoryStream())
{
icSignature.Strokes.Save(ms);
signature = ms.ToArray();
}
stringsql = "INSERT INTO tblMyTable (mySigCol) VALUES (@Sig)";
SqlCommand comm = newSqlCommand(sql, conn);
comm.Parameters.AddWithValue("@Sig", signature);
comm.ExecuteNonQuery();
/////////////////////////////////////////////////////////////////////////
读取
stringsql = "SELECT TOP 1 mySigCol FROM tblMyTable";
SqlCommand comm = newSqlCommand(sql, conn);
byte[] signature = (byte[])comm.ExecuteScalar();
using(MemoryStream ms = newMemoryStream(signature))
{
icSignature.Strokes = newSystem.Windows.Ink.StrokeCollection(ms);
ms.Close();
}
网友评论