?? frmmsagent.frm
字號:
VERSION 5.00
Object = "{F5BE8BC2-7DE6-11D0-91FE-00C04FD701A5}#1.5#0"; "AGENTCTL.DLL"
Begin VB.Form frmMSAgent
BorderStyle = 1 'Fixed Single
Caption = "Demonstrating Microsoft Agent"
ClientHeight = 1050
ClientLeft = 5100
ClientTop = 3750
ClientWidth = 4710
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 70
ScaleMode = 3 'Pixel
ScaleWidth = 314
Begin VB.CommandButton cmdSpeak
Caption = "Speak"
Height = 315
Left = 2280
TabIndex = 2
Top = 720
Width = 2415
End
Begin VB.ComboBox cboCharacter
Height = 315
Left = 0
TabIndex = 1
Text = "Choose a character"
Top = 720
Width = 2295
End
Begin VB.TextBox txtToSpeak
Height = 735
Left = 0
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Text = "frmMSAgent.frx":0000
Top = 0
Width = 4695
End
Begin AgentObjectsCtl.Agent Agent1
Left = 3840
Top = 120
End
End
Attribute VB_Name = "frmMSAgent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 20.1
' Demonstrating Microsoft Agent
Option Explicit
Dim currentCharacter As IAgentCtlCharacter
Dim characterLocation As String
Private Sub Form_Load()
' get the location of the character descriptions
characterLocation = _
InputBox("Enter Microsoft Agent character location", _
"Character Location", _
"c:\program files\microsoft agent\characters\")
' load the characters
Call Agent1.Characters.Load( _
"Genie", characterLocation & "genie.acs")
Call Agent1.Characters.Load( _
"Merlin", characterLocation & "merlin.acs")
Call Agent1.Characters.Load( _
"Robby", characterLocation & "robby.acs")
' populate the ComboBox
Call cboCharacter.AddItem("Genie")
Call cboCharacter.AddItem("Merlin")
Call cboCharacter.AddItem("Robby")
End Sub
Private Sub Form_Activate()
' set the current character, move it,
' show it and make it speak
Set currentCharacter = Agent1.Characters("Genie")
Call currentCharacter.MoveTo( _
frmMSAgent.Left \ 20, frmMSAgent.Top \ 20)
Call currentCharacter.Show
Call currentCharacter.Speak(txtToSpeak.Text)
End Sub
Private Sub Agent1_Click(ByVal CharacterID As String, _
ByVal Button As Integer, ByVal Shift As Integer, _
ByVal x As Integer, ByVal y As Integer)
Call currentCharacter.Speak("Ouch! Why did you do that?")
Call currentCharacter.Play("Confused")
Call currentCharacter.Play("ConfusedReturn")
End Sub
Private Sub Agent1_DblClick(ByVal CharacterID As String, _
ByVal Button As Integer, ByVal Shift As Integer, _
ByVal x As Integer, ByVal y As Integer)
Call currentCharacter.Play("Alert")
Call currentCharacter.Play("AlertReturn")
Call currentCharacter.Speak("Stop it!")
End Sub
Private Sub Agent1_DragStart(ByVal CharacterID As String, _
ByVal Button As Integer, ByVal Shift As Integer, _
ByVal x As Integer, ByVal y As Integer)
Call currentCharacter.Play("Alert")
Call currentCharacter.Speak("Put me down!")
Call currentCharacter.Play("AlertReturn")
End Sub
Private Sub Agent1_DragComplete(ByVal CharacterID As String, _
ByVal Button As Integer, ByVal Shift As Integer, _
ByVal x As Integer, ByVal y As Integer)
Call currentCharacter.Speak("Thank you!")
End Sub
Private Sub Agent1_Show(ByVal CharacterID As String, _
ByVal Cause As Integer)
Call currentCharacter.Play("Acknowledge")
End Sub
Private Sub cboCharacter_Click()
' hide the previous character, set the new character,
' move it, show it and make it speak
Call currentCharacter.Hide
Set currentCharacter = Agent1.Characters(cboCharacter.Text)
Call currentCharacter.MoveTo( _
frmMSAgent.Left \ 20, frmMSAgent.Top \ 20)
Call currentCharacter.Show
Call currentCharacter.Speak(txtToSpeak.Text)
End Sub
Private Sub cmdSpeak_Click()
' make the current character speak again
If txtToSpeak.Text = "" Then
Call currentCharacter.Speak( _
"Please, type the words you want me to speak.")
Else
Call currentCharacter.Speak(txtToSpeak.Text)
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -