gpt4 book ai didi

c# - AutoCAD 表格中的字体非常小

转载 作者:太空宇宙 更新时间:2023-11-03 13:15:30 24 4
gpt4 key购买 nike

我正在尝试制作一个表格,当用户提交更多数据时动态添加行:

public void addRow(String[] data)
{
Transaction tr = doc.TransactionManager.StartTransaction();
DocumentLock docLock = doc.LockDocument();
using (tr)
using (docLock)
{
if (!IsWriteEnabled || !IsReadEnabled) //Committing transactions closes everything for reading and writing so it must be reopened
{
tr.GetObject(this.ObjectId, OpenMode.ForRead);
tr.GetObject(this.ObjectId, OpenMode.ForWrite);
}
if (!data[0].Equals("Mark")) //If the data being added is not the titles of the columns
{
SetSize(NumRows + 1, NumColumns);
}

BlockTable bt = (BlockTable)tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.ModelSpace], OpenMode.ForWrite);
selectedRow = NumRows - 1; //Sets the lowest empty row as the one to be modified
//Adding data to each cell
for (int i = 0; i < data.Length; i++)
{
Cells[selectedRow, i].SetValue(data[i], ParseOption.SetDefaultFormat);
}
GenerateLayout();
//Attempting to add table into drawing. If table already exists and is just being updated the catch statement will realize this and move on
try
{
btr.AppendEntity(this);
tr.AddNewlyCreatedDBObject(this, true);
}
catch (Autodesk.AutoCAD.Runtime.Exception e)
{
SetRowHeight(3); //Sets height of new row
SetColumnWidth(8); //Sets width of new columns
Cells.TextHeight = 1; //Sets height of new text
}

tr.Commit(); //Updating table
}
}

然而,最终发生的事情是,在创建表格时添加的列的标题格式正确(居中对齐,字体大小合适),但之后添加的所有内容的字体大小都非常小。如何使添加的每个条目的字体大小都相同?

最佳答案

想通了。原来 SetTextHeight 的第二个参数很重要。数字 1-7 根据行类型设置不同的单元格。要设置标题、数据和标题类型的行的高度,我需要使用

设置文本高度(1, 7)

关于c# - AutoCAD 表格中的字体非常小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26407545/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com