
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Public Sub draw_line(ByVal p1 As Point, ByVal p2 As Point, Optional ByVal lineColor As Color = Color.Black)
End Sub
End Class
请问:
color.black不是常量吗?
如何取得常量black?
------解决思路----------------------
不是常量,是枚举
你可以这么写
Private Sub Draw_Line(ByVal p1 As Point, ByVal p2 As Point, Optional ByVal lineColor As Color = Nothing)
If lineColor = Nothing Then
lineColor = Color.Black
End If
......
End Sub