我以前見過這個,但直到現在我才真正對它的目的感興趣。看一看下面兩個例子(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
兩個結果在同樣的事情,你可能要關注的主要事情是我設定論點的地方。在設置參數時,:=
的用途是什麼。我認爲它比我剛剛嘗試過的有更重要的用途,但我不能谷歌它,因爲谷歌不喜歡符號。