我以前见过这个,但直到现在我才真正对它的目的感兴趣。看一看下面两个例子(OH,这是所有在VB.net顺便说一句):设置参数
实施例1:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using nFD As New FontDialog
If nFD.ShowDialog = Windows.Forms.DialogResult.OK Then
LoadFont(_font:=nFD.Font)
End If
End Using
End Sub
Private Sub LoadFont(ByVal _font As Font)
MsgBox(_font.Name)
End Sub
实施例2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using nFD As New FontDialog
If nFD.ShowDialog = Windows.Forms.DialogResult.OK Then
LoadFont(nFD.Font)
End If
End Using
End Sub
Private Sub LoadFont(ByVal _font As Font)
MsgBox(_font.Name)
End Sub
两个结果在同样的事情,你可能要关注的主要事情是我设定论点的地方。在设置参数时,:=
的用途是什么。我认为它比我刚刚尝试过的有更重要的用途,但我不能谷歌它,因为谷歌不喜欢符号。