RT

解决方案 »

  1.   

    MSHFlexGrid.row=3
    for i=0 to MSHFlexGrid.cols-1
        MSHFlexGrid.col=i
        MSHFlexGrid.CellBackColor=rgb(0,255,0)
    next i
      

  2.   

    Private Sub hflexgrid_EnterCell()
        '单击某一单元时,改变该行颜色
        Dim i_Col As Integer
        Dim c_col As Integer
        c_col = HFlexgrid.col
        If c_col > 0 Then
            For i_Col = 0 To HFlexgrid.Cols - 1
                HFlexgrid.col = i_Col
                HFlexgrid.CellBackColor = &HFFFFC0
            Next i_Col
            HFlexgrid.col = c_col
        End If
    End Sub
    Private Sub hflexgrid_LeaveCell()
        '当某一行失去焦点时,改变该行颜色
        Dim i_Col As Integer
        Dim c_col As Integer
        c_col = HFlexgrid.col
        For i_Col = 0 To HFlexgrid.Cols - 1
            HFlexgrid.col = i_Col
            HFlexgrid.CellBackColor = vbWhite
        Next i_Col
        HFlexgrid.col = c_col
    End Sub
      

  3.   

    Private Sub Form_Load()
        Dim int_row As Integer
        Dim i As Integer
        
        int_row = MSHFlexGrid1.Rows
        For i = 1 To int_row - 1
             MSHFlexGrid1.Col = 1
             MSHFlexGrid1.Row = i
             MSHFlexGrid1.CellBackColor = vbRed
        Next i
    End Sub
    解决了,谢谢提供思路。