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


C# Table.SetRowHeight方法代码示例

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


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

示例1: DrawCoordTable

        public void DrawCoordTable(Dictionary<DBText, DBPoint> vertexCoords)
        {
            const int nrColoane = 3;
            int nrRanduri = vertexCoords.Count+2;
            bool isLayerExist = false;
            ObjectId obTs = ObjectId.Null;
            Color layerColor = Color.FromColorIndex(ColorMethod.ByAci, 7);
            isLayerExist = LayerHelper.CreateLayer(m_doc, "tabelInventar", layerColor);
            TextHelper.CreateTextStyle(m_doc, "Arial", "arial.shx");
            CreateTableStyle("Inventar", "Arial", LineWeight.LineWeight018, out obTs);

            PromptPointResult insertionPoint = m_doc.Editor.GetPoint("\nSelecteaza punctul de insertie al tabelului");
            if (insertionPoint.Status == PromptStatus.OK)
            {

                Table invTable = new Table();
                if (isLayerExist)
                    invTable.Layer = "tabelInventar";

                if (obTs == ObjectId.Null)
                    invTable.TableStyle = m_db.Tablestyle;
                else
                    invTable.TableStyle = obTs;
                invTable.NumColumns = nrColoane;
                invTable.NumRows = nrRanduri;
                invTable.SetColumnWidth(0, 3);
                invTable.SetColumnWidth(1, 8);
                invTable.SetColumnWidth(2, 8);
                invTable.SetRowHeight(0, 0.9);
                invTable.SetRowHeight(1, 0.9);
                invTable.Position = insertionPoint.Value;

                /*********** Tabel Title **************/
                invTable.SetTextHeight(0, 0, 0.755);
                invTable.SetTextString(0, 0, "Inventar de coordonate");
                invTable.SetAlignment(0, 0, CellAlignment.MiddleCenter);

                /*********** Table Header *************/
                string[] header = { "Nr.\ncrt.", "X[m]", "Y[m]" };
                for (int i = 0; i < nrColoane; i++)
                {
                    invTable.SetTextHeight(1, i, 0.7);
                    invTable.SetTextString(1, i, header[i].ToString());
                    invTable.SetAlignment(1, i, CellAlignment.MiddleCenter);
                }
                int contor = 2;
                foreach (var entry in vertexCoords)
                {

                    invTable.SetRowHeight(contor, 0.8);

                    invTable.SetTextHeight(contor, 0, 0.8);
                    invTable.SetTextHeight(contor, 1, 0.8);
                    invTable.SetTextHeight(contor, 2, 0.8);

                    invTable.SetTextString(contor, 0, (contor-1).ToString());
                    invTable.SetTextString(contor, 1, entry.Value.Position.Y.ToString("#.###"));
                    invTable.SetTextString(contor, 2, entry.Value.Position.X.ToString("#.###"));

                    invTable.SetAlignment(contor, 0, CellAlignment.MiddleCenter);
                    invTable.SetAlignment(contor, 1, CellAlignment.MiddleCenter);
                    invTable.SetAlignment(contor, 2, CellAlignment.MiddleCenter);
                    contor++;
                }

                using (Transaction tran = m_db.TransactionManager.StartTransaction())
                {
                    BlockTable blkTb = tran.GetObject(m_db.BlockTableId, OpenMode.ForRead) as BlockTable;
                    BlockTableRecord blkTbRec = tran.GetObject(blkTb[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                    blkTbRec.AppendEntity(invTable);
                    tran.AddNewlyCreatedDBObject(invTable, true);

                    tran.Commit();
                }
                using (Transaction tran = m_db.TransactionManager.StartTransaction())
                {
                    ObjectId tableID = invTable.ObjectId;
                    DBObjectCollection entitySet = new DBObjectCollection();
                    invTable.Explode(entitySet);

                    BlockTableRecord table = (BlockTableRecord)tran.GetObject(m_db.CurrentSpaceId, OpenMode.ForWrite);
                    foreach (DBObject obj in entitySet)
                    {
                        if (obj is Entity)
                        {
                            table.AppendEntity((Entity)obj);
                            tran.AddNewlyCreatedDBObject(obj, true);
                        }
                    }
                    tran.Commit();
                }

                using (Transaction tran = m_db.TransactionManager.StartTransaction())
                {
                    //BlockTable bTB = tran.GetObject(invTable.ObjectId, OpenMode.ForRead) as BlockTable;
                    BlockTableRecord bTBR = tran.GetObject(invTable.ObjectId, OpenMode.ForWrite) as BlockTableRecord;
                    invTable.Erase();
                    //bTBR.Erase(true);
                    tran.Commit();
                }
//.........这里部分代码省略.........
开发者ID:cosmintaran,项目名称:CosminRepo,代码行数:101,代码来源:TableHelper.cs

示例2: getTable

        private Table getTable()
        {
            Table table = new Table();
            table.SetDatabaseDefaults(db);
            table.TableStyle = db.GetTableStylePIK(true); // если нет стиля ПИк в этом чертеже, то он скопируетс из шаблона, если он найдется
            // Измпнение отступа в стилше ПИК на 1
            UpdateTableStyle(table.TableStyle);

            bool hasTotalRow = (condRows.Count > 1);
            int rows = hasTotalRow ? condRows.Count + 3 : condRows.Count + 2;

            table.SetSize(rows, 5);

            table.SetRowHeight(8);

            // Название таблицы
            var rowTitle = table.Cells[0, 0];
            rowTitle.Alignment = CellAlignment.MiddleCenter;
            rowTitle.TextString = "Спецификация на наружное ограждение блока кондиционера";

            // столбец Марка
            var col = table.Columns[0];
            col.Alignment = CellAlignment.MiddleCenter;
            col.Width = 10;
            // столбец Цвет.
            col = table.Columns[1];
            col.Alignment = CellAlignment.MiddleLeft;
            col.Width = 35;
            // столбец Образец
            col = table.Columns[2];
            col.Alignment = CellAlignment.MiddleCenter;
            col.Width = 20;
            // столбец Кол
            col = table.Columns[3];
            col.Alignment = CellAlignment.MiddleCenter;
            col.Width = 20;
            // столбец Прим
            col = table.Columns[4];
            col.Alignment = CellAlignment.MiddleCenter;
            col.Width = hasTotalRow? 40 : 60;

            // Заголовок Маркв
            var cellColName = table.Cells[1, 0];
            cellColName.TextString = "Марка";
            //cellColName.Alignment = CellAlignment.MiddleCenter;
            // Заголовок Цвет
            cellColName = table.Cells[1, 1];
            cellColName.TextString = "Цвет";
            cellColName.Alignment = CellAlignment.MiddleCenter;
            // Заголовок Образец
            cellColName = table.Cells[1, 2];
            cellColName.TextString = "Образец";
            //cellColName.Alignment = CellAlignment.MiddleCenter;
            // Заголовок Кол
            cellColName = table.Cells[1, 3];
            cellColName.TextString = "Кол-во, шт.";
            //cellColName.Alignment = CellAlignment.MiddleCenter;
            // Заголовок прим
            cellColName = table.Cells[1, 4];
            cellColName.TextString = "Примечание";
            //cellColName.Alignment = CellAlignment.MiddleCenter;

            // Строка заголовков столбцов
            var rowHeaders = table.Rows[1];
            rowHeaders.Height = 15;
            var lwBold = rowHeaders.Borders.Top.LineWeight;
            rowHeaders.Borders.Bottom.LineWeight = lwBold;

            int row = 2;
            foreach (var itemRow in condRows)
            {
                table.Cells[row, 0].TextString = itemRow.Mark.ToString();
                table.Cells[row, 1].TextString = itemRow.ColorName;
                table.Cells[row, 2].BackgroundColor = itemRow.Color;
                table.Cells[row, 3].TextString = itemRow.Count.ToString();
                row++;
            }

            // Объединение итого
            if (hasTotalRow)
            {
                table.MergeCells(CellRange.Create(table, row, 0, row, 2));
                table.Cells[row, 0].TextString = "Итого на фасад";
                table.Cells[row, 3].TextString = condRows.Sum(c => c.Count).ToString();

                // Объединение примечания
                table.MergeCells(CellRange.Create(table, 2, 4, row, 4));
                table.Rows[row].Borders.Top.LineWeight = lwBold;
            }

            table.Cells[2, 4].TextString = "Стальной перфорированный лист, окрашенный порошковой эмалью в цвет по таблице.";

            var lastRow = table.Rows.Last();
            lastRow.Borders.Bottom.LineWeight = lwBold;

            table.GenerateLayout();
            return table;
        }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:98,代码来源:AirCondTable.cs

示例3: DrawSupUtilTabel

        public void DrawSupUtilTabel(List<Incapere> camera, string titluTabel)
        {
            const double inaltimeText = 0.2;
            const int colorIndex = 7; //alb
            const int nrColoane = 3;
            int nrRanduri = camera.Count() + 2;
            bool existLayer = false;
            ObjectId obTs = ObjectId.Null;
            string[] header = { "Nr.\nincapere", "Destinatie incapere", "Supraf.Utila\n [mp]" };
            Color layerColor = Color.FromColorIndex(ColorMethod.ByAci, colorIndex);
            existLayer = LayerHelper.CreateLayer(m_doc, "Plansa", layerColor);
            TextHelper.CreateTextStyle(m_doc, "Arial", "arial.shx");
            CreateTableStyle("Apartamentare", "Arial", LineWeight.LineWeight018,out obTs);
            PromptPointResult insertionPoint = m_doc.Editor.GetPoint("\nSelecteaza punctul de insertie al tabelului");
            if (insertionPoint.Status == PromptStatus.OK)
            {

                Table supTable = new Table();
                if (existLayer)
                    supTable.Layer = "Plansa";

                if (obTs == ObjectId.Null)
                    supTable.TableStyle = m_db.Tablestyle;
                else
                    supTable.TableStyle = obTs;

                supTable.NumColumns = nrColoane;
                supTable.NumRows = nrRanduri;
                supTable.SetColumnWidth(0, 1.92);
                supTable.SetColumnWidth(1, 5.35);
                supTable.SetColumnWidth(2, 3.5);
                supTable.SetRowHeight(0, 0.5);
                supTable.SetRowHeight(1, 0.9);
                supTable.Position = insertionPoint.Value;

                /*********** Tabel Title **************/
                supTable.SetTextHeight(0, 0, inaltimeText+0.05);
                supTable.SetTextString(0, 0, titluTabel);
                supTable.SetAlignment(0, 0, CellAlignment.MiddleCenter);

                /*********** Table Header *************/
                for (int i = 0; i < nrColoane; i++)
                {
                    supTable.SetTextHeight(1, i, 0.22);
                    supTable.SetTextString(1, i, header[i].ToString());
                    supTable.SetAlignment(1, i, CellAlignment.MiddleCenter);
                }

                Incapere[] inc = camera.ToArray();
                for (int i = 0; i < inc.Length; i++)
                {
                    supTable.SetRowHeight(i + 2, 0.35);

                    supTable.SetTextHeight(i+2, 0, 0.2);
                    supTable.SetTextHeight(i+2, 1, 0.2);
                    supTable.SetTextHeight(i+2, 2, 0.2);

                    supTable.SetTextString(i+2, 0, inc[i].NrIncapere.ToString());
                    supTable.SetTextString(i+2, 1, inc[i].DestinatieIncapere.ToString());
                    supTable.SetTextString(i+2, 2, Math.Round(inc[i].SuprafataIncapere,2).ToString());

                    supTable.SetAlignment(i+2, 0, CellAlignment.MiddleCenter);
                    supTable.SetAlignment(i+2, 1, CellAlignment.MiddleCenter);
                    supTable.SetAlignment(i+2, 2, CellAlignment.MiddleCenter);
                }
                supTable.GenerateLayout();

                using (Transaction tran = m_db.TransactionManager.StartTransaction())
                {
                    BlockTable blkTb = tran.GetObject(m_db.BlockTableId, OpenMode.ForRead) as BlockTable;
                    BlockTableRecord blkTbRec = tran.GetObject(blkTb[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                    blkTbRec.AppendEntity(supTable);
                    tran.AddNewlyCreatedDBObject(supTable, true);
                    tran.Commit();
                }

            }
        }
开发者ID:cosmintaran,项目名称:CosminRepo,代码行数:78,代码来源:TableHelper.cs


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