本文整理汇总了C#中System.Windows.Forms.DataGridViewCellValueEventHandler代理的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewCellValueEventHandler代理的具体用法?C# DataGridViewCellValueEventHandler怎么用?C# DataGridViewCellValueEventHandler使用的例子?那么恭喜您, 这里精选的代理代码示例或许可以为您提供帮助。
DataGridViewCellValueEventHandler代理属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCellValueEventHandler代理的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: dataGridView1_CellValueNeeded
#region "data store maintance"
const int initialValue = -1;
private void dataGridView1_CellValueNeeded(object sender,
DataGridViewCellValueEventArgs e)
{
if (store.ContainsKey(e.RowIndex))
{
// Use the store if the e value has been modified
// and stored.
e.Value = store[e.RowIndex];
}
else if (newRowNeeded && e.RowIndex == numberOfRows)
{
if (dataGridView1.IsCurrentCellInEditMode)
{
e.Value = initialValue;
}
else
{
// Show a blank value if the cursor is just resting
// on the last row.
e.Value = String.Empty;
}
}
else
{
e.Value = e.RowIndex;
}
}
private void dataGridView1_CellValuePushed(object sender,
DataGridViewCellValueEventArgs e)
{
store.Add(e.RowIndex, int.Parse(e.Value.ToString()));
}
#endregion
private Dictionary<int, int> store = new Dictionary<int, int>();