VB .Net 3.5에서는 DataGridViewCell (바인딩되지 않음)의 색을 다른 색으로 변경할 수 있습니까? 포커스가 사라지거나 셀을 떠나기 전에 셀이 눈에 띄게 바뀌지 않습니까?? 데이터가있는 쿼리를 실행하는 타이머가 있고 사용자가 셀을 떠난 후에 대신 색상을 즉시 변경하고 싶습니다.DataGridViewCell 포커스를 잃지 않고 배경색 변경
DataGridView.Refresh 및 Me.Refresh를 시도했지만 결과를 얻지 못했습니다.
내가 뭘 잘못하고 있니? 그런 다음 당신이 행 내 경우에는, 예를 들어, 개의 다른 색으로 그려 질 때 (사용자가 CheckBoxCell를 클릭 할 때) 자신을 설명해야
''' <summary>
''' Sets or clears the passed cells background to Red
''' </summary>
''' <param name="ColumnNumber">Datagridview column index of the cell to be changed</param>
''' <param name="RowNumber">Datagridview row index of the cell to be changed</param>
''' <param name="Error">Indicate whether the cell should be red, <c>True</c>, or empty, <c>False</c></param>
Private Sub Error_Cell(ByVal ColumnNumber As Integer, ByVal RowNumber As Integer, ByVal [Error] As Boolean)
If [Error] Then
Me.dgvMain.Rows(RowNumber).Cells(ColumnNumber).Style.BackColor = Color.Red
Else
Me.dgvMain.Rows(RowNumber).Cells(ColumnNumber).Style.BackColor = Color.Empty
End If
Me.dgvMain.Refresh()
Me.Refresh()
End Sub
사용자가 잘못된 부품 번호를 입력하면 행을 다른 색으로 칠합니다. 그들이 다른 곳으로 이동하기 전에 셀은 색상을 변경하여 올바른 부분을 사용하지 않는다고 알립니다. 나는 이것에 대해 며칠 동안 놀고 있었기 때문에 나는 너희들에게 물어볼 것이라고 생각했다. – Stevoni