CÁC GIẢI PHÁP LẬP TRÌNH C# - Trang 341

341

Chương 8: Đồ họa, đa phương tiện, và in ấn

mSpeaker.Show(0);

}

catch (FileNotFoundException)

{

MessageBox.Show("Invalid character location", "Error",

MessageBoxButtons.OK, MessageBoxIcon.Error);

}

}

}

// Phương thức thụ lý sự kiện Click của nút Speak.

private void cmdSpeak_Click(System.Object sender, System.EventArgs e)

{

// Nếu txtSpeech rỗng, nhân vật nhắc người dùng nhập text vào txtSpeech.

if (txtSpeech.Text == "")

{

mSpeaker.Speak("Please type the words you want me to speak", "");

}

else

{

mSpeaker.Speak(txtSpeech.Text, "");

}

}

// Phương thức thụ lý sự kiện Click của agent.

private void mainAgent_ClickEvent(object sender,

AxAgentObjects._AgentEvents_ClickEvent e)

{

mSpeaker.Play("Confused");

mSpeaker.Speak("Why are you poking me?", "");

mSpeaker.Play("RestPose");

}

// Phương thức thụ lý sự kiện SelectedIndexChanged của characterCombo

// (người dùng chọn nhân vật mới).

private void characterCombo_SelectedIndexChanged(System.Object sender,

System.EventArgs e)