回复 1楼ninja_aya的帖子
移除 Section 的方法如下,删除特定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 = "";
- }
- }
复制代码 |