请求这样的委托为什么得不到结果呢,结果总是空的?急!

战斗生活 2010-06-24 06:05:56
aspx页面代码

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server"> <title>Untitled Page</title> </head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="Text1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</div>
</form>
<asp:Label ID="Label1" runat="server" ></asp:Label>
</body>
</html>




aspx.cs页面代码


using System;
using System.Collections;
using System.Configuration;
using System.Data;
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 SpeechLib;

public partial class _Default : System.Web.UI.Page
{
public SpeechLib.SpVoice vox = new SpVoiceClass();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
vox.Viseme += new SpeechLib._ISpeechVoiceEvents_VisemeEventHandler(vox_Viseme);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
vox.Speak(Text1.Text,SpeechVoiceSpeakFlags.SVSFlagsAsync);
//vox.Viseme += new SpeechLib._ISpeechVoiceEvents_VisemeEventHandler(vox_Viseme);
Label1.Text = "Hellow";
}

void vox_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechLib.SpeechVisemeType NextVisemeId, SpeechLib.SpeechVisemeFeature Feature, SpeechLib.SpeechVisemeType CurrentVisemeId)
{
// Label1.Text = Label1.Text + CurrentVisemeId + " "; //我想得到这个值 但是测试的时候都没有触发.
Label1.Text += Text1.Text; //问题就在这里没有结果 没有触发
}

}





结果是提交表单后 没有得到触发的结果 我该如何写的呢 请大哥大姐们帮帮忙啊
谢谢先了
...全文
93 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
战斗生活 2010-06-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 sprc_lcl 的回复:]

if (!Page.IsPostBack)
{ vox.Viseme += new SpeechLib._ISpeechVoiceEvents_VisemeEventHandler(vox_Viseme);
}

红色去掉,IsPostBack这地方不适合
[/Quote]

兄弟 那该如何写呢? 谢谢先了 帮帮忙吧
sprc_lcl 2010-06-24
  • 打赏
  • 举报
回复
if (!Page.IsPostBack)
{
vox.Viseme += new SpeechLib._ISpeechVoiceEvents_VisemeEventHandler(vox_Viseme);
}

红色去掉,IsPostBack这地方不适合

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧