我希望保存 XML 文件的路径,并在程序重新打开时使用 Winforms 上的按钮加载它。我已经环顾了保存状态,但到目前为止似乎没有任何东西可以减少芥末。下面是我的代码 private void Form1_Load(object sender, EventArgs e) { //Loading of the form } private void btnOpen_Click(object sender, EventArgs e) { using (FolderBrowserDialog fbd = new FolderBrowserDialog() { Description="Select your folder"}) { if (fbd.ShowDialog() == DialogResult.OK) webBrowser.Url = new Uri(fbd.SelectedPath); txtPath.Text = fbd.SelectedPath; // Button used to open the folder explorer and display file path in the text box. } } private void btnBack_Click(object sender, EventArgs e) { if (webBrowser.CanGoBack) webBrowser.GoBack(); //Sends the explorer back one page providing there is a page to go back too } private void btnForward_Click(object sender, EventArgs e) { if (webBrowser.CanGoForward) webBrowser.GoForward(); //Sends the explorer forward one page providing there is a page to go forward too } private void btnSave_Click(object sender, EventArgs e) { } private void txtPath_TextChanged(object sender, EventArgs e) { } }
1 回答
- 1 回答
- 0 关注
- 225 浏览
添加回答
举报
0/150
提交
取消