美文网首页
Save WPF Ink Strokes To a Databa

Save WPF Ink Strokes To a Databa

作者: 虫虫侠教育 | 来源:发表于2019-03-10 17:40 被阅读0次

    保存:

    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();

    }

    相关文章

      网友评论

          本文标题:Save WPF Ink Strokes To a Databa

          本文链接:https://www.haomeiwen.com/subject/jphppqtx.html