首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

VB6.0MSFlexGrid控件单元格颜色设置,该怎么处理

2012-03-31 
VB6.0MSFlexGrid控件单元格颜色设置实现MSFlexGrid控件单数行背景为白色,双数的行背景为蓝色?Dim i As Int

VB6.0MSFlexGrid控件单元格颜色设置
实现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


[解决办法]

VB code
Option ExplicitPrivate 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 intRowEnd Sub 

热点排行
Bad Request.