如您所见,我正在读取 XML 文件并更新 RTB。这发生在表单加载期间。问题是换行符没有得到正确处理。RTB 应该显示我的应用程序之前生成的 url,并且由于换行符被忽略,因此 url 会像这样被完全破坏:
http://XXXXXXXXX.com/Roberto/XXXXXXXXX.pdfhttp://xxxxxxxxxx.com/Roberto/xxxxxx.pdf
public Form1()
{
InitializeComponent();
tabControl1.SelectTab("tabPage1");
XmlDocument doc = new XmlDocument();
doc.Load(Path.GetTempPath() + "/Uploads.xml");
XmlNodeList nl = doc.GetElementsByTagName("Uploads");
foreach (XmlNode node in nl)
{
richTextBox1.AppendText(Environment.NewLine + node.InnerText +
Environment.NewLine +"\t");
}
this.listBox1.DragDrop += new DragEventHandler(this.listBox1_DragDrop);
this.listBox1.DragEnter += new DragEventHandler(this.listBox1_DragEnter);
}
XML 文件
<Uploads>
<upload>http://xxxxxxxxxx.com/Roberto/xxxxxxxxx.pdf</upload>
<upload>http://xxxxxxxxxx.com/Roberto/xxxxxxxxx.pdf</upload>
</Uploads>