Function MyArray(x, y, m, n, a, b, c, d, midcolor)
'x,y 为图形区域最左上小方块的左上角坐标
'm,n 为生产数组的最大下标,如当有8行8列时值为7,7
'a,b为每个小方块的大小
'c,d为每两个小方块之间的间距,一般如果小方块是紧挨着时值为a+1,b+1
'midcolor为空白方块中心颜色用于判断该方块是否为空,可多判断几点
Dim i, j, k
Dim ty, tempstr, avergb
i = 0 : j = 0 : k = 1
tx = x
tempstr = ""
Redim temparray(m - 1, n - 1)
For i = 0 To m - 1
For j = 0 To n - 1
IfColor x + int(a / 2), y + int(b / 2), midcolor, 0 Then
temparray(i, j) = 0
Else
avergb=""
avergb = avergb & GetPixelColor(x + int(a / 2), y + int(b / 2))
avergb = avergb & GetPixelColor(x + int(a / 4), y + int(b / 2))
avergb = avergb & GetPixelColor(x + int(a / 2), y + int(b / 4))
avergb = avergb & GetPixelColor(x + int(a / 2) + int(a / 4), y + int(b / 2))
avergb = avergb & GetPixelColor(x + int(a / 2), y + int(b / 2) + int(b / 4))
Pos = Instr(tempstr, avergb)
If Pos = 0 Then
temparray(i, j) = k
k = k + 1
tempstr = tempstr & avergb & ","
Else
temparray(i, j) = (Pos - 1) / 31 + 1
End If
End If
x = x + c
Next
y = y + d
x = tx
Next
MyArray = temparray
End Function