| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 411 人关注过本帖
标题:谁对VC,VB都懂,请教个问题!谢谢
只看楼主 加入收藏
qer
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-5-21
结帖率:0
收藏
 问题点数:0 回复次数:2 
谁对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
2010-06-20 02:02
maochuan
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-7-18
收藏
得分:0 
   OH!
     太复杂了
2010-07-18 18:47
maochuan
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-7-18
收藏
得分:0 
   我学的 不是多好
          怕误导你
2010-07-18 18:48
快速回复:谁对VC,VB都懂,请教个问题!谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020163 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved