Dim tb2 As WinForm.Table = e.Form.Controls("Table2")
Dim tb As Table = tb2.Table
Dim a As Integer = tb.TopRow+1
Dim b As Integer = tb.LeftCol+1
Dim c As Integer = tb.BottomRow+1
Dim d As Integer = tb.RightCol+1
'msgbox(a & b & c & d)
Dim rng As New List(of Object)
tb.Grid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom
For Each r As object In tb.Grid.MergedRanges
'msgbox(r.Toprow & r.leftcol & r.bottomrow & r.rightcol)
If a >= r.TopRow AndAlso b >= r.LeftCol AndAlso c <=
r.bottomRow AndAlso d <= r.rightCol OrElse a <= r.TopRow AndAlso b
<= r.LeftCol AndAlso c >= r.bottomRow AndAlso d >= r.rightCol
Then
rng.add(r)
End If
Next
如果每次点击设置颜色的功能都要遍历全表的所有合并的单元格,太浪费资源了。
有没有简单的办法获得当前的单元格是否合并,与那些区域合并?