/// <summary> /// 打开一个文件并展示在codeEditor中 /// </summary> public void OpenFile(string fileName) { string fileFullPath = folderController.GetChildFullPath(fileName); this.Text = fileFullPath; mFileinfo = new FileInfo(fileFullPath); codeEditor.Text = File.ReadAllText(fileFullPath, Encoding.Default); codeEditor.Refresh(); //如果不刷新,可能会导致旧文本没有擦干净 //textEditor.Text = FormatCode(textEditor.Text); //格式化代码 }