當前位置:成語大全網 - 書法字典 - Wpf後臺訪問資源字典

Wpf後臺訪問資源字典

我測試的以下代碼是成功的:

私人?作廢?Button_Click(對象?發件人?RoutedEventArgs?e)

{

字符串?rtfFileName?=?@ " D:\ test . rtf ";

load TFR(this . rich textbox 1,?rtf filename);

}

私人?作廢?LoadTFR(RichTextBox?rtb,?字符串?rtf文件名)

{

TextRange?textRange

FileStream?fs;

textRange?=?新的?文本範圍(rtb。Document.ContentStart,?rtb。document . content end);

使用?(fs?=?新的?FileStream(rtfFileName,系統。IO.FileMode.OpenOrCreate))

{

文本範圍。負載(fs,?數據格式。rtf);

}

}