VirtualMode已经设为true,列为自动生成列,为什么datagridview的CellValueNeeded事件不能触发???
解决方案 »
- .net基础 笔试题(全解完整答案)
- FlexGrid双击选中单元格全部文字的问题
- C# TreeView怎么做成工具栏的效果呀?
- .net登陆问题
- JavaScrpt调用带参数的C#后台函数,传参问题
- select * from A,B,从这两个表中选择的记录集DataSet,如何访问和使用记录集DataSet中的记录和字段?
- 关于取缩略内容时存在图片而无法取到的问题?没分了以后补吧!!!
- listbox删除对象,调用invoke出现异常NullReferenceException
- vs2005团队版项目创建问题..急急急!
- 如何将服务器数据库的内容读取并存储到本地文件中?急!!!
- [下载]新生命反向代理V1.0.2007.1203(带源码)
- c#怎样动态创建二维数组??
当 DataGridView 控件的 VirtualMode 属性为 true
并且 DataGridView 只有在单元格中有值的情况下才格式化和显示单元格时。
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>();==================================================================
博客空间:http://blog.csdn.net/lovingkiss
资源下载:http://download.csdn.net/user/lovingkiss
Email:loving-kiss@163.com
联系方式:Q66840199 全天在线
==================================================================
但为什么datagridview的CellValueNeeded事件不能触发?
但为什么datagridview的CellValueNeeded事件不能触发?