回复 3楼ninja_aya的帖子
请尝试通过以下代码移除 Section:
- private void RemoveAllSections()
- {
- TXTextControl.SectionCollection.SectionEnumerator sectionEnum = textControl1.Sections.GetEnumerator();
- int sectionCounter = textControl1.Sections.Count;
-
- sectionEnum.Reset();
- sectionEnum.MoveNext();
- for (int i = 0; i < sectionCounter; i++)
- {
- TXTextControl.Section curSection = (TXTextControl.Section)sectionEnum.Current;
-
- if (curSection.Number == 1)
- {
- sectionEnum.MoveNext();
- continue;
- }
-
- textControl1.Selection.Start = curSection.Start - 2;
- textControl1.Selection.Length = 1;
- textControl1.Selection.Text = "";
- }
- }
复制代码 |