简体   繁体   English

RichTextBox的ReadOnly内容不显示图像

[英]ReadOnly content of RichTextBox doesn't show images

I've come across some strange behavior of RichTextBox . 我遇到了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. 我希望它是readonly ,但是当我使用richTextBox.LoadFile(path)方法加载.rtf文件时,它不会显示图像。 When it's not readonly the file is loaded correctly and the images are displayed. 如果不是readonly文件,将正确加载文件并显示图像。 I am using Windows Forms. 我正在使用Windows窗体。

Can I make it up somehow or is it another RTB bug? 我可以以某种方式弥补还是其他RTB错误? 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. 目前,作为一种解决方法,我正在使用一个标签将焦点移到该标签上,而我的RTB却获得了关注,但是我真的不喜欢这种标签。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM