因为MultiRow支持自由布局,所以Row区域的Cell的个数和Header区域的Cell个数不一定是一样的。也不一定有对应关系,所以没有支持Excel那样选择Cell,Header变色的功能。
但是你可以尝试以下代码自己实现这个功能
- Private Sub GcMultiRow1_CellFormatting(sender As Object, e As GrapeCity.Win.MultiRow.CellFormattingEventArgs) Handles GcMultiRow1.CellFormatting
- If e.Scope = CellScope.ColumnHeader Then
- If GcMultiRow1.CurrentCellPosition.CellIndex = e.CellIndex Then
- e.CellStyle.BackColor = Color.Orange
- End If
- End If
- If e.CellName = "rowHeaderCell1" Then
- If GcMultiRow1.CurrentCellPosition.RowIndex = e.RowIndex Then
- e.CellStyle.BackColor = Color.Orange
- End If
- End If
- End Sub
- Private Sub GcMultiRow1_SelectionChanged(sender As Object, e As System.EventArgs) Handles GcMultiRow1.SelectionChanged
- Me.GcMultiRow1.Invalidate()
- End Sub
复制代码 |