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

📄 dbquery.cs

📁 通过数据库结构自动 生成三层结构代码,相当不错的一款软件
💻 CS
📖 第 1 页 / 共 4 页
字号:
            if (length == 0)
            {
                length++;
            }
            this.txtContent.Select(offset, length);
            this.txtContent.SetLine(line - 1);
        }

        public void GoToReferenceAny()
        {
        }

        public void GoToReferenceObject()
        {
            this.Cursor = Cursors.WaitCursor;
            string currentWord = this.txtContent.GetCurrentWord();
            if (currentWord.IndexOf(".") > -1)
            {
                currentWord = currentWord.Substring(currentWord.IndexOf(".") + 1);
            }
            if (currentWord.Length == 0)
            {
                MessageBox.Show("The referenced object was not found", "Go to reference", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.Cursor = Cursors.Default;
            }
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            new DefaultFormattingStrategy();
            DefaultHighlightingStrategy strategy = new DefaultHighlightingStrategy();
            new GapTextBufferStrategy();
            DefaultTextEditorProperties properties = new DefaultTextEditorProperties();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(DbQuery));
            this.txtContent = new TextEditorControlWrapper();
            this.cmShortcutMeny = new ContextMenu();
            this.statusStrip1 = new StatusStrip();
            this.toolStripStatusLabel1 = new ToolStripStatusLabel();
            this.toolStripStatusLabel2 = new ToolStripStatusLabel();
            this.tabControl1 = new TabControl();
            this.tabPage1 = new TabPage();
            this.dataGridView1 = new DataGridView();
            this.tabPage2 = new TabPage();
            this.txtInfo = new RichTextBox();
            this.imageList1 = new ImageList(this.components);
            this.splitter1 = new Splitter();
            this.ttParamenterInfo = new ToolTip(this.components);
            this.ExecutionTimer = new Timer(this.components);
            this.printDocument = new PrintDocument();
            this.imageList2 = new ImageList(this.components);
            this.toolTip1 = new ToolTip(this.components);
            this.pageSetupDialog = new PageSetupDialog();
            this.cmDragAndDrp = new ContextMenu();
            this.menuItemObjectName = new MenuItem();
            this.menuItemSplitter = new MenuItem();
            this.menuItemSelect1 = new MenuItem();
            this.menuItemSelect2 = new MenuItem();
            this.menuItemJoin = new MenuItem();
            this.menuItemLeftOuterJoin = new MenuItem();
            this.menuItemRightOuterJoin = new MenuItem();
            this.menuItemWhere = new MenuItem();
            this.menuItemOrderBy = new MenuItem();
            this.menuItemGroupBy = new MenuItem();
            this.printDialog = new PrintDialog();
            this.contextMenu1 = new ContextMenu();
            this.printPreviewDialog = new PrintPreviewDialog();
            this.statusStrip1.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            ((ISupportInitialize) this.dataGridView1).BeginInit();
            this.tabPage2.SuspendLayout();
            base.SuspendLayout();
            this.txtContent.AllowDrop = true;
            this.txtContent.AutoScroll = true;
            this.txtContent.Dock = DockStyle.Fill;
            strategy.Extensions = new string[] { ".SQL" };
            properties.AllowCaretBeyondEOL = false;
            properties.AutoInsertCurlyBracket = true;
            properties.BracketMatchingStyle = BracketMatchingStyle.After;
            properties.ConvertTabsToSpaces = false;
            properties.CreateBackupCopy = false;
            properties.DocumentSelectionMode = DocumentSelectionMode.Normal;
            properties.EnableFolding = true;
            properties.Encoding = (Encoding) manager.GetObject("defaultTextEditorProperties1.Encoding");
            properties.Font = new Font("Courier New", 10f);
            properties.HideMouseCursor = false;
            properties.IndentStyle = IndentStyle.Smart;
            properties.IsIconBarVisible = false;
            properties.LineTerminator = "\r\n";
            properties.LineViewerStyle = LineViewerStyle.None;
            properties.MouseWheelScrollDown = true;
            properties.MouseWheelTextZoom = true;
            properties.ShowEOLMarker = false;
            properties.ShowHorizontalRuler = false;
            properties.ShowInvalidLines = false;
            properties.ShowLineNumbers = true;
            properties.ShowMatchingBracket = true;
            properties.ShowSpaces = false;
            properties.ShowTabs = false;
            properties.ShowVerticalRuler = false;
            properties.TabIndent = 4;
            properties.UseAntiAliasedFont = false;
            properties.UseCustomLine = false;
            properties.VerticalRulerRow = 80;
            this.txtContent.Encoding = (Encoding) manager.GetObject("txtContent.Encoding");
            this.txtContent.IsIconBarVisible = false;
            this.txtContent.Location = new Point(0, 0);
            this.txtContent.Name = "txtContent";
            this.txtContent.SelectedText = "";
            this.txtContent.SelectionStart = 0;
            this.txtContent.ShowInvalidLines = false;
            this.txtContent.ShowSpaces = false;
            this.txtContent.ShowTabs = false;
            this.txtContent.ShowVRuler = false;
            this.txtContent.Size = new Size(0x179, 0x101);
            this.txtContent.TabIndex = 2;
            this.txtContent.TextEditorProperties = properties;
            this.txtContent.KeyPressEvent += new TextEditorControlWrapper.KeyPressEventHandler(this.qcTextEditor_KeyPressEvent);
            this.txtContent.RMouseUpEvent += new TextEditorControlWrapper.MYMouseRButtonUpEventHandler(this.qcTextEditor_MouseUp);
            this.statusStrip1.Items.AddRange(new ToolStripItem[] { this.toolStripStatusLabel1, this.toolStripStatusLabel2 });
            this.statusStrip1.Location = new Point(0, 0x194);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.ShowItemToolTips = true;
            this.statusStrip1.Size = new Size(0x179, 0x16);
            this.statusStrip1.TabIndex = 3;
            this.statusStrip1.Text = "statusStrip1";
            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.Size = new Size(0, 0x11);
            this.toolStripStatusLabel1.TextAlign = ContentAlignment.MiddleLeft;
            this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
            this.toolStripStatusLabel2.Size = new Size(0x16a, 0x11);
            this.toolStripStatusLabel2.Spring = true;
            this.toolStripStatusLabel2.TextAlign = ContentAlignment.MiddleRight;
            this.tabControl1.Alignment = TabAlignment.Bottom;
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Dock = DockStyle.Bottom;
            this.tabControl1.ImageList = this.imageList1;
            this.tabControl1.Location = new Point(0, 260);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.ShowToolTips = true;
            this.tabControl1.Size = new Size(0x179, 0x90);
            this.tabControl1.TabIndex = 4;
            this.tabPage1.Controls.Add(this.dataGridView1);
            this.tabPage1.ImageIndex = 0;
            this.tabPage1.Location = new Point(4, 4);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Size = new Size(0x171, 0x75);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "结果";
            this.tabPage1.ToolTipText = "查询结果";
            this.tabPage1.UseVisualStyleBackColor = true;
            this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Dock = DockStyle.Fill;
            this.dataGridView1.Location = new Point(0, 0);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.RowTemplate.Height = 0x17;
            this.dataGridView1.Size = new Size(0x171, 0x75);
            this.dataGridView1.TabIndex = 0;
            this.tabPage2.Controls.Add(this.txtInfo);
            this.tabPage2.ImageIndex = 1;
            this.tabPage2.Location = new Point(4, 4);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Size = new Size(0x171, 0x75);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "消息";
            this.tabPage2.ToolTipText = "语句执行情况";
            this.tabPage2.UseVisualStyleBackColor = true;
            this.txtInfo.Dock = DockStyle.Fill;
            this.txtInfo.Location = new Point(0, 0);
            this.txtInfo.Name = "txtInfo";
            this.txtInfo.Size = new Size(0x171, 0x75);
            this.txtInfo.TabIndex = 0;
            this.txtInfo.Text = "";
            this.imageList1.ImageStream = (ImageListStreamer) manager.GetObject("imageList1.ImageStream");
            this.imageList1.TransparentColor = Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "exec.ico");
            this.imageList1.Images.SetKeyName(1, "chat.ico");
            this.splitter1.Dock = DockStyle.Bottom;
            this.splitter1.Location = new Point(0, 0x101);
            this.splitter1.Name = "splitter1";
            this.splitter1.Size = new Size(0x179, 3);
            this.splitter1.TabIndex = 5;
            this.splitter1.TabStop = false;
            this.ttParamenterInfo.Active = false;
            this.imageList2.ImageStream = (ImageListStreamer) manager.GetObject("imageList2.ImageStream");
            this.imageList2.TransparentColor = Color.Transparent;
            this.imageList2.Images.SetKeyName(0, "");
            this.imageList2.Images.SetKeyName(1, "");
            this.imageList2.Images.SetKeyName(2, "");
            this.imageList2.Images.SetKeyName(3, "");
            this.imageList2.Images.SetKeyName(4, "");
            this.imageList2.Images.SetKeyName(5, "");
            this.imageList2.Images.SetKeyName(6, "");
            this.pageSetupDialog.Document = this.printDocument;
            this.cmDragAndDrp.MenuItems.AddRange(new MenuItem[] { this.menuItemObjectName, this.menuItemSplitter, this.menuItemSelect1, this.menuItemSelect2, this.menuItemJoin, this.menuItemLeftOuterJoin, this.menuItemRightOuterJoin, this.menuItemWhere, this.menuItemOrderBy, this.menuItemGroupBy });
            this.menuItemObjectName.Index = 0;
            this.menuItemObjectName.Text = "Object name";
            this.menuItemObjectName.Click += new EventHandler(this.menuItemObjectName_Click);
            this.menuItemSplitter.Index = 1;
            this.menuItemSplitter.Text = "-";
            this.menuItemSelect1.Index = 2;
            this.menuItemSelect1.Text = "SELECT * FROM...";
            this.menuItemSelect1.Click += new EventHandler(this.menuItemSelect1_Click);
            this.menuItemSelect2.Index = 3;
            this.menuItemSelect2.Text = "SELECT [Fields] FROM";
            this.menuItemSelect2.Click += new EventHandler(this.menuItemSelect2_Click);
            this.menuItemJoin.Index = 4;
            this.menuItemJoin.Text = "UPDATE...";
            this.menuItemJoin.Click += new EventHandler(this.menuItemJoin_Click);
            this.menuItemLeftOuterJoin.Index = 5;
            this.menuItemLeftOuterJoin.Text = "DELETE FROM...";
            this.menuItemLeftOuterJoin.Click += new EventHandler(this.menuItemLeftOuterJoin_Click);
            this.menuItemRightOuterJoin.Index = 6;
            this.menuItemRightOuterJoin.Text = "INSERT INTO ...";
            this.menuItemRightOuterJoin.Click += new EventHandler(this.menuItemRightOuterJoin_Click);
            this.menuItemWhere.Index = 7;
            this.menuItemWhere.Text = "WHERE";
            this.menuItemWhere.Click += new EventHandler(this.menuItemWhere_Click);
            this.menuItemOrderBy.Index = 8;
            this.menuItemOrderBy.Text = "ORDER BY";
            this.menuItemOrderBy.Click += new EventHandler(this.menuItemOrderBy_Click);
            this.menuItemGroupBy.Index = 9;
            this.menuItemGroupBy.Text = "GROUP BY";
            this.menuItemGroupBy.Click += new EventHandler(this.menuItemGroupBy_Click);
            this.printDialog.Document = this.printDocument;
            this.printPreviewDialog.AutoScrollMargin = new Size(0, 0);
            this.printPreviewDialog.AutoScrollMinSize = new Size(0, 0);
            this.printPreviewDialog.ClientSize = new Size(400, 300);
            this.printPreviewDialog.Document = this.printDocument;
            this.printPreviewDialog.Enabled = true;
            this.printPreviewDialog.Icon = (Icon) manager.GetObject("printPreviewDialog.Icon");
            this.printPreviewDialog.Name = "printPreviewDialog";
            this.printPreviewDialog.Visible = false;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x179, 0x1aa);
            base.Controls.Add(this.txtContent);
            base.Controls.Add(this.splitter1);
            base.Controls.Add(this.tabControl1);
            base.Controls.Add(this.statusStrip1);
            base.Name = "DbQuery";
            this.Text = "DbQuery";
            base.FormClosing += new FormClosingEventHandler(this.DbQuery_FormClosing);
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            ((ISupportInitialize) this.dataGridView1).EndInit();
            this.tabPage2.ResumeLayout(false);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        public void InsertHeader()
        {
        }

        private void menuItemGroupBy_Click(object sender, EventArgs e)
        {
        }

        private void menuItemJoin_Click(object sender, EventArgs e)
        {
            string text = this._dragObject.Parent.Parent.Parent.Text;
            string dbname = this._dragObject.Parent.Parent.Text;
            string tablename = this._dragObject.Text;
            string sQLUpdate = ObjHelper.CreatDsb(text).GetSQLUpdate(dbname, tablename);
            this.txtContent.ActiveTextAreaControl.TextArea.InsertString(sQLUpdate);
        }

        private void menuItemLeftOuterJoin_Click(object sender, EventArgs e)
        {
            string text = this._dragObject.Parent.Parent.Parent.Text;
            string dbname = this._dragObject.Parent.Parent.Text;
            string tablename = this._dragObject.Text;
            string sQLDelete = ObjHelper.CreatDsb(text).GetSQLDelete(dbname, tablename);
            this.txtContent.ActiveTextAreaControl.TextArea.InsertString(sQLDelete);
        }

        private void menuItemObjectName_Click(object sender, EventArgs e)
        {
            string text = this._dragObject.Text;
            this.txtContent.ActiveTextAreaControl.TextArea.InsertString(text);
        }

        private void menuItemOrderBy_Click(object sender, EventArgs e)
        {
        }

        private void menuItemRightOuterJoin_Click(object sender, EventArgs e)
        {
            string text = this._dragObject.Parent.Parent.Parent.Text;
            string dbname = this._dragObject.Parent.Parent.Text;
            string tablename = this._dragObject.Text;
            string sQLInsert = ObjHelper.CreatDsb(text).GetSQLInsert(dbname, tablename);
            this.txtContent.ActiveTextAreaControl.TextArea.InsertString(sQLInsert);
        }

        private void menuItemSelect1_Click(object sender, EventArgs e)
        {
            string str = "SELECT *\nFROM\t" + this._dragObject.Text + "\n";
            this.txtContent.ActiveTextAreaControl.TextArea.InsertString(str);
        }

        private void menuItemSelect2_Click(object sender, EventArgs e)
        {

⌨️ 快捷键说明

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