public void AppendRichText(string textContent, SortedArray <int, uint> imagePosition_imageID, Dictionary <int, Bitmap> foreignObjectAry, Font font, Color color) { int length = this.Text.Length; if (imagePosition_imageID != null) { int index; string text = textContent; List <int> allKeyList = imagePosition_imageID.GetAllKeyList(); List <int> list2 = new List <int>(); list2.AddRange(allKeyList); foreach (int num2 in foreignObjectAry.Keys) { list2.Add(num2); } list2.Sort(); for (index = list2.Count - 1; index >= 0; index--) { text = text.Remove(list2[index], 1); } base.AppendText(text); for (index = 0; index < list2.Count; index++) { int item = list2[index]; if (allKeyList.Contains(item)) { this.InsertImage(imagePosition_imageID[item], length + item); } else { this.InsertImage(foreignObjectAry[item], length + item); } } } else { base.AppendText(textContent); } base.Select(length, textContent.Length); base.SelectionColor = color; if (font != null) { base.SelectionFont = font; } }
public SortedArray <int, uint> GetAllImage(out bool containsForeignObject) { containsForeignObject = false; SortedArray <int, uint> array = new SortedArray <int, uint>(); List <REOBJECT> allREOBJECT = this.RichEditOle.GetAllREOBJECT(); for (int i = 0; i < allREOBJECT.Count; i++) { if (allREOBJECT[i].dwUser != 0) { array.Add(allREOBJECT[i].posistion, allREOBJECT[i].dwUser); } else { containsForeignObject = true; } } return(array); }