为什么 OpenFileDialog 会更改我的工作目录?我应该假设 System.Windows.Forms 中的许多函数会更改我的工作目录吗?
OpenFileDialog open = new OpenFileDialog();
open.Filter = filter;
a = Directory.GetCurrentDirectory(); //<-- correct
if (open.ShowDialog() == DialogResult.OK) //-- select a file on my desktop
{
a = Directory.GetCurrentDirectory(); //<-- incorrect, is set to my desktop
或者你可以让它不这样做。请参阅文件对话框.恢复目录 http://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.restoredirectory.aspx财产。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)