谁对VC,VB都懂,请教个问题!谢谢
下面这段VB实现的功能谁能帮我用VC写出来,谢谢了Private Sub zx(ByVal ss As Range)
Dim R, Bz(), IsC() As Boolean, d As New Dictionary
Dim Rm, Rn, Cm, Cn, n, s
[g2:I100] = ""
R = ss
Rm = UBound(R)
Rn = LBound(R)
Cm = UBound(R, 2)
Cn = LBound(R)
ReDim IsC(Rm, Cm)
k = 1
For i = 1 To Rm
For j = 1 To Cm
s = R(i, j)
If R(i, j) = s And Not IsC(i, j) Then
d(i & " " & j) = ""
x = i: y = j
While d.Count > 0
n = n + 1
ReDim Preserve Bz(n)
Bz(n) = Chr(64 + y) & x
IsC(x, y) = True
If d.Exists(x & " " & y) Then d.Remove (x & " " & y)
If x > Rn Then
If Not IsC(x - 1, y) And R(x - 1, y) = s Then d(x - 1 & " " & y) = ""
End If
If x < Rm Then
If Not IsC(x + 1, y) And R(x + 1, y) = s Then d(x + 1 & " " & y) = ""
End If
If y > Cn Then
If Not IsC(x, y - 1) And R(x, y - 1) = s Then d(x & " " & y - 1) = ""
End If
If y < Cm Then
If Not IsC(x, y + 1) And R(x, y + 1) = s Then d(x & " " & y + 1) = ""
End If
If d.Count > 0 Then
x = CInt(Split(d.Keys(0))(0))
y = CInt(Split(d.Keys(0))(1))
End If
Wend
k = k + 1
Range(Join(Bz, ",")).Interior.ColorIndex = k
Cells(k, 7) = UBound(Bz)
Cells(k, 8) = Join(Bz, ",")
Cells(k, 9) = s
n = 0
End If
Next
Next
End Sub