我正在研究一个VB项目。步骤说明:为单词中的每个字符设置标签控件。
“单词”来自数据集。关于我如何解决这个问题的任何建议?这是一个刽子手游戏项目。
答案 0 :(得分:0)
类似的东西:
Public Sub CreateLabelForEachChar(ByVal aWord As String)
Dim charArr() As Char = aWord.ToCharArray
Dim labelCount As Integer
For Each character In charArr
Dim aLabel As New Label
aLabel.Name = "label" & labelCount.ToString
aLabel.Text = character
aLabel.Location = New Point(x, y) 'figure out where you wan to put your label
Me.Controls.Add(aLabel)
labelCount += 1
Next
End Sub