当前位置: 首页>>代码示例>>C#>>正文


C# TableCell.ApplyStyle方法代码示例

本文整理汇总了C#中TableCell.ApplyStyle方法的典型用法代码示例。如果您正苦于以下问题:C# TableCell.ApplyStyle方法的具体用法?C# TableCell.ApplyStyle怎么用?C# TableCell.ApplyStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TableCell的用法示例。


在下文中一共展示了TableCell.ApplyStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertGridRow

    /// <summary>
    /// Inserts a grid row. Only cells required for the summary results
    /// will be created (except if GenerateAllCellsOnSummaryRow is true).
    /// The group will be checked for columns with summary
    /// </summary>
    /// <param name="beforeRow"></param>
    /// <param name="g"></param>
    /// <returns></returns>
    private GridViewRow InsertGridRow(GridViewRow beforeRow, GridViewGroup g)
    {
        int colspan;
        TableCell cell;
        TableCell[] tcArray;
        int visibleColumns = this.GetVisibleColumnCount();

        Table tbl = (Table)mGrid.Controls[0];
        int newRowIndex = tbl.Rows.GetRowIndex(beforeRow);
        GridViewRow newRow = new GridViewRow(newRowIndex, newRowIndex, DataControlRowType.DataRow, DataControlRowState.Normal);

        if ( g != null && ( g.IsSuppressGroup || g.GenerateAllCellsOnSummaryRow ) )
        {
            // Create all the table cells
            tcArray = new TableCell[visibleColumns];
            for (int i = 0; i < visibleColumns; i++)
            {
                cell = new TableCell();
                cell.ApplyStyle(mGrid.Columns[GetRealIndexFromVisibleColumnIndex(i)].ItemStyle);
                cell.Text = "&nbsp;";
                tcArray[i] = cell;
            }
        }
        else
        {
            // Create only the required table cells
            colspan = 0;
            List<TableCell> tcc = new List<TableCell>();
            for (int i = 0; i < mGrid.Columns.Count; i++)
            {
                if (ColumnHasSummary(i, g))
                {
                    if (colspan > 0)
                    {
                        cell = new TableCell();
                        cell.Text = "&nbsp;";
                        cell.ColumnSpan = colspan;
                        tcc.Add(cell);
                        colspan = 0;
                    }

                    // insert table cell and copy the style
                    cell = new TableCell();
                    cell.ApplyStyle(mGrid.Columns[i].ItemStyle);
                    tcc.Add(cell);
                }
                else if (mGrid.Columns[i].Visible)
                {
                    // A visible column that will have no cell because has
                    // no summary. So we increase the colspan...
                    colspan++;
                }
            }

            if (colspan > 0)
            {
                cell = new TableCell();
                cell.Text = "&nbsp;";
                cell.ColumnSpan = colspan;
                tcc.Add(cell);
                colspan = 0;
            }

            tcArray = new TableCell[tcc.Count];
            tcc.CopyTo(tcArray);
        }

        newRow.Cells.AddRange(tcArray);
        tbl.Controls.AddAt(newRowIndex, newRow);

        return newRow;
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:80,代码来源:GridViewHelper.cs


注:本文中的TableCell.ApplyStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。