有谁可以发一份DataGridview 横向合并单元格示例给我 要可以运行的 DataGridView 横向合并单元格 谢谢[email protected] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://blog.csdn.net/csharp_start/archive/2007/09/30/1808000.aspx 我以前也遇到过lz一样的问题,但是还是处理不好,不能重新 dataRow dr = d.newRow; dr[0]=.... d.rows.add.(dr); 呵呵 这样貌似是不行。还是跟上面的行是一样的列数。但是 除了 指定的两个列, 其他的列的值都是空 的!学习了`~~~~~ #region 合并DataGrid显示竖向合并,改一下i和j的定义就可以 public void SpanDataGrid(DataGrid dataGrid, int compareColumn, int sColumn, int pColumn, string label,bool wrap) { int rowSpan; int i, j; string strTemp; if (dataGrid.Items.Count > 0) { for (int t = sColumn; t < pColumn; t++) { strTemp = ((Label)dataGrid.Items[compareColumn].Cells[0].FindControl("label")).Text; dataGrid.Items[0].Cells[t].RowSpan = 1; j = 0; for (i = 1; i < dataGrid.Items.Count; i++) { if (((Label)dataGrid.Items[i].Cells[compareColumn].FindControl("label")).Text == strTemp) { dataGrid.Items[i].Cells[t].Visible = false; dataGrid.Items[j].Cells[t].RowSpan++; } else { strTemp = ((Label)dataGrid.Items[i].Cells[compareColumn].FindControl("label")).Text; j = i; dataGrid.Items[i].Cells[t].RowSpan = 1; } } }//i = j; } dataGrid.Columns[compareColumn].Visible = wrap; } #endregion 我是要 DataGridView 的合并行 您提供的这个好像不行、 http://download.csdn.net/source/531194 。。 我是要横向合并DataGridView 的 而且是要有代码的 怎么到处找都没有 不是有很多BUG 就是根本找不到 难道都是用第三方控件的吗? Excel2003中能否随机生成一个Guid码? 串口通信如何判断超时???[ 按钮模拟 Ctrl+Shift键 c#制作窗体动画问题 强类型如何控制填充数量 关于ThreadPool的疑问 为什么这样写就不对呢? 字符串转换问题 客户端怎么封装数据库? 谢谢 求解三种以上链接计算 C# 如何判断操作系统当前是否进入锁定状态或者是屏保状态 WPF Ribbon问题
呵呵 这样貌似是不行。还是跟上面的行是一样的列数。但是 除了 指定的两个列, 其他的列的值都是空 的!学习了`~~~~~
#region 合并DataGrid显示竖向合并,改一下i和j的定义就可以
public void SpanDataGrid(DataGrid dataGrid, int compareColumn, int sColumn, int pColumn, string label,bool wrap)
{
int rowSpan;
int i, j;
string strTemp; if (dataGrid.Items.Count > 0)
{
for (int t = sColumn; t < pColumn; t++)
{
strTemp = ((Label)dataGrid.Items[compareColumn].Cells[0].FindControl("label")).Text;
dataGrid.Items[0].Cells[t].RowSpan = 1;
j = 0;
for (i = 1; i < dataGrid.Items.Count; i++)
{
if (((Label)dataGrid.Items[i].Cells[compareColumn].FindControl("label")).Text == strTemp)
{
dataGrid.Items[i].Cells[t].Visible = false;
dataGrid.Items[j].Cells[t].RowSpan++;
}
else
{
strTemp = ((Label)dataGrid.Items[i].Cells[compareColumn].FindControl("label")).Text;
j = i;
dataGrid.Items[i].Cells[t].RowSpan = 1;
}
}
}//i = j;
}
dataGrid.Columns[compareColumn].Visible = wrap;
}
#endregion