我知道如何使用变量名创建按钮:
Dim newbuttonname As String = TextBox1.Text
Dim createdButton = New Button()
createdButton.Name = newbuttonname
'...
以类似的方式,我想从变量中命名我自己的矩形:
Dim variablename As New Rectangle(10, 10, 200, 200)
g.DrawRectangle(Pens.Blue, rect:=variablename)
我希望rect:=
是动态的,所以我可以使用相同的代码来构建许多唯一命名的变量,但当然它只有名称“variablename”。