开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 2764|回复: 0

Dev richTextEdit 插入图片问题?

[复制链接]

0

精华

-4

贡献

0

赞扬

帖子
22
软币
133
在线时间
5 小时
注册时间
2015-12-15
发表于 2016-1-14 20:38:27 | 显示全部楼层 |阅读模式
我在richTextEdit中插入图片,能显示,但是当我在插入图片后,再插入一段字符串,图片就消失了。

这是我的代码 :
            richEditControl1.Text += testNum.ToString() + "." + dt.Rows[0]["question"].ToString();
            string file = dt.Rows[0]["picture"].ToString();
            if (File.Exists(file))
            {
                try
                {
                    RichEditControl control = this.richEditControl1;
                         //插入图片
                    control.Document.InsertImage(control.Document.CreatePosition(richEditControl1.Text.IndexOf(dt.Rows[0]["question"].ToString()) + dt.Rows[0]["question"].ToString().Length), Image.FromFile(file));
                }
                catch
                {
                }
                richEditControl1.Text +="\r\n"+ dt.Rows[0]["information"].ToString();
            }
file:///C:\Users\ChenGang\AppData\Roaming\Tencent\Users\975868494\QQ\WinTemp\RichOle\JUPS~VJIH18_)P16XDNMWL4.png

没有插入文字的时候有图片

没有插入文字的时候有图片

在图片后面插入文字,图片就消失了?

在图片后面插入文字,图片就消失了?
回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-6-16 15:00

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表