将你的代码稍微修改了一下- TXTextControl.Image []images = new TXTextControl.Image[textControl1.Images.Count];
- textControl1.Images.CopyTo(images,0);
- foreach (TXTextControl.Image curimg in images)
- {
- int aa = this.textControl1.Lines.GetItem(curimg.TextPosition).Number;
- if (aa < 21) // 21下为新内容,21上的所有图片都要去掉
- {
- Bitmap b = new Bitmap(curimg.Size.Width / 15, curimg.Size.Height / 15);
- Graphics g = Graphics.FromImage(b);
- g.FillRectangle(new SolidBrush(Color.White), 0, 0, b.Width, b.Height);
- TXTextControl.Image image = new TXTextControl.Image(b);
- image.Location = curimg.Location;
- image.InsertionMode = curimg.InsertionMode;
- textControl1.Images.Add(image, curimg.TextPosition);
- textControl1.Images.Remove(curimg);
- }
- }
复制代码 |