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

📄 uccodeview.cs

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

    public class UcCodeView : UserControl
    {
        private IContainer components;
        private ContextMenuStrip contextMenuStrip1;
        private ToolStripMenuItem menu_Save;
        public TextEditorControl txtContent_CS;
        public TextEditorControl txtContent_SQL;
        public TextEditorControl txtContent_Web;
        private TextEditorControl txtContent_XML;

        public UcCodeView()
        {
            this.InitializeComponent();
            this.SettxtContent("CS", "");
        }

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

        private void InitializeComponent()
        {
            this.components = new Container();
            this.txtContent_Web = new TextEditorControl();
            this.txtContent_CS = new TextEditorControl();
            this.txtContent_SQL = new TextEditorControl();
            this.txtContent_XML = new TextEditorControl();
            this.contextMenuStrip1 = new ContextMenuStrip(this.components);
            this.menu_Save = new ToolStripMenuItem();
            this.contextMenuStrip1.SuspendLayout();
            base.SuspendLayout();
            this.contextMenuStrip1.Items.AddRange(new ToolStripItem[] { this.menu_Save });
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new Size(0x99, 70);
            this.menu_Save.Name = "menu_Save";
            this.menu_Save.Size = new Size(0x98, 0x16);
            this.menu_Save.Text = "保存(&S)";
            this.menu_Save.Click += new EventHandler(this.menu_Save_Click);
            this.txtContent_Web.Location = new Point(0x141, 0xd6);
            this.txtContent_Web.Name = "txtContent_Web";
            this.txtContent_Web.Size = new Size(200, 200);
            this.txtContent_Web.TabIndex = 0;
            this.txtContent_Web.Text = "";
            this.txtContent_Web.IsIconBarVisible = false;
            this.txtContent_Web.ShowInvalidLines = false;
            this.txtContent_Web.ShowSpaces = false;
            this.txtContent_Web.ShowTabs = false;
            this.txtContent_Web.ShowEOLMarkers = false;
            this.txtContent_Web.ShowVRuler = false;
            this.txtContent_Web.Language = TextEditorControlBase.Languages.HTML;
            this.txtContent_Web.Encoding = Encoding.Default;
            this.txtContent_Web.Font = new Font("新宋体", 9f);
            this.txtContent_Web.ContextMenuStrip = this.contextMenuStrip1;
            this.txtContent_CS.Location = new Point(0xdb, 8);
            this.txtContent_CS.Name = "txtContent_CS";
            this.txtContent_CS.Size = new Size(200, 200);
            this.txtContent_CS.TabIndex = 0;
            this.txtContent_CS.Text = "";
            this.txtContent_CS.IsIconBarVisible = false;
            this.txtContent_CS.ShowInvalidLines = false;
            this.txtContent_CS.ShowSpaces = false;
            this.txtContent_CS.ShowTabs = false;
            this.txtContent_CS.ShowEOLMarkers = false;
            this.txtContent_CS.ShowVRuler = false;
            this.txtContent_CS.Language = TextEditorControlBase.Languages.CSHARP;
            this.txtContent_CS.Encoding = Encoding.Default;
            this.txtContent_CS.Font = new Font("新宋体", 9f);
            this.txtContent_CS.ContextMenuStrip = this.contextMenuStrip1;
            this.txtContent_SQL.Location = new Point(3, 3);
            this.txtContent_SQL.Name = "txtContent_SQL";
            this.txtContent_SQL.Size = new Size(200, 200);
            this.txtContent_SQL.TabIndex = 0;
            this.txtContent_SQL.Text = "";
            this.txtContent_SQL.IsIconBarVisible = false;
            this.txtContent_SQL.ShowInvalidLines = false;
            this.txtContent_SQL.ShowSpaces = false;
            this.txtContent_SQL.ShowTabs = false;
            this.txtContent_SQL.ShowEOLMarkers = false;
            this.txtContent_SQL.ShowVRuler = false;
            this.txtContent_SQL.Language = TextEditorControlBase.Languages.SQL;
            this.txtContent_SQL.Encoding = Encoding.Default;
            this.txtContent_SQL.Font = new Font("新宋体", 9f);
            this.txtContent_SQL.ContextMenuStrip = this.contextMenuStrip1;
            this.txtContent_XML.Location = new Point(3, 3);
            this.txtContent_XML.Name = "txtContent_XML";
            this.txtContent_XML.Size = new Size(200, 200);
            this.txtContent_XML.TabIndex = 0;
            this.txtContent_XML.Text = "";
            this.txtContent_XML.IsIconBarVisible = false;
            this.txtContent_XML.ShowInvalidLines = false;
            this.txtContent_XML.ShowSpaces = false;
            this.txtContent_XML.ShowTabs = false;
            this.txtContent_XML.ShowEOLMarkers = false;
            this.txtContent_XML.ShowVRuler = false;
            this.txtContent_XML.Language = TextEditorControlBase.Languages.XML;
            this.txtContent_XML.Encoding = Encoding.Default;
            this.txtContent_XML.Font = new Font("新宋体", 9f);
            this.txtContent_XML.ContextMenuStrip = this.contextMenuStrip1;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.txtContent_Web);
            base.Controls.Add(this.txtContent_CS);
            base.Controls.Add(this.txtContent_SQL);
            base.Controls.Add(this.txtContent_XML);
            base.Name = "UcCodeView";
            this.Dock = DockStyle.Fill;
            base.Size = new Size(0x15a, 0x13d);
            this.contextMenuStrip1.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private void menu_Save_Click(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Title = "保存当前代码";
            string text = "";
            if (this.txtContent_CS.Visible)
            {
                dialog.Filter = "C# files (*.cs)|*.cs|All files (*.*)|*.*";
                text = this.txtContent_CS.Text;
            }
            if (this.txtContent_SQL.Visible)
            {
                dialog.Filter = "SQL files (*.sql)|*.cs|All files (*.*)|*.*";
                text = this.txtContent_SQL.Text;
            }
            if (this.txtContent_Web.Visible)
            {
                dialog.Filter = "Aspx files (*.aspx)|*.cs|All files (*.*)|*.*";
                text = this.txtContent_Web.Text;
            }
            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                StreamWriter writer = new StreamWriter(dialog.FileName, false, Encoding.Default);
                writer.Write(text);
                writer.Flush();
                writer.Close();
            }
        }

        public void SettxtContent(string Type, string strContent)
        {
            string str = Type;
            if (str != null)
            {
                if (!(str == "SQL"))
                {
                    if (!(str == "CS"))
                    {
                        if (!(str == "Aspx"))
                        {
                            if (str == "XML")
                            {
                                this.txtContent_SQL.Visible = false;
                                this.txtContent_CS.Visible = false;
                                this.txtContent_Web.Visible = false;
                                this.txtContent_XML.Visible = true;
                                this.txtContent_XML.Dock = DockStyle.Fill;
                                this.txtContent_XML.Text = strContent;
                            }
                            return;
                        }
                        this.txtContent_SQL.Visible = false;
                        this.txtContent_CS.Visible = false;
                        this.txtContent_XML.Visible = false;
                        this.txtContent_Web.Visible = true;
                        this.txtContent_Web.Dock = DockStyle.Fill;
                        this.txtContent_Web.Text = strContent;
                        return;
                    }
                }
                else
                {
                    this.txtContent_SQL.Visible = true;
                    this.txtContent_CS.Visible = false;
                    this.txtContent_Web.Visible = false;
                    this.txtContent_XML.Visible = false;
                    this.txtContent_SQL.Dock = DockStyle.Fill;
                    this.txtContent_SQL.Text = strContent;
                    return;
                }
                this.txtContent_SQL.Visible = false;
                this.txtContent_CS.Visible = true;
                this.txtContent_Web.Visible = false;
                this.txtContent_XML.Visible = false;
                this.txtContent_CS.Dock = DockStyle.Fill;
                this.txtContent_CS.Text = strContent;
            }
        }
    }
}

⌨️ 快捷键说明

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