首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >csharp: winform using Microsoft.Ink(Tablet PC API) create Signature image

csharp: winform using Microsoft.Ink(Tablet PC API) create Signature image

作者头像
geovindu
发布2026-06-18 15:56:50
发布2026-06-18 15:56:50
1040
举报
代码语言:javascript
复制
/*
下載:
//Microsoft Windows XP Tablet PC Edition 2005 Recognizer Pack http://www.microsoft.com/zh-cn/download/details.aspx?id=1601
//Microsoft Windows XP Tablet PC Edition Software Development Kit 1.7  http://www.microsoft.com/en-us/download/details.aspx?id=20039
 * Microsoft Speech Platform - Software Development Kit (SDK) (Version 11) http://www.microsoft.com/en-us/download/details.aspx?id=27226
 * Microsoft SDKs http://msdn.microsoft.com/en-us/dd299405.aspx
 *Microsoft.Ink 命名空间  http://msdn.microsoft.com/zh-cn/library/microsoft.ink%28v=vs.90%29.aspx
 * 
 *  安裝的文件在://Program Files\Microsoft Tablet PC Platform SDK\Include\Microsoft.Ink.dll
 *  在Windows XP sp3 環境下測試
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Microsoft.Ink; //引用:Micosoft Tablet PC





namespace ChineseCalenderGeovinDu
{
    /// <summary>
    /// 20120914
    /// 塗聚文
    /// 捷為工作室
    /// 締友計算機信息技術有限公司
    /// </summary>
    public partial class TabletPCForm : Form
    {

        InkOverlay inkOverlay;
        InkPicture InkPicture1 = new InkPicture();

        /// <summary>
        /// 
        /// </summary>
        public TabletPCForm()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TabletPCForm_Load(object sender, EventArgs e)
        {
            inkOverlay = new InkOverlay();
            inkOverlay.Handle = this.pictureBox1.Handle;// this.Handle;//整個窗體
            inkOverlay.Enabled = true;

        }
       
        /// <summary>
        /// 保存圖片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "GIF IMAGES(*.gif)|*.gif";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                txtpath.Text = sfd.FileName;
                FileStream gifFile;
                byte[] fortifiedGif = null;
                // open the file for writing
                gifFile = File.OpenWrite(txtpath.Text);
                // Generate the fortified GIF represenation of the ink
                fortifiedGif = inkOverlay.Ink.Save(PersistenceFormat.Gif);
                // Write and close the gif file
                gifFile.Write(fortifiedGif, 0, fortifiedGif.Length);
                gifFile.Close();
                this.pictureBox2.Image = Image.FromFile(sfd.FileName);
            }
        }

       
        /// <summary>
        /// 清除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonClear_Click(object sender, EventArgs e)
        {
            inkOverlay.Enabled = false;
            inkOverlay.Ink.DeleteStrokes();
            this.pictureBox1.Invalidate() ;
            this.pictureBox2.Invalidate();
            inkOverlay.Enabled = true;
        }










    }

}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2026-06-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档