如何在DataGridView动态加载自定义控件 我需要在DataGridView的同一列中,显示文本框或自定义控件.我如何通过我的逻辑判断后动态的加载文本框和自定义控件到DataGridView的同一列中呢谢谢啦. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 图片地址 http://hi.baidu.com/zj_zwl/album/item/d33756177773126c4890a74f.html private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (dataGridView1.CurrentCell.ColumnIndex == 1 && dataGridView1.CurrentCell.RowIndex != -1) //控制要处理的列 { if(你的逻辑判断1) { TextBox textBox=new TextBox (); textBox.Location=e.Control.Location; textBox.TextChanged += new EventHandler(textBox_TextChanged); //订阅事件 } if(你的逻辑判断2) { UserControl ctrl=new UserControl (); ctrl.Location=e.Control.Location; 。。;//加入订阅自定义控件的事件 } } } void textBox_TextChanged(object sender, EventArgs e) { .............;//事件处理 } 其实我要实现的效果如同:http://b211.photo.store.qq.com/psu?/98c9b9ec-ee7e-4580-9be6-d8c22343916d/xuDSKNjNvvWwFSvICP4uNMQQ.ao1MZwNqcL7KMJD.Wk!/b/YYbQ0X2hawAAYuBe030zawAA 楼主,这个问题需要自定义列来解决,下面的文章写的不错:http://hi.baidu.com/suralauto/blog/item/ef9eef89ef5feea30f244416.htmlhttp://blog.csdn.net/hulihui/article/details/3374134 将下面java代码转化为c# web程序中给客户端一个提示 spring.net 继承类注入的问题 假如我把字符串(AAA)以Image的数据类型存入道SQL数据库中,再从数据库中读出该字符串(AAA),把该字符串(AAA)添加到ComboBox控件的It c#的问题. 关于控件的安全?求助 学习C#有一段时间了,小弟有两件事不明白,求教。 版主们来帮我看看关于全局变量重复声明的问题 一般的登陆窗口如何防止alt+f4关闭?? 紧急求救:有关statusbar 整数存储在.net中的方式称为2的补位?? 位移是什么东西呀,怎么用呀
{
if (dataGridView1.CurrentCell.ColumnIndex == 1 && dataGridView1.CurrentCell.RowIndex != -1) //控制要处理的列
{
if(你的逻辑判断1)
{
TextBox textBox=new TextBox ();
textBox.Location=e.Control.Location;
textBox.TextChanged += new EventHandler(textBox_TextChanged); //订阅事件
}
if(你的逻辑判断2)
{
UserControl ctrl=new UserControl ();
ctrl.Location=e.Control.Location;
。。;//加入订阅自定义控件的事件
}
}
}
void textBox_TextChanged(object sender, EventArgs e)
{
.............;//事件处理
}
http://b211.photo.store.qq.com/psu?/98c9b9ec-ee7e-4580-9be6-d8c22343916d/xuDSKNjNvvWwFSvICP4uNMQQ.ao1MZwNqcL7KMJD.Wk!/b/YYbQ0X2hawAAYuBe030zawAA