RichTextBox的ReadOnly内容不显示图像 [英] ReadOnly content of RichTextBox doesn't show images

查看:86
本文介绍了RichTextBox的ReadOnly内容不显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了 RichTextBox 的一些奇怪行为.我希望它是 readonly ,但是当我使用它时它不显示图像 richTextBox.LoadFile(path)方法来加载 .rtf 文件.当它不是 readonly 时,将正确加载文件并显示图像.我正在使用Windows窗体.

I've come across some strange behavior of RichTextBox. I want it to be readonly, but then it doesn't display images when I use richTextBox.LoadFile(path) method to load .rtf file. When it's not readonly the file is loaded correctly and the images are displayed. I am using Windows Forms.

我可以以某种方式弥补它,还是另一个 RTB 错误?现在,作为一种解决方法,我正在使用一个标签将焦点移到它上,而我的 RTB 却获得了焦点,但是我真的不喜欢这个.

Can I make it up somehow or is it another RTB bug? For now, as a workaround I am using a label to move focus to it while my RTB got focus, but I don't really like this one.

推荐答案

您可以使用一种方法来创建自定义RichTextBox实现,该方法用于设置捕获readonlystate的RTF内容,将richtextbox设置为ReadOnly = false,设置RTF内容,然后将ReadOnly设置为原来是.

you can create a custom RichTextBox implementation with a method to set RTF content which captures readonlystate, set the richtextbox to ReadOnly = false, set RTF content then set ReadOnly as it originally was.

这篇关于RichTextBox的ReadOnly内容不显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆