⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codeeditor.cs

📁 通过数据库结构自动 生成三层结构代码,相当不错的一款软件
💻 CS
字号:
namespace Codematic
{
    using LTP.TextEditor;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.IO;
    using System.Text;
    using System.Windows.Forms;

    public class CodeEditor : Form
    {
        private IContainer components;
        public TextEditorControl txtContent;

        public CodeEditor()
        {
            this.InitializeComponent();
        }

        public CodeEditor(string tempFile, string FileType)
        {
            this.InitializeComponent();
            switch (FileType)
            {
                case "cs":
                    this.txtContent.Language = TextEditorControlBase.Languages.CSHARP;
                    break;

                case "vb":
                    this.txtContent.Language = TextEditorControlBase.Languages.VBNET;
                    break;

                case "html":
                    this.txtContent.Language = TextEditorControlBase.Languages.HTML;
                    break;

                case "sql":
                    this.txtContent.Language = TextEditorControlBase.Languages.SQL;
                    break;

                case "cpp":
                    this.txtContent.Language = TextEditorControlBase.Languages.CPP;
                    break;

                case "js":
                    this.txtContent.Language = TextEditorControlBase.Languages.JavaScript;
                    break;

                case "java":
                    this.txtContent.Language = TextEditorControlBase.Languages.Java;
                    break;

                case "xml":
                    this.txtContent.Language = TextEditorControlBase.Languages.XML;
                    break;

                case "txt":
                    this.txtContent.Language = TextEditorControlBase.Languages.XML;
                    break;
            }
            StreamReader reader = new StreamReader(tempFile, Encoding.Default);
            string str = reader.ReadToEnd();
            reader.Close();
            this.txtContent.Text = str;
        }

        public CodeEditor(string strCode, string FileType, string temp)
        {
            this.InitializeComponent();
            switch (FileType)
            {
                case "cs":
                    this.txtContent.Language = TextEditorControlBase.Languages.CSHARP;
                    break;

                case "vb":
                    this.txtContent.Language = TextEditorControlBase.Languages.VBNET;
                    break;

                case "html":
                    this.txtContent.Language = TextEditorControlBase.Languages.HTML;
                    break;

                case "sql":
                    this.txtContent.Language = TextEditorControlBase.Languages.SQL;
                    break;

                case "cpp":
                    this.txtContent.Language = TextEditorControlBase.Languages.CPP;
                    break;

                case "js":
                    this.txtContent.Language = TextEditorControlBase.Languages.JavaScript;
                    break;

                case "java":
                    this.txtContent.Language = TextEditorControlBase.Languages.Java;
                    break;

                case "xml":
                    this.txtContent.Language = TextEditorControlBase.Languages.XML;
                    break;

                case "txt":
                    this.txtContent.Language = TextEditorControlBase.Languages.XML;
                    break;
            }
            this.txtContent.Text = strCode;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.txtContent = new TextEditorControl();
            base.SuspendLayout();
            this.txtContent.Dock = DockStyle.Fill;
            this.txtContent.Location = new Point(0, 0);
            this.txtContent.Name = "txtContent";
            this.txtContent.Size = new Size(0x170, 0x178);
            this.txtContent.TabIndex = 0;
            this.txtContent.Text = "";
            this.txtContent.IsIconBarVisible = false;
            this.txtContent.ShowInvalidLines = false;
            this.txtContent.ShowSpaces = false;
            this.txtContent.ShowTabs = false;
            this.txtContent.ShowEOLMarkers = false;
            this.txtContent.ShowVRuler = false;
            this.txtContent.Language = TextEditorControlBase.Languages.CSHARP;
            this.txtContent.Encoding = Encoding.Default;
            this.txtContent.Font = new Font("新宋体", 9f);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x170, 0x178);
            base.Controls.Add(this.txtContent);
            base.Name = "CodeEditor";
            this.Text = "CodeEditor";
            base.ResumeLayout(false);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -