开发者

Windows Speech Recognition C#

开发者 https://www.devze.com 2022-12-14 03:16 出处:网络
I\'m making a program that does stuff (Sorry, I\'m not allowed to say what it is), but I want to be able to let Windows Speech somehow \"know\" that there are linklabels and buttons on my Forms, so th

I'm making a program that does stuff (Sorry, I'm not allowed to say what it is), but I want to be able to let Windows Speech somehow "know" that there are linklabels and buttons on my Forms, so that when I say "Next" or "Start" etc, it will click those buttons. Just like when you are using IE and you are on Google.com and when you say "Search" it will perform a click on the search button and begin the search.

The problem is that it doesn't see开发者_JAVA百科m to know that buttons/linklabels or anything like that exist in C# windows forms applications. Is this something that we must do ourselves?

Thanks

Bael


Windows Speech Recognition uses MSAA and UI Automation to find the buttons, links, etc., on your application. So, if your app has the appropriate AccessibleRole and AccessibleName definitions set on your controls, WSR should find them just fine.


There is a way to make labels known to your speech rec. program but i'm not sure about buttons.

label1.Text = string.Format(//your string code in here)


You could use a switch:

string speech = e.Result.Text;
switch  (speech)
{
case "Next":
BtnNext.PerformClick();
break;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消