可能重复:
VB.NET := 运算符
昨天我在浏览Microsoft® Agent代码片段时看到 := 在调用函数时使用。
我尝试在谷歌中搜索它,但我找不到任何与之相关的东西。
使用 := 是因为我们正在调用 COM 库的函数吗?
代码 :
Public Class Form1
Dim agent As AgentObjects.Agent
Dim merlin As AgentObjects.IAgentCtlCharacter
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
agent.Characters.Unload("merlin")
merlin = Nothing
agent = Nothing
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
agent = New AgentObjects.Agent
agent.Connected = True
agent.Characters.Load(CharacterID:="Merlin", LoadKey:="merlin.acs")
merlin = agent.Characters(CharacterID:="Merlin")
agent.PropertySheet.Visible = True
End Sub
Public Sub IntroMerlin()
Dim strName As String
With merlin
'Display character.
.Show()
'Make the character play an animation.
.Play(Animation:="Greet")
.Play(Animation:="Restpose")
.Speak(Text:="Hello!")
.Play(Animation:="Announce")
.Speak(Text:="I am Merlin.")
.Play(Animation:="Pleased")
.Speak(Text:="It is nice to meet you.")
End With
End Sub
End Class
谢谢。