我有这个程序:
''' <summary>
''' Append text to the current text.
''' </summary>
''' <param name="text">The text to append</param>
''' <param name="forecolor">The font color</param>
''' <param name="backcolor">The Background color</param>
''' <param name="font">The font of the text</param>
Public Sub Append_Text(ByVal text As String, _
ByVal forecolor As Color, _
Optional ByVal backcolor As Color = Nothing, _
Optional ByVal font As Font = Nothing)
Dim index As Int32 = MyBase.TextLength
MyBase.AppendText(text)
MyBase.SelectionStart = index
MyBase.SelectionLength = MyBase.TextLength - index
MyBase.SelectionColor = forecolor
If Not backcolor = Nothing Then MyBase.SelectionBackColor = backcolor
If font IsNot Nothing Then MyBase.SelectionFont = font
MyBase.SelectionStart = MyBase.TextLength
MyBase.SelectionLength = 0
End Sub
我这样调用程序:
RichTextLabel1.Append_Text("My ", Color.White, color.transparent, New Font("Arial", 12, FontStyle.Bold))
RichTextLabel1.Append_Text("RichText-", Color.White, , New Font("Arial", 12, FontStyle.Bold))
我的问题是我是否可以通过使用如下参数数组进行一次重载(以及如何进行修改)来调用 proc:
RichTextLabel1.Append_Text( _
{"My ", Color.White, Color.Transparent, New Font("Arial", 12, FontStyle.Bold)}, _
{"RichTextLabel", Color.White, Nothing, New Font("Arial", 16, FontStyle.Bold)})
(那段代码显然不起作用)