c# winform中datagridview如何向单元格添加多个按钮 如题,我想规定某列为按钮列,但是可以添加多个按钮,也可以为空...如何实现?注意,是C# winform中的datagridview。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //將非護理問題的button歷史評值屏蔽掉 DataGridViewCell cell = new DataGridViewTextBoxCell(); cell.Style.BackColor = Color.Wheat; //cell.ReadOnly = true; cell.Value = "N"; cell.Style.BackColor = Color.White; dataGridView1.Rows[k].Cells["Column14"] = cell; dataGridView1.Rows[k].Cells["Column14"].Style.ForeColor = Color.White; dataGridView1.Rows[k].Cells["Column14"].Style.SelectionBackColor = Color.White; dataGridView1.Rows[k].Cells["Column14"].Style.SelectionForeColor = Color.White;这个是我经常使用的屏蔽的方法,你试一下吧 就是把某个buttoncell转换成textcell就可以了 @muyebo可能我说得不是很清楚,我要实现的是一个单元格中有多个固定大小的按钮 http://www.tctl.com.cn/accp/1490/1496/114320.html 根据格子的位置往上贴的方法可以实现, timepicker dtpLapseDate = new timepicker(); Rectangle cellrect = dataGridView1.GetCellDisplayRectangle(ColumnIndex, RowIndex, true); dtpLapseDate.Height = cellrect.Height; dtpLapseDate.Width = cellrect.Width; dtpLapseDate.Top = cellrect.Top + dataGridView1.Top; dtpLapseDate.Left = dataGridView1.Left + cellrect.Left; dtpLapseDate.Visible = true; dtpLapseDate.BringToFront();这是添加一个,添加多个也这样,不过麻烦些可能还有更好的办法,你等等看 将列的属性设为Button就可以了 关于字符串的问题!!!急!!! 求 GOOGLE地图轨迹回放思路 socket服务器代码怎么实现自动监听? 求救 手动数据库还原失败 求问各位大侠关于VLC播放器的问题!! IT培训知多少 c#,.net,b/s能不能做出象c/s下的增删改、 水晶报表的问题!!! C#中有没有类似Vb中的optional? 请教一个不太难的问题? 急问???究竟问题出在那里?? 文件txt输入
DataGridViewCell cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.Wheat;
//cell.ReadOnly = true;
cell.Value = "N";
cell.Style.BackColor = Color.White;
dataGridView1.Rows[k].Cells["Column14"] = cell;
dataGridView1.Rows[k].Cells["Column14"].Style.ForeColor = Color.White;
dataGridView1.Rows[k].Cells["Column14"].Style.SelectionBackColor = Color.White;
dataGridView1.Rows[k].Cells["Column14"].Style.SelectionForeColor = Color.White;这个是我经常使用的屏蔽的方法,你试一下吧
可能我说得不是很清楚,我要实现的是一个单元格中有多个固定大小的按钮
timepicker dtpLapseDate = new timepicker();
Rectangle cellrect = dataGridView1.GetCellDisplayRectangle(ColumnIndex, RowIndex, true);
dtpLapseDate.Height = cellrect.Height;
dtpLapseDate.Width = cellrect.Width;
dtpLapseDate.Top = cellrect.Top + dataGridView1.Top;
dtpLapseDate.Left = dataGridView1.Left + cellrect.Left;
dtpLapseDate.Visible = true;
dtpLapseDate.BringToFront();这是添加一个,添加多个也这样,不过麻烦些
可能还有更好的办法,你等等看