Public Class Form1
Dim WithEvents Voice As VoiceEngine
Dim ObjDessin As System.Drawing.Graphics = Me.CreateGraphics() 'Création de l'object graphique
Dim ObjGraph As New System.Drawing.Rectangle(0, 0, 0, 0) 'Définition d'un objet de taille de 200 x 200 à l'emplacement 100 x 100
Dim shape2 As New System.Drawing.Rectangle(0, 0, 0, 0)
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
ObjDessin.DrawRectangle(Pens.Black, ObjGraph)
ObjDessin.FillRectangle(Brushes.White, ObjGraph)
ObjDessin.DrawRectangle(Pens.Black, shape2)
ObjDessin.FillRectangle(Brushes.Blue, shape2)
TextBox2.Visible = False
'Traçage d'un rectangle en fonction de ObjGraph
End Sub
Private Sub Voice_AudioSignal(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal level As Integer) Handles Voice.AudioSignal
shape2.Width = level * ObjGraph.Width / 100
ObjDessin.DrawRectangle(Pens.Blue, shape2)
End Sub
Private Sub Voice_RecognitionFinalResult(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal vResult As String, ByVal vPassword As String, ByVal vAudioSize As Integer, ByVal vAudioTime As Integer, ByVal StartingTime As Integer, ByVal vPronunciation As String, ByVal StartWavePosition As Integer, ByVal EndWavePosition As Integer) Handles Voice.RecognitionFinalResult
TextBox1.Text = vResult
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Voice.vStart(DictationFeatures.urDictation)
Catch ex As Exception
TextBox3.Text = ex.ToString
End Try
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Voice.vStop()
End Sub
End Class