VB- Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
- AddHandler Me.gcMultiRow.CellFormatting, AddressOf gcMultiRow_CellFormatting
- End Sub
- Private Sub gcMultiRow_CellFormatting(ByVal sender As Object, ByVal e As CellFormattingEventArgs)
- If e.Value IsNot Nothing Then
- Dim value As Integer
- If Integer.TryParse(e.Value.ToString(), value) Then
- If value < 0 Then
- e.CellStyle.ForeColor = Color.Red
- e.CellStyle.SelectionForeColor = Color.Red
- End If
- End If
- End If
- End Sub
复制代码 |