//打开文件 private void openFile() { Console.WriteLine("打开文件"); //获取已打开文件的字节数组 byte[] arr = FileUtil.readFile(filePath); //解码成字符串 string text = CoreUtil.decode(arr); //在显示文本之前,调整warning限制字符数 while (warning < text.Length) { warning *= 2; } //显示文本 textArea.Text = text; textArea.SelectionLength = 0; textArea.SelectionStart = 0; //由于文本区域有改动,需要消掉标题的“*”和状态栏的“未保存” if (this.Text[0] == '*') { this.Text = this.Text.Substring(1, this.Text.Length - 1); } ////已经改动置为false modified = false; statusLabelStatus.Text = "已保存"; //改变标题 this.Text = Path.GetFileName(filePath) + " - " + Program.APP_NAME; }