TextControl.Append(Byte[], BinaryStreamType, AppendSettings),我在调用这个方法追加文档时,将AppendSettings设置成StartWithNewParagraph或者None时,观察TextControl.Lines.Count的数量是不变的,这样就导致我无法设置每个文档的第一页是从那行开始的,以下是个循环给TextControl追加文档代码:
for (int i = 0; i < _lstFileIndex.Count; i++)
{
if (i == 0)
{
_lstFileIndex[i].StartLine = 1;
_lstFileIndex[i].StartPage = 1;
tc_Edit.Load(_lstFileIndex[i].Buffer, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
_lstFileIndex[i].EndLine = tc_Edit.Lines.Count;
_lstFileIndex[i].EndPage = tc_Edit.Pages;
}
else
{
tc_Edit.Append(_lstFileIndex[i].Buffer, TXTextControl.BinaryStreamType.InternalUnicodeFormat, TXTextControl.AppendSettings.StartWithNewParagraph);
_lstFileIndex[i].StartLine = _lstFileIndex[i - 1].EndLine;
_lstFileIndex[i].StartPage = tc_Edit.Lines[_lstFileIndex[i].StartLine].Page;
_lstFileIndex[i].EndLine = tc_Edit.Lines.Count;
_lstFileIndex[i].EndPage = tc_Edit.Pages;
}
}
第一次和第二次循环tc_Edit.Lines.Count值发生改变,第三次就不变了!
|
|