zoukankan      html  css  js  c++  java
  • WPF 结合 微软的手写板 进行输入

    WPF 结合 微软的手写板 进行输入

    1                     <my:ImageButton Grid.Row="2" Height="42" Margin="278,2,0,0" x:Name="btnInput" VerticalAlignment="Top" Click="btnGetInput_Click" DefaultSource="/JiaXinTech.WPF.HotelTerminal;component/Images/JD/Attractions_Rim_S.png" Foreground="White" FontSize="20" Content="输入手写" FontWeight="Bold" HorizontalAlignment="Left" Width="146" />
    2 
    3                     <InkCanvas Grid.Row="3" HorizontalAlignment="Stretch" Name="inkInput" VerticalAlignment="Stretch" Background="#FFC1C1C1" Margin="20,0,20,20" />
    4 
    5                         <TextBox Height="50" HorizontalAlignment="Left" Name="tbUserName" VerticalAlignment="Center" Width="222" BorderBrush="#FF0F5DA8" Margin="125,0,0,0" Text="" FontSize="30" MaxLength="10" IsReadOnly="True" />
     1         private void btnGetInput_Click(object sender, RoutedEventArgs e)
     2         {
     3             if (inkInput.Strokes.Count > 0)
     4             {
     5                 System.Windows.Ink.StrokeCollection strokeList = inkInput.Strokes;
     6 
     7                 MemoryStream ms = new MemoryStream();
     8                 inkInput.Strokes.Save(ms);
     9                 InkCollector myInkCollector = new InkCollector();
    10                 Ink ink = new Ink();
    11                 ink.Load(ms.ToArray());
    12 
    13                 using (RecognizerContext myRecoContext = new RecognizerContext())
    14                 {
    15                     RecognitionStatus status;
    16                     RecognitionResult recoResult;
    17                     myRecoContext.Strokes = ink.Strokes;
    18                     recoResult = myRecoContext.Recognize(out status);
    19                     tbUserName.Text += recoResult.TopString;
    20                 }
    21                 inkInput.Strokes.Clear();
    22             }
    23         }
  • 相关阅读:
    Hadoop2.2.0 注意事项
    为一个表增加一列,这个列能够自增加1
    商品推荐系统问题
    Android Service服务-(转)
    android实现通知栏消息
    【Android】状态栏通知Notification、NotificationManager详解(转)
    android调用邮件应用发送email
    有关WebView开发问题(转)
    Android开发把项目打包成apk-(转)
    对话框(单选)
  • 原文地址:https://www.cnblogs.com/lanymy/p/2575942.html
Copyright © 2011-2022 走看看