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         }
  • 相关阅读:
    Another kind of Fibonacci(hdu3306)
    Robot(hdu5673)
    The Luckiest number(hdu2462)
    Description has only two Sentences(hdu3307)
    codeforces(Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) )(C,D)
    Abelian Period
    Brute-force Algorithm(hdu3221)
    1046:Square Number
    Harry Potter and the Hide Story(hdu3988)
    C. Journey
  • 原文地址:https://www.cnblogs.com/lanymy/p/2575942.html
Copyright © 2011-2022 走看看