private void dataGridView1_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { if (e.RowIndex >= eventStore.Count) { return; } MidiMonitorRecord eventInfo = eventStore[e.RowIndex]; // Set the cell value to paint // first row is always RowIndex if (e.ColumnIndex > 0) { e.Value = GetStringDataByColumnIndex(e.ColumnIndex, eventInfo); } else { e.Value = e.RowIndex; } }
string GetStringDataByColumnIndex(int columnIndex, MidiMonitorRecord rec) { if (columnIndex == 1) { return(rec.eventDate.ToString()); } else if (columnIndex == 2) { return(rec.eventType); } else if (columnIndex == 3) { return(rec.channel.ToString()); } else if (columnIndex == 4) { return(rec.controlNumber.ToString()); } else if (columnIndex == 5) { return(rec.controlValue.ToString()); } else if (columnIndex == 6) { return(rec.programNumber.ToString()); } else if (columnIndex == 7) { return(rec.noteNumber.ToString()); } else if (columnIndex == 8) { return(rec.noteVelocity.ToString()); } else { return(nv); } }
private void HandleOnRecieve(object sender, MidiEventReceivedEventArgs args) { MidiMonitorRecord r = new MidiMonitorRecord(DateTime.Now, args.Event); eventStore.Add(r); }