我試圖加載一個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
是我的默認命名空間(我有雙重檢查這一點)。
似乎沒有任何工作。什麼是正確的方法來做到這一點?