我根本没有做太多的开始......但是,在我开始实际游戏功能之前......我需要能够动态加载一些控件来填充一个区域窗口。
Public Class Form1
Dim b As Button
Public col As Integer
Public row As Integer
Public counter As Integer = 1
Dim grid(,) As Integer = {{1, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0}}
Private Sub MyButtons()
Dim temp As String = ""
For row = 0 To 8
For col = 0 To 3
temp = "This is number: " & grid(row, col)
Next
MessageBox.Show(temp)
Next
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MyButtons()
End Sub
End Class
控件尤其是图片框,以9x9网格布局。在上面的代码中显示的只是我一直在尝试弄清楚它是如何工作的东西。
我希望它基于数组值中的数值,0将不显示任何内容,1将显示空的peg孔,2将显示一个peg。
一旦我弄清楚如何使用数组加载网格中的所有内容,我就可以自己对其余部分进行排序。
......是的,这是一项任务,老实说我到处都是。我不确定使用整数调用网格方法是什么,所以google在这一点上没有用处
所有人都有一些知识要传授给我吗?谢谢!