Another issue I have:
TableNode.ResizeToFitText doesn't seem to be a recorded action. If I resize the node manually, it's fine, but with that method it's not.
I'm not totally sure this is the cause of a problem I have, so I will describe it:
I have the following code that adds a cell to a table node:
// Count the number of items in that column
int count = 0;
for (int i = 0; i < tableNode.RowCount; i++)
{
TableNode.Cell cell = tableNode[column, i];
if (cell != null && cell.Text != null && cell.Text != string.Empty)
count++;
}
ChangeItemCmd changeItem = new ChangeItemCmd(tableNode, "Add " + text);
// Add row if necessary
if ((count + 1) >= tableNode.RowCount)
tableNode.RowCount++;
// Add anchor point
AnchorPoint anchorPoint = GetAnchorPoint(column);
if (anchorPoint == null)
return;
if (tableNode.Rows[count].AnchorPattern == null)
tableNode.Rows[count].AnchorPattern = new AnchorPattern();
AnchorPattern anchorPattern = tableNode.Rows[count].AnchorPattern;
anchorPattern.Points.Add((AnchorPoint)anchorPoint.Clone());
// Set text & alignment
int number = count + 1;
tableNode[column, count].Text = text + " " + number;
if (column == OUT_COLUMN)
tableNode[column, count].TextFormat.Alignment = StringAlignment.Far;
tableNode.ResizeToFitText(false, true);
changeItem.Execute();
Everything's fine, except that if I undo the change, my shapeNode button is painted outside the table's borders. That shapenode is attached to the bottom-right corner of the tablenode. After undo, it gets painted at the same position it used to be before the undoing of the cell's addition (outside the table's boundaries since it got smaller). This of course happens only in the case that the cell is added on a new row.
How can I fix those 2 problems (painting of the shapenode + resizeToFixText that is not recorded)?
Thank you,
Marie