• DataGrid行单元格合并显示


    //绑定数据集
            public void BindGrid()
            
    {
                DataSet ds 
    = new DataSet();
                sqlDataAdapter2.Fill(ds);
                DataGrid2.DataSource 
    = ds.Tables[0];
                DataGrid2.DataBind();
                
    //合并相同的单元格
                string strTemp;
                
    int intSpan = 0;
                
    int nowSpan = 0;

                
    int i, j;
                
    for(i = 0; i < DataGrid2.Items.Count; i++)
                
    {
                    intSpan 
    = 1;
                    strTemp 
    = DataGrid2.Items[i].Cells[0].Text;

                    
    //DataGrid2.Items[i].BackColor = Color.SkyBlue;
                    for(j = i + 1; j< DataGrid2.Items.Count; j++)
                    
    {
                        
    if(String.Compare(strTemp,DataGrid2.Items[j].Cells[0].Text)==0)
                        
    {
                            intSpan 
    = intSpan + 1;
                            DataGrid2.Items[i].Cells[
    0].RowSpan = intSpan;
                            
    //DataGrid2.Items[i].Cells[1].RowSpan = intSpan;
                            
    //DataGrid2.Items[i].Cells[2].RowSpan = intSpan;
                            DataGrid2.Items[i].Cells[3].RowSpan = intSpan;

                            
    //DataGrid2.Items[j].BackColor = Color.SkyBlue;

                            DataGrid2.Items[j].Cells[
    0].Visible = false;
                            
    //DataGrid2.Items[j].Cells[1].Visible = false;
                            
    //DataGrid2.Items[j].Cells[2].Visible = false;
                            DataGrid2.Items[j].Cells[3].Visible = false;

                        }

                    }

                    
                    nowSpan 
    += intSpan;
                    i 
    = nowSpan - 1;

                }


            }
  • 相关阅读:
    转(Java中的递归思想)
    stuff thing object 区别
    论文阅读笔记ECCV 2018: Factorizable net: an efficient subgraphbased framework for scene graph generation
    论文阅读笔记Adversarial Learning with Mask Reconstruction for TextGuidedImage Inpainting
    论文阅读笔记Image Generation from Scene Graphs
    评价gan好坏的指标:IS和FID
    深度学习——正则化(L1\L2)(还没搞明白
    Adam
    L1 L2 SmoothL1损失函数
    ground truth
  • 原文地址:https://www.cnblogs.com/adam/p/1023055.html
Copyright © 2020-2023  润新知