我想將文件加載到窗口froms(vs 2010)richTextBox中,但只加載文件的第一行。我使用的是:將RTF文件加載到窗口richTextBox時出現問題
// Create an OpenFileDialog to request a file to open.
OpenFileDialog openFile1 = new OpenFileDialog();
// Initialize the OpenFileDialog to look for RTF files.
openFile1.DefaultExt = "*.rtf";
openFile1.Filter = "RTF Files|*.rtf";
// Determine whether the user selected a file from the OpenFileDialog.
if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Load the contents of the file into the RichTextBox.
rtbTest.LoadFile(openFile1.FileName, RichTextBoxStreamType.PlainText);
}
我用字或墊創建的RTF文件嘗試,並試圖保存的.cs文件作爲的.rtf沒有任何成功。
請任何幫助表示讚賞。
使用*真正* RTF文件。使用寫字板或Microsoft Word創建一個。 – 2010-05-01 17:13:05
我嘗試過沒有快樂。 – Ted 2010-05-01 17:35:14
運氣好嗎?我一直想知道你是否想過這個問題。 – 2010-05-04 08:53:10