我试图加载一个RTF文件的内容,该文件放在资源内(通过Project->Properties->Resources->Add File
)。将资源中的RTF文件加载到WPF应用程序中的RichTextBox
我想加载Agreement.rtf
的内容为RichTextBox
,我已经试过如下:
Dim stream As Stream
stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(My.Resources.ResourceManager.GetObject("Agreement").GetType(), "IOpzioni.Agreement.rtf")
RichTextBox1.SelectAll()
RichTextBox1.Selection.Load(stream, DataFormats.Rtf)
也
stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(My.Resources.Agreement.GetType(), "IOpzioni.Agreement.rtf")
IOpzioni
是我的默认命名空间(我有双重检查这一点)。
似乎没有任何工作。什么是正确的方法来做到这一点?