2
는정말 작은 글꼴 나는 사용자가 더 많은 데이터 :를 제출 동적으로 행을 추가하는 테이블을 만들려고
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
}
}
그러나 어떤 일이 끝나는 것은 컬럼의 제목이 때 추가되는 것입니다 테이블이 올바르게 만들어졌지만 (가운데 정렬, 좋은 크기의 글꼴), 이후에 추가 된 모든 것은 실제로 글꼴 크기가 작습니다. 글꼴 크기가 각 항목이 추가 될 때마다 동일하게되도록하려면 어떻게해야합니까?
난 당신이 명시 적으로 행 높이 설정하는 것처럼, 당신이 원하는 서식 글꼴을 설정해야한다고 생각 및 기타 속성. 테이블은 예측할 수 없습니다. 예를 들어, AutoCAD UI에서 작업하는 경우, 행을 삽입하면 색상 및 글꼴 서식이 복사되지만 숫자 서식이 손실됩니다. 그것이 무엇을 할 것인지 확실히 알고 싶다면 명시해라. – Mike