当前exe文件执行的路径,这样可以固定访问该路径下的文件,不会受openfiledialog的影响;
string exepath = Assembly.GetExecutingAssembly().Location.ToString();
string txtpath = Path.Combine(Path.GetDirectoryFileName(exepath),"1.txt");
textBox1.text = File.ReadAllText(txtpath,Encoding.default);
注*:Application .StartupPath 获取的是精确到bin的路径