我将MSHFlexGrid绑定到Recordset,并在最后增加一行显示合计数,将新增加的行的前景色和背景色设为蓝色和灰色,但当recordset重新查询后,前景色和背景色就不见了,但用鼠标在单击合计行的单元格,前景色和背景色就出现,请问怎样使前景色和背景色始终显示?以下是代码:Dim a, b, c As Integer
Dim s1, s2, s3 As Integer
a = MSGroup.Cols - 3
b = MSGroup.Cols - 2
c = MSGroup.Cols - 1
For x = 0 To MSGroup.Rows - 1
MSGroup.TextMatrix(x, a) = Format(MSGroup.TextMatrix(x, a), "0")
s1 = s1 + Val(MSGroup.TextMatrix(x, a))
MSGroup.TextMatrix(x, b) = Format(MSGroup.TextMatrix(x, b), "0")
s2 = s2 + Val(MSGroup.TextMatrix(x, b))
MSGroup.TextMatrix(x, c) = Format(MSGroup.TextMatrix(x, c), "0")
s3 = s3 + Val(MSGroup.TextMatrix(x, c))
Next
MSGroup.AddItem "合计"
rc = MSGroup.Rows - 1
MSGroup.TextMatrix(rc, a) = s1
MSGroup.TextMatrix(rc, b) = s2
MSGroup.TextMatrix(rc, c) = s3MSGroup.Row = MSGroup.Rows - 1
For f = 0 To MSGroup.Cols - 1
MSGroup.Col = f
MSGroup.CellBackColor = 12632256
MSGroup.CellForeColor = 16711680
Next
Dim s1, s2, s3 As Integer
a = MSGroup.Cols - 3
b = MSGroup.Cols - 2
c = MSGroup.Cols - 1
For x = 0 To MSGroup.Rows - 1
MSGroup.TextMatrix(x, a) = Format(MSGroup.TextMatrix(x, a), "0")
s1 = s1 + Val(MSGroup.TextMatrix(x, a))
MSGroup.TextMatrix(x, b) = Format(MSGroup.TextMatrix(x, b), "0")
s2 = s2 + Val(MSGroup.TextMatrix(x, b))
MSGroup.TextMatrix(x, c) = Format(MSGroup.TextMatrix(x, c), "0")
s3 = s3 + Val(MSGroup.TextMatrix(x, c))
Next
MSGroup.AddItem "合计"
rc = MSGroup.Rows - 1
MSGroup.TextMatrix(rc, a) = s1
MSGroup.TextMatrix(rc, b) = s2
MSGroup.TextMatrix(rc, c) = s3MSGroup.Row = MSGroup.Rows - 1
For f = 0 To MSGroup.Cols - 1
MSGroup.Col = f
MSGroup.CellBackColor = 12632256
MSGroup.CellForeColor = 16711680
Next
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货