VB6.0MSFlexGrid控件单元格颜色设置

thj0519thj 2012-02-09 09:50:18
实现MSFlexGrid控件单数行背景为白色,双数的行背景为蓝色?
Dim i As Integer

With MSFlexGrid1

.AllowBigSelection = True ’ 设置网格样式

.FillStyle = flexFillRepeat

For i = 0 To .Rows – 1

.Row = i: .Col = .FixedCols

.ColSel = .Cols() - .FixedCols – 1

If i Mod 2 = 0 Then

.CellBackColor = &HC 0C0C0 ’ 浅灰

Else

.CellBackColor = vbBlue ’ 兰色

End If

Next i

End With

以上程序中这段代码是什么意思
For i = 0 To .Rows – 1
.Row = i: .Col = .FixedCols
.ColSel = .Cols() - .FixedCols – 1
...全文
285 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
thj0519thj 2012-02-10
  • 打赏
  • 举报
回复
谢谢,楼上的回复,我明白了
贝隆 2012-02-09
  • 打赏
  • 举报
回复

Option Explicit

Private Sub Form_Load()
Dim intRow As Integer
Dim intCol As Integer
With MSFlexGrid1
.Rows = 100
.Cols = 8
End With
For intRow = 0 To 99
MSFlexGrid1.Row = intRow
For intCol = 1 To 7
MSFlexGrid1.Col = intCol
If intRow Mod 2 Then
MSFlexGrid1.CellBackColor = RGB(255, 255, 255)
Else
MSFlexGrid1.CellBackColor = RGB(0, 0, 255)
End If
Next intCol
Next intRow
End Sub

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧