winform中的datagrid里如何假如按钮列???!!! 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 sorry应为:winform中的datagrid里如何假如添加按钮列???!!! 使用DataGridTableStyle ts然后定义一个Button btn定义一个DataGridColumn col将btn添加到col中再将col添加到ts中最后将ts添加到datagrid中OK http://www.codeproject.com/cs/miscctrl/WindowsDataGridColumns.asp 使用DataGridTableStyle 是一定的至于Button btn 我还没有试过不过JoneG() 说的很有道理 需要自己定义DataGridTableStyle,你可以参考以下MSDN上面有相关的示例程序! DataGridTableStyle ts=new DataGridTableStyle();......DataGridTextBoxColumn aColumnTextColumn5=new DataGridTextBoxColumn();Button btn = new Button(); btn.Cursor=Cursors.Arrow; btn.Text="删除"; btn.FlatStyle=System.Windows.Forms.FlatStyle.Standard; btn.Click+=new EventHandler(btn_Click); aColumnTextColumn5.TextBox.Controls.Add(btn);......ts.GridColumnStyles.Add(aColumnTextColumn5); // '增加一种自定义的column风格 dataGrid1.TableStyles.Add(ts);用上面的方法没显示,错在哪里?? aColumnTextColumn5.TextBox.visible = false;btn.BringToFront(); 加了: aColumnTextColumn5.TextBox.visible = false;btn.BringToFront();还是不行,救急!!!!!! 求typeof()把FORM当参数传递 winform项目安装部署出现问题 如何移动指定的windows窗口? 如何用函数返回数组,那么动态的呢? 数据交换急! 怎样知道当前鼠标的坐标. DateTime? 什么意思 treeview树刷新问题 Visual C#加载窗体错误! C#连接SqlServer时链接出错 编写smtp程序,设置邮件服务器问题 快速用户切换系统消息
应为:winform中的datagrid里如何假如添加按钮列???!!!
然后定义一个Button btn
定义一个DataGridColumn col
将btn添加到col中
再将col添加到ts中
最后将ts添加到datagrid中
OK
Button btn 我还没有试过
不过JoneG() 说的很有道理
......
DataGridTextBoxColumn aColumnTextColumn5=new DataGridTextBoxColumn();
Button btn = new Button();
btn.Cursor=Cursors.Arrow;
btn.Text="删除";
btn.FlatStyle=System.Windows.Forms.FlatStyle.Standard;
btn.Click+=new EventHandler(btn_Click);
aColumnTextColumn5.TextBox.Controls.Add(btn);......
ts.GridColumnStyles.Add(aColumnTextColumn5); // '增加一种自定义的column风格
dataGrid1.TableStyles.Add(ts);用上面的方法没显示,错在哪里??
btn.BringToFront();
aColumnTextColumn5.TextBox.visible = false;
btn.BringToFront();
还是不行,救急!!!!!!