winform下能实现,但在aspx为何不能实现呢?

cocos精品源码 - 汉字游戏 cocos精品源码 - 汉字游戏 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在winform下能实现,但在aspx为何不能实现呢?

form.cs

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 SpeechLib;

namespace pro2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SpeechLib.SpVoice Voice = new SpVoiceClass();
private void Form1_Load(object sender, EventArgs e)
{
Voice.Viseme += new _ISpeechVoiceEvents_VisemeEventHandler(Voice_Viseme);
}

private void button1_Click(object sender, EventArgs e)
{
Voice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
}

void Voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
{

label1.Text += "CurrentVisemeId:" + CurrentVisemeId.ToString() + "\n";

}

}
}


上面能得到结果



aspx.cs


using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SpeechLib;

namespace myspeak
{
public partial class MySpeak : System.Web.UI.Page
{
SpeechLib.SpVoice Voice = new SpVoiceClass();
protected void Page_Load(object sender, EventArgs e)
{
Voice.Viseme += new _ISpeechVoiceEvents_VisemeEventHandler(Voice_Viseme);
}
void Voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
{
lbl.Text += "Voice_Viseme:" + CurrentVisemeId.ToString();
}

protected void Button1_Click1(object sender, EventArgs e)
{
Voice.Speak("hello", SpeechVoiceSpeakFlags.SVSFlagsAsync);
}

}
}

下面这个却没有得到CurrentVisemeId这是为什么呢


winform下面和aspx.net的委托机制不一样吗
为什么后者没有事件触发


谢谢各位先啦
...全文
评论 20
收藏 已收藏
分享
返回顶部
cocos精品源码 - 汉字游戏
C# 111,128 成员 642,537 内容