我有一个自定义IBinding一览表中引发ListChanged事件。我想ListChanged事件后重新着色DataGridView的一行。
I have a custom IBinding List which raises the ListChanged event. I would like to recolor the Datagridview row after the ListChanged event.
在DataGridView正在响应ListChanged事件并更改单元格的值,但CellValueChanged事件从来没有发射。
The Datagridview is responding to ListChanged event and changes the cell value but the CellValueChanged event is never fired.
什么datagridview的事件反映了ListChanged事件?
What Datagridview event reflects the ListChanged event?
类CustomList:IBinding
Public Sub UpdateList(Byval index as Integer)
List(index).Active = true
RaiseEvent ListChanged(Me, _
New System.ComponentModel.ListChangedEventArgs _
(System.ComponentModel.ListChangedType.ItemChanged, index))
End Sub
类CustomDataGridView:DataGridView中
Private Sub Grid_CellValueChanged(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
Handles Me.CellValueChanged
ColorRow(Rows(e.RowIndex)) ''//NeverFires
End Sub
类:表
Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Load
Dim customList As New CustomList()
customList.add(new CustomItem())
dgv.DataSource = customList
customList.UpdateList(0) ''//DatagridView updates but no event is raised
End Sub
更新:
CellValueChanged事件仅触发时 一个新的值被从DGV推到 在DT。不是倒过来。
CellValueChanged event only fires when a new value is pushed from the DGV to the DT. Not other way round.
- Vivek 4月5日在18:52
更改单元格背景颜色应在行prePaint-事件来完成,如果该行被粉刷一新,这将被解雇,值更改后。
Changing the cells background color should be done in the RowPrePaint-Event, this will be fired if the row is repainted, after the value change.
上一篇:C ++的内存管理和.NET内存管理之间的区别是什么?内存管理、区别、NET
下一篇:使用 xaringan 和 plotly 以编程方式在 R 中生成幻灯片幻灯片、方式、xaringan、plotly