Tag: fctb

如何在fastcoloredtextbox中保存文件?

我正在使用C#开发语法编辑器,您可以在FastColoredTextBox组件中编写代码,然后将其保存为.html文件。 但是,我有“ Save As选项的代码。 我遇到的唯一问题是当用户保存.html文件时,会弹出相同的“ Save As对话框。 但我们之前已经保存过了。 我想只需按下键盘上的Ctrl+S ,它会在保存为.html文件后自动保存文件更改。 这是我为“ Save As选项提供的代码。 private void toolStripButton2_Click(object sender, EventArgs e) { SaveFileDialog sfd = default(SaveFileDialog); if (FastColoredTextBox1.Text.Length > 0) { sfd = new SaveFileDialog(); sfd.Filter = “HTML Files|.html|” + “All Files|*.*”; sfd.DefaultExt = “html”; sfd.ShowDialog(); string location = null; string sourcecode = FastColoredTextBox1.Text; location = sfd.FileName; […]