开发者

.net OpenFileDialog changing the CurrentDirectory

开发者 https://www.devze.com 2022-12-27 03:09 出处:网络
I am using OpenFileDialog. But using it changes the Environment.CurrentDirectory. Using the RestoreDirectory property solves this issue, but I\'m using external dlls that I can\'t control that don\'t

I am using OpenFileDialog. But using it changes the Environment.CurrentDirectory. Using the RestoreDirectory property solves this issue, but I'm using external dlls that I can't control that don't use RestoreDirectory.

Is there a way t开发者_如何学Co make it true as default? Or is there any other solution to this annoying problem?

Thanks.


Saving the current path and restoring it after the dialog has been shown would do the trick imo:

var currentDir = Environment.CurrentDirectory;

// Show File open dialog etc ...

Environment.CurrentDirectory = currentDir;
0

精彩评论

暂无评论...
验证码 换一张
取 消