View Single Post
 
Old 10-29-2003, 07:43 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,164
Default

Changing complete row / column background color:
Code:
FlexGridColumnColor MSFlexGrid1, 2, vbRed FlexGridRowColor MSFlexGrid1, 3, vbBlue
Code:
Public Sub FlexGridColumnColor(FlexGrid As MSFlexGrid, ByVal lColumn As Long, ByVal lColor As Long) Dim lPrevCol As Long, lPrevColSel As Long Dim lPrevRow As Long, lPrevRowSel As Long Dim lPrevFillStyle As Long If lColumn > FlexGrid.Cols - 1 Then Exit Sub With FlexGrid ' Store the current settings lPrevCol = .Col lPrevRow = .Row lPrevColSel = .ColSel lPrevRowSel = .RowSel lPrevFillStyle = .FillStyle ' Change the backcolor .Col = lColumn .Row = .FixedRows .ColSel = lColumn .RowSel = .Rows - 1 .FillStyle = flexFillRepeat .CellBackColor = lColor ' reset the settings .Col = lPrevCol .Row = lPrevRow .ColSel = lPrevColSel .RowSel = lPrevRowSel .FillStyle = lPrevFillStyle End With End Sub Public Sub FlexGridRowColor(FlexGrid As MSFlexGrid, ByVal lRow As Long, ByVal lColor As Long) Dim lPrevCol As Long, lPrevColSel As Long Dim lPrevRow As Long, lPrevRowSel As Long Dim lPrevFillStyle As Long If lRow > FlexGrid.Rows - 1 Then Exit Sub With FlexGrid ' Store the current settings lPrevCol = .Col lPrevRow = .Row lPrevColSel = .ColSel lPrevRowSel = .RowSel lPrevFillStyle = .FillStyle ' Change the backcolor .Col = .FixedCols .Row = lRow .ColSel = .Cols - 1 .RowSel = lRow .FillStyle = flexFillRepeat .CellBackColor = lColor ' reset the settings .Col = lPrevCol .Row = lPrevRow .ColSel = lPrevColSel .RowSel = lPrevRowSel .FillStyle = lPrevFillStyle End With End Sub
Reply With Quote