private void RefreshCursorValue(object sender, StripTabCursorEventArgs eventArgs) { // 如果只有数据更新或者使能更新,则只刷新 if (eventArgs.Operation == StripTabCursorOperation.ValueChanged) { int index = _cursors.IndexOf(eventArgs.Cursor); double yValue = _cursors[index].YValue; dataGridView_cursorInfo.Rows[index].Cells[CursorEnableIndex].Value = _cursors[index].Enabled; dataGridView_cursorInfo.Rows[index].Cells[CursorColorIndex].Style.BackColor = _cursors[index].Color; dataGridView_cursorInfo.Rows[index].Cells[CursorNameIndex].Value = _cursors[index].Name; dataGridView_cursorInfo.Rows[index].Cells[CursorXDataIndex].Value = _cursors[index].XIndex; dataGridView_cursorInfo.Rows[index].Cells[CursorXValueIndex].Value = _cursors[index].XValue; dataGridView_cursorInfo.Rows[index].Cells[CursorYValueIndex].Value = double.IsNaN(yValue) ? string.Empty : yValue.ToString(); } else { RefreshCursorInfo(); } }
public int IndexOf(object value) { return(_collection.IndexOf(value as StripTabCursor)); }