//打开指定文件 private void buttonFile_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); //指定打开.shader文件 dialog.Filter = "Shader文件(*.shader)|*.shader"; dialog.ValidateNames = true; dialog.CheckPathExists = true; dialog.CheckFileExists = true; if (dialog.ShowDialog() == DialogResult.OK) { filePathSave = dialog.FileName; //其他代码 passClass = new PassClass(filePathSave); checkBoxShadow.Enabled = true; checkBoxFog.Enabled = true; textBox.Text = passClass.getResultCodeStr(); checkBoxShadow.Checked = passClass.judgeHaveShadowCaster(); checkBoxFog.Checked = passClass.judgeHaveFogEffect(); } }